--internal-cwd is obvious, no way else to expose it for testing.
--internal-git-dir is introduced because --git-dir prepares its output
suitable for scripting. For tests, it must be exactly what git stores.
---
builtin/rev-parse.c | 11 +++++++++++
1 files changed, 11 insertions(+), 0 deletions(-)
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index a5a1c86..454a25c 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -642,6 +642,17 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
putchar('\n');
continue;
}
+ if (!strcmp(arg, "--internal-cwd")) {
+ static char cwd[PATH_MAX];
+ if (!getcwd(cwd, PATH_MAX))
+ die_errno("unable to get current working directory");
+ puts(cwd);
+ continue;
+ }
+ if (!strcmp(arg, "--internal-git-dir")) {
+ puts(get_git_dir());
+ continue;
+ }
if (!strcmp(arg, "--git-dir")) {
const char *gitdir = getenv(GIT_DIR_ENVIRONMENT);
static char cwd[PATH_MAX];--
1.7.0.2.445.gcbdb3