summaryrefslogtreecommitdiff
path: root/compat/mingw.c
diff options
context:
space:
mode:
authorEric Raible <raible@gmail.com>2008-07-18 07:34:42 (GMT)
committerJunio C Hamano <gitster@pobox.com>2008-07-19 18:17:43 (GMT)
commitfe77b6959c47e1eaec0c96599b2c5ce7907707ec (patch)
treee647949bbae2dc891ce7d500cc3f760228cb5b6d /compat/mingw.c
parent42f7a2dae8dfb858cce4a685e8e8506d77cbd1cb (diff)
downloadgit-fe77b6959c47e1eaec0c96599b2c5ce7907707ec.zip
git-fe77b6959c47e1eaec0c96599b2c5ce7907707ec.tar.gz
git-fe77b6959c47e1eaec0c96599b2c5ce7907707ec.tar.bz2
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>
Diffstat (limited to 'compat/mingw.c')
-rw-r--r--compat/mingw.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/compat/mingw.c b/compat/mingw.c
index c0bc849..772cad5 100644
--- a/compat/mingw.c
+++ b/compat/mingw.c
@@ -536,7 +536,8 @@ static char *lookup_prog(const char *dir, const char *cmd, int isexe, int exe_on
return xstrdup(path);
path[strlen(path)-4] = '\0';
if ((!exe_only || isexe) && access(path, F_OK) == 0)
- return xstrdup(path);
+ if (!(GetFileAttributes(path) & FILE_ATTRIBUTE_DIRECTORY))
+ return xstrdup(path);
return NULL;
}