This prints the list of repo-local environment variables. Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@xxxxxxxxx> --- Documentation/git-rev-parse.txt | 6 ++++++ builtin-rev-parse.c | 8 ++++++++ 2 files changed, 14 insertions(+), 0 deletions(-) diff --git a/Documentation/git-rev-parse.txt b/Documentation/git-rev-parse.txt index 1a613aa..8db600f 100644 --- a/Documentation/git-rev-parse.txt +++ b/Documentation/git-rev-parse.txt @@ -148,6 +148,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 a8c5043..ab7b520 100644 --- a/builtin-rev-parse.c +++ b/builtin-rev-parse.c @@ -455,7 +455,15 @@ 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 > 0 && !strcmp("--local-env-vars", argv[1])) { + unsigned int i = 0; + const char *var; + while (var = local_repo_env[i++]) + printf("%s\n", var); + return 0; + } if (argc > 1 && !strcmp("-h", argv[1])) + usage(builtin_rev_parse_usage); prefix = setup_git_directory(); -- 1.7.0.212.g4e217.dirty -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html