From: Nguyễn Thái Ngọc Duy Date: Fri, 29 Oct 2010 06:48:47 GMT Subject: [PATCH 35/42] rev-parse: prints --git-dir relative to user's cwd Message-ID: <1288334934-17216-36-git-send-email-pclouds@gmail.com> In-Reply-To: <1288334934-17216-1-git-send-email-pclouds@gmail.com> git-rev-parse.txt does not say much about this. But I'm sure git-sh-setup.sh wants "git rev-parse --git-dir" be relative to user's cwd. git_dir variable in environment.c on the other hand is relative to git's cwd, not user's cwd. Convert the relative path (actualy by making it absolute path) before printing out. Signed-off-by: Nguyễn Thái Ngọc Duy --- builtin/rev-parse.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c index a5a1c86..65c287b 100644 --- a/builtin/rev-parse.c +++ b/builtin/rev-parse.c @@ -647,7 +647,11 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix) static char cwd[PATH_MAX]; int len; if (gitdir) { - puts(gitdir); + if (is_absolute_path(gitdir) || !prefix) { + puts(gitdir); + continue; + } + puts(make_absolute_path(gitdir)); continue; } if (!prefix) { -- 1.7.0.2.445.gcbdb3