diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-02-24 13:25:53 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-02-24 13:25:53 -0800 |
commit | 8020803f5057601c1c29ffcdbd309905bd26eef7 (patch) | |
tree | d4f0bbfcd50de828c54b8187a98b821c5ad2ce21 /builtin/rev-parse.c | |
parent | e6a6a768ca472afed90adbbd786e5c04fff6be7b (diff) | |
parent | 17f1365dbce9aa00cab3f196e7fa7138d9081eef (diff) | |
download | git-8020803f5057601c1c29ffcdbd309905bd26eef7.tar.gz |
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.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c index bd16876df5..cf8487b3b9 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")) { |