git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 2/3] t1301-*.sh: Fix the 'forced modes' test on cygwin
@ 2011-06-16 20:23 Ramsay Jones
  2011-06-16 22:10 ` Junio C Hamano
  2011-06-17  8:12 ` Johannes Sixt
  0 siblings, 2 replies; 7+ messages in thread
From: Ramsay Jones @ 2011-06-16 20:23 UTC (permalink / raw)
  To: Junio C Hamano; +Cc: GIT Mailing-list, Jeff King, Erik Faye-Lund


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 <ramsay@ramsay1.demon.co.uk>
---
 compat/cygwin.c |    3 +--
 1 files changed, 1 insertions(+), 2 deletions(-)

diff --git a/compat/cygwin.c b/compat/cygwin.c
index b4a51b9..b38dbd7 100644
--- a/compat/cygwin.c
+++ b/compat/cygwin.c
@@ -114,8 +114,7 @@ static int git_cygwin_config(const char *var, const char *value, void *cb)
 
 static int init_stat(void)
 {
-	if (have_git_dir()) {
-		git_config(git_cygwin_config, NULL);
+	if (have_git_dir() && git_config(git_cygwin_config,NULL)) {
 		if (!core_filemode && native_stat) {
 			cygwin_stat_fn = cygwin_stat;
 			cygwin_lstat_fn = cygwin_lstat;
-- 
1.7.5

^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2011-06-20 19:32 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-06-16 20:23 [PATCH 2/3] t1301-*.sh: Fix the 'forced modes' test on cygwin Ramsay Jones
2011-06-16 22:10 ` Junio C Hamano
2011-06-17 22:26   ` Ramsay Jones
2011-06-17  8:12 ` Johannes Sixt
2011-06-17 21:27   ` Junio C Hamano
2011-06-18 19:04   ` Ramsay Jones
2011-06-20 19:31     ` Re* " Junio C Hamano

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).