Skip to content

Commit 452993c

Browse files
Ramsay Jonesgitster
authored andcommitted
t1301-*.sh: Fix the 'forced modes' test on cygwin
The 'forced modes' test fails on cygwin because the post-update hook loses it's executable bit when copied from the templates directory by git-init. The template loses it's executable bit because the lstat() function resolves to the "native Win32 API" implementation. This call to lstat() happens after git-init has set the "git_dir" (so has_git_dir() returns true), but before the configuration has been fully initialised. At this point git_config() does not find any config files to parse and returns 0. Unfortunately, the code used to determine the cygwin l/stat() function bindings did not check the return from git_config() and assumed that the config was complete and accessible once "git_dir" was set. In order to fix the test, we simply change the binding code to test the return value from git_config(), to ensure that it actually had config values to read, before determining the requested binding. Signed-off-by: Ramsay Jones <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent b8a9733 commit 452993c

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

compat/cygwin.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,7 @@ static int git_cygwin_config(const char *var, const char *value, void *cb)
114114

115115
static int init_stat(void)
116116
{
117-
if (have_git_dir()) {
118-
git_config(git_cygwin_config, NULL);
117+
if (have_git_dir() && git_config(git_cygwin_config,NULL)) {
119118
if (!core_filemode && native_stat) {
120119
cygwin_stat_fn = cygwin_stat;
121120
cygwin_lstat_fn = cygwin_lstat;

0 commit comments

Comments
 (0)