diff options
author | Junio C Hamano <gitster@pobox.com> | 2016-03-10 11:13:39 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2016-03-10 11:13:40 -0800 |
commit | 9c17ccaa49d00a87cefe0ef18a371e4f45e968fc (patch) | |
tree | 7298abc8c0eb2d71be9cfda6a324f3d254ae3a00 /builtin | |
parent | 8834ea375a404a6c79a6d8cd8cbc9954c6f2847d (diff) | |
parent | 17f1365dbce9aa00cab3f196e7fa7138d9081eef (diff) | |
download | git-9c17ccaa49d00a87cefe0ef18a371e4f45e968fc.tar.gz git-9c17ccaa49d00a87cefe0ef18a371e4f45e968fc.tar.xz |
Merge branch 'nd/git-common-dir-fix' into maint
"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')
-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 7e074aad4..7a4f2c0b0 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")) { |