From: Junio C Hamano Date: Wed, 24 Feb 2016 21:25:53 +0000 (-0800) Subject: Merge branch 'nd/git-common-dir-fix' X-Git-Tag: v2.8.0-rc0~35 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/8020803f5057601c1c29ffcdbd309905bd26eef7?ds=inline;hp=-c 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 --- 8020803f5057601c1c29ffcdbd309905bd26eef7 diff --combined builtin/rev-parse.c index bd16876df5,7a4f2c0b0c..cf8487b3b9 --- a/builtin/rev-parse.c +++ b/builtin/rev-parse.c @@@ -383,7 -383,7 +383,7 @@@ static int cmd_parseopt(int argc, cons /* get the usage up to the first line with a -- on it */ for (;;) { - if (strbuf_getline(&sb, stdin, '\n') == EOF) + if (strbuf_getline(&sb, stdin) == EOF) die("premature end of input"); ALLOC_GROW(usage, unb + 1, usz); if (!strcmp("--", sb.buf)) { @@@ -396,7 -396,7 +396,7 @@@ } /* parse: (|,|)[*=?!]*? SP+ */ - while (strbuf_getline(&sb, stdin, '\n') != EOF) { + while (strbuf_getline(&sb, stdin) != EOF) { const char *s; const char *help; struct option *o; @@@ -763,7 -763,8 +763,8 @@@ int cmd_rev_parse(int argc, const char 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")) {