Skip to content

Commit

Permalink
rev-parse: --local-env-vars option
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Giuseppe Bilotta authored and Junio C Hamano committed Feb 25, 2010
1 parent 48a7c1c commit 94c8cca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Documentation/git-rev-parse.txt
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,12 @@ shown. If the pattern does not contain a globbing character (`?`,
--is-bare-repository::
When the repository is bare print "true", otherwise "false".

--local-env-vars::
List the GIT_* environment variables that are local to the
repository (e.g. GIT_DIR or GIT_WORK_TREE, but not GIT_EDITOR).
Only the names of the variables are listed, not their value,
even if they are set.

--short::
--short=number::
Instead of outputting the full SHA1 values of object names try to
Expand Down
7 changes: 7 additions & 0 deletions builtin-rev-parse.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,13 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
if (argc > 1 && !strcmp("--sq-quote", argv[1]))
return cmd_sq_quote(argc - 2, argv + 2);

if (argc == 2 && !strcmp("--local-env-vars", argv[1])) {
int i;
for (i = 0; local_repo_env[i]; i++)
printf("%s\n", local_repo_env[i]);
return 0;
}

if (argc > 1 && !strcmp("-h", argv[1]))
usage(builtin_rev_parse_usage);

Expand Down

0 comments on commit 94c8cca

Please sign in to comment.