[PATCH] init: don't reset core.filemode on git-new-workdirs.
DORMANTno replies
From: Madhu <hidden>
Date: 2021-03-21 12:36:30
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Madhu <hidden>
Date: 2021-03-21 12:36:30
Subsystem:
the rest · Maintainer:
Linus Torvalds
From: Madhu <redacted> If the .git/config file is a symlink (as is the case of a .git created by the contrib/workdir/git-new-workdir script) then the filemode tests fail, and the filemode is reset to be false. To avoid this only munge core.filemode if .git/config is a regular file. --- builtin/init-db.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/builtin/init-db.c b/builtin/init-db.c
index dcc45bef51..b053107336 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c@@ -285,7 +285,8 @@ static int create_default_files(const char *template_path, /* Check filemode trustability */ path = git_path_buf(&buf, "config"); filemode = TEST_FILEMODE; - if (TEST_FILEMODE && !lstat(path, &st1)) { + if (TEST_FILEMODE && !lstat(path, &st1) + && (st1.st_mode & S_IFMT) == S_IFREG) { struct stat st2; filemode = (!chmod(path, st1.st_mode ^ S_IXUSR) && !lstat(path, &st2) &&
--
2.31.0.dirty