rev-parse: --local-env-vars option
This prints the list of repo-local environment variables. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Giuseppe Bilotta committed
Feb 25, 2010 at 00:34 UTC
94c8ccaaba4ac8b0225f5adeae4ff29f01951bce
2 files changed
+13
Documentation/git-rev-parse.txt
+6
@@ -149,6 +149,12 @@ shown. If the pattern does not contain a globbing character (`?`,
149
--is-bare-repository::
150
When the repository is bare print "true", otherwise "false".
151
152
+--local-env-vars::
153
+ List the GIT_* environment variables that are local to the
154
+ repository (e.g. GIT_DIR or GIT_WORK_TREE, but not GIT_EDITOR).
155
+ Only the names of the variables are listed, not their value,
156
+ even if they are set.
157
+
158
--short::
159
--short=number::
160
Instead of outputting the full SHA1 values of object names try to
builtin-rev-parse.c
+7
@@ -455,6 +455,13 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
455
if (argc > 1 && !strcmp("--sq-quote", argv[1]))
456
return cmd_sq_quote(argc - 2, argv + 2);
457
458
+ if (argc == 2 && !strcmp("--local-env-vars", argv[1])) {
459
+ int i;
460
+ for (i = 0; local_repo_env[i]; i++)
461
+ printf("%s\n", local_repo_env[i]);
462
+ return 0;
463
+ }
464
+
465
if (argc > 1 && !strcmp("-h", argv[1]))
466
usage(builtin_rev_parse_usage);
467