Teach lookup_prog not to select directories
Without this simple fix "git gui" in the git source directory finds the git-gui directory instead of the tcl script in /usr/bin. Signed-off-by: Eric Raible <raible@gmail.com> Signed-off-by: Johannes Sixt <johannes.sixt@telecom.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Eric Raible committed
Jul 18, 2008 at 09:34 UTC
fe77b6959c47e1eaec0c96599b2c5ce7907707ec
1 file changed
+2
-1
compat/mingw.c
+2
-1
@@ -536,7 +536,8 @@ static char *lookup_prog(const char *dir, const char *cmd, int isexe, int exe_on
536
return xstrdup(path);
537
path[strlen(path)-4] = '\0';
538
if ((!exe_only || isexe) && access(path, F_OK) == 0)
539
- return xstrdup(path);
539
+ if (!(GetFileAttributes(path) & FILE_ATTRIBUTE_DIRECTORY))
540
+ return xstrdup(path);
541
return NULL;
542
}
543