From 502ffe3491bb6a3aff3f93e7eea19c01cf30c337 Mon Sep 17 00:00:00 2001 From: "Lars R. Damerow" Date: Wed, 17 Mar 2010 12:55:52 -0700 Subject: [PATCH] truncate cwd string before printing error message Without this truncation the error message printed only shows the cwd from the start of the search, not where it failed. Signed-off-by: Lars R. Damerow Signed-off-by: Junio C Hamano --- setup.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/setup.c b/setup.c index 5716d90b5..f0b56b9f5 100644 --- a/setup.c +++ b/setup.c @@ -422,8 +422,10 @@ const char *setup_git_directory_gently(int *nongit_ok) } die("Not a git repository (or any of the parent directories): %s", DEFAULT_GIT_DIR_ENVIRONMENT); } - if (chdir("..")) + if (chdir("..")) { + cwd[offset] = '\0'; die_errno("Cannot change to '%s/..'", cwd); + } } inside_git_dir = 0; -- 2.30.2