Skip to content

Commit e524fb4

Browse files
committed
Merge branch 'mh/config-flip-xbit-back-after-checking' into maint
"git init" (hence "git clone") initialized the per-repository configuration file .git/config with x-bit by mistake. * mh/config-flip-xbit-back-after-checking: create_default_files(): don't set u+x bit on $GIT_DIR/config
2 parents 0b5c641 + 1f32ecf commit e524fb4

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

builtin/init-db.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,8 @@ static int create_default_files(const char *template_path)
254254
struct stat st2;
255255
filemode = (!chmod(path, st1.st_mode ^ S_IXUSR) &&
256256
!lstat(path, &st2) &&
257-
st1.st_mode != st2.st_mode);
257+
st1.st_mode != st2.st_mode &&
258+
!chmod(path, st1.st_mode));
258259
}
259260
git_config_set("core.filemode", filemode ? "true" : "false");
260261

t/t0001-init.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@ check_config () {
1212
echo "expected a directory $1, a file $1/config and $1/refs"
1313
return 1
1414
fi
15+
16+
if test_have_prereq POSIXPERM && test -x "$1/config"
17+
then
18+
echo "$1/config is executable?"
19+
return 1
20+
fi
21+
1522
bare=$(cd "$1" && git config --bool core.bare)
1623
worktree=$(cd "$1" && git config core.worktree) ||
1724
worktree=unset

0 commit comments

Comments
 (0)