summaryrefslogtreecommitdiff
path: root/builtin-rev-parse.c
diff options
context:
space:
mode:
authorSteven Drake <sdrake@xnet.co.nz>2010-01-11 22:33:48 (GMT)
committerJunio C Hamano <gitster@pobox.com>2010-01-12 03:47:35 (GMT)
commit7cceca5cccdcf1f0f9caa80b82d26fcff65e6fdf (patch)
tree0bddf16eecc851a173112942ab89bac75f614310 /builtin-rev-parse.c
parent902f235378cb2b2f6dd5dd664b9630c95321f0ae (diff)
downloadgit-7cceca5cccdcf1f0f9caa80b82d26fcff65e6fdf.zip
git-7cceca5cccdcf1f0f9caa80b82d26fcff65e6fdf.tar.gz
git-7cceca5cccdcf1f0f9caa80b82d26fcff65e6fdf.tar.bz2
Add 'git rev-parse --show-toplevel' option.
Shows the absolute path of the top-level working directory. Signed-off-by: Steven Drake <sdrake@xnet.co.nz> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-rev-parse.c')
-rw-r--r--builtin-rev-parse.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/builtin-rev-parse.c b/builtin-rev-parse.c
index 37d0233..cbe5b42 100644
--- a/builtin-rev-parse.c
+++ b/builtin-rev-parse.c
@@ -581,6 +581,12 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
for_each_remote_ref(show_reference, NULL);
continue;
}
+ if (!strcmp(arg, "--show-toplevel")) {
+ const char *work_tree = get_git_work_tree();
+ if (work_tree)
+ puts(work_tree);
+ continue;
+ }
if (!strcmp(arg, "--show-prefix")) {
if (prefix)
puts(prefix);