From 7cceca5cccdcf1f0f9caa80b82d26fcff65e6fdf Mon Sep 17 00:00:00 2001 From: Steven Drake Date: Tue, 12 Jan 2010 11:33:48 +1300 Subject: Add 'git rev-parse --show-toplevel' option. Shows the absolute path of the top-level working directory. Signed-off-by: Steven Drake Signed-off-by: Junio C Hamano --- builtin-rev-parse.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'builtin-rev-parse.c') diff --git a/builtin-rev-parse.c b/builtin-rev-parse.c index 37d0233521..cbe5b428ad 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); -- cgit 1.2.3-korg