From 94c8ccaaba4ac8b0225f5adeae4ff29f01951bce Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Thu, 25 Feb 2010 00:34:15 +0100 Subject: [PATCH] rev-parse: --local-env-vars option This prints the list of repo-local environment variables. Signed-off-by: Giuseppe Bilotta Signed-off-by: Junio C Hamano --- Documentation/git-rev-parse.txt | 6 ++++++ builtin-rev-parse.c | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index d677c72d5e..33092a3373 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -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 diff --git a/builtin-rev-parse.c b/builtin-rev-parse.c index a8c5043ded..b76f205e62 100644 --- a/builtin-rev-parse.c +++ b/builtin-rev-parse.c @@ -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); -- 2.11.4.GIT