Skip to content

Commit 37d4ae5

Browse files
committed
Merge branch 'kl/setup-in-unreadable-worktree'
Disable the "do not remove the directory the user started Git in" logic when Git cannot tell where that directory is. Earlier we refused to run in such a case. * kl/setup-in-unreadable-worktree: setup: don't die if realpath(3) fails on getcwd(3)
2 parents 28db3b7 + c37c6dc commit 37d4ae5

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

setup.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,16 @@ static void setup_original_cwd(void)
459459
*/
460460

461461
/* Normalize the directory */
462-
strbuf_realpath(&tmp, tmp_original_cwd, 1);
462+
if (!strbuf_realpath(&tmp, tmp_original_cwd, 0)) {
463+
trace2_data_string("setup", the_repository,
464+
"realpath-path", tmp_original_cwd);
465+
trace2_data_string("setup", the_repository,
466+
"realpath-failure", strerror(errno));
467+
free((char*)tmp_original_cwd);
468+
tmp_original_cwd = NULL;
469+
return;
470+
}
471+
463472
free((char*)tmp_original_cwd);
464473
tmp_original_cwd = NULL;
465474
startup_info->original_cwd = strbuf_detach(&tmp, NULL);

0 commit comments

Comments
 (0)