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 <lars@pixar.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Lars R. Damerow committed
Mar 17, 2010 at 12:55 UTC
502ffe3491bb6a3aff3f93e7eea19c01cf30c337
1 file changed
+3
-1
setup.c
+3
-1
@@ -422,8 +422,10 @@ const char *setup_git_directory_gently(int *nongit_ok)
422
}
423
die("Not a git repository (or any of the parent directories): %s", DEFAULT_GIT_DIR_ENVIRONMENT);
424
}
425
- if (chdir(".."))
425
+ if (chdir("..")) {
426
+ cwd[offset] = '\0';
427
die_errno("Cannot change to '%s/..'", cwd);
428
+ }
429
}
430
431
inside_git_dir = 0;