{"thread":{"id":"26063","subject":"[PATCH 09/14] t1301-*.sh: Fix the 'forced modes' test on cygwin","startedAt":"2010-12-14T18:30:43Z","lastAt":"2010-12-14T18:30:43Z","messageCount":1,"participants":["Ramsay Jones"],"isPatch":true,"patchVersion":1,"patchTotal":14},"messages":[{"id":"158075","messageId":"4D07B7D3.80601@ramsay1.demon.co.uk","threadId":"26063","inReplyTo":null,"subject":"[PATCH 09/14] t1301-*.sh: Fix the 'forced modes' test on cygwin","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsay1.demon.co.uk","sentAt":"2010-12-14T18:30:43Z","receivedAt":"2010-12-14T18:30:43Z","isPatch":true,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\nThe 'forced modes' test fails on cygwin because the post-update\nhook loses it's executable bit when copied from the templates\ndirectory by git-init. The template loses it's executable bit\nbecause the lstat() function resolves to the \"native Win32 API\"\nimplementation.\n\nThis call to lstat() happens after git-init has set the \"git_dir\"\n(so has_git_dir() returns true), but before the configuration has\nbeen fully initialised. At this point git_config() does not find\nany config files to parse and returns 0. Unfortunately, the code\nused to determine the cygwin l/stat() function bindings did not\ncheck the return from git_config() and assumed that the config\nwas complete and accessible once \"git_dir\" was set.\n\nIn order to fix the test, we simply change the binding code to\ntest the return value from git_config(), to ensure that it actually\nhad config values to read, before determining the requested binding.\n\nSigned-off-by: Ramsay Jones <ramsay@ramsay1.demon.co.uk>\n---\n compat/cygwin.c |    3 +--\n 1 files changed, 1 insertions(+), 2 deletions(-)\n\ndiff --git a/compat/cygwin.c b/compat/cygwin.c\nindex b4a51b9..b38dbd7 100644\n--- a/compat/cygwin.c\n+++ b/compat/cygwin.c\n@@ -114,8 +114,7 @@ static int git_cygwin_config(const char *var, const char *value, void *cb)\n \n static int init_stat(void)\n {\n-\tif (have_git_dir()) {\n-\t\tgit_config(git_cygwin_config, NULL);\n+\tif (have_git_dir() && git_config(git_cygwin_config,NULL)) {\n \t\tif (!core_filemode && native_stat) {\n \t\t\tcygwin_stat_fn = cygwin_stat;\n \t\t\tcygwin_lstat_fn = cygwin_lstat;\n-- \n1.7.3\n"}]}