summaryrefslogtreecommitdiff
path: root/builtin/rev-parse.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2016-02-24 21:25:53 (GMT)
committerJunio C Hamano <gitster@pobox.com>2016-02-24 21:25:53 (GMT)
commit8020803f5057601c1c29ffcdbd309905bd26eef7 (patch)
treed4f0bbfcd50de828c54b8187a98b821c5ad2ce21 /builtin/rev-parse.c
parente6a6a768ca472afed90adbbd786e5c04fff6be7b (diff)
parent17f1365dbce9aa00cab3f196e7fa7138d9081eef (diff)
downloadgit-8020803f5057601c1c29ffcdbd309905bd26eef7.zip
git-8020803f5057601c1c29ffcdbd309905bd26eef7.tar.gz
git-8020803f5057601c1c29ffcdbd309905bd26eef7.tar.bz2
Merge branch 'nd/git-common-dir-fix'
"git rev-parse --git-common-dir" used in the worktree feature misbehaved when run from a subdirectory. * nd/git-common-dir-fix: rev-parse: take prefix into account in --git-common-dir
Diffstat (limited to 'builtin/rev-parse.c')
-rw-r--r--builtin/rev-parse.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index bd16876..cf8487b 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -763,7 +763,8 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
continue;
}
if (!strcmp(arg, "--git-common-dir")) {
- puts(get_git_common_dir());
+ const char *pfx = prefix ? prefix : "";
+ puts(prefix_filename(pfx, strlen(pfx), get_git_common_dir()));
continue;
}
if (!strcmp(arg, "--resolve-git-dir")) {