From: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
To: git@vger.kernel.org
Cc: Junio C Hamano <gitster@pobox.com>,
Heiko Voigt <hvoigt@hvoigt.net>,
msysGit Mailinglist <msysgit@googlegroups.com>,
Johannes Sixt <j.sixt@viscovery.net>,
Jens Lehmann <Jens.Lehmann@web.de>,
Johannes Schindelin <Johannes.Schindelin@gmx.de>,
Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
Subject: [PATCHv5 2/5] rev-parse: --local-env-vars option
Date: Thu, 25 Feb 2010 00:34:15 +0100 [thread overview]
Message-ID: <1267054458-11877-3-git-send-email-giuseppe.bilotta@gmail.com> (raw)
In-Reply-To: <1267054458-11877-1-git-send-email-giuseppe.bilotta@gmail.com>
This prints the list of repo-local environment variables.
Signed-off-by: Giuseppe Bilotta <giuseppe.bilotta@gmail.com>
---
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.g5b851b.dirty
next prev parent reply other threads:[~2010-02-24 23:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-02-24 23:34 [PATCHv5 0/5] repo-local env vars handling Giuseppe Bilotta
2010-02-24 23:34 ` [PATCHv5 1/5] Refactor list of of repo-local env vars Giuseppe Bilotta
2010-02-24 23:34 ` Giuseppe Bilotta [this message]
2010-02-27 21:07 ` [PATCHv5 2/5] rev-parse: --local-env-vars option Heiko Voigt
2010-02-24 23:34 ` [PATCHv5 3/5] shell setup: clear_local_git_env() function Giuseppe Bilotta
2010-02-24 23:34 ` [PATCHv5 4/5] submodules: ensure clean environment when operating in a submodule Giuseppe Bilotta
2010-02-24 23:34 ` [PATCHv5 5/5] is_submodule_modified(): clear environment properly Giuseppe Bilotta
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1267054458-11877-3-git-send-email-giuseppe.bilotta@gmail.com \
--to=giuseppe.bilotta@gmail.com \
--cc=Jens.Lehmann@web.de \
--cc=Johannes.Schindelin@gmx.de \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=hvoigt@hvoigt.net \
--cc=j.sixt@viscovery.net \
--cc=msysgit@googlegroups.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).