diff options
author | Junio C Hamano <gitster@pobox.com> | 2012-02-21 15:13:16 -0800 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2012-02-21 15:13:16 -0800 |
commit | 0cfba96121b9617668a7b4ad18e3ae3a19dc8755 (patch) | |
tree | 4c148d3a45c5af2e105b92c8cb2e497052f4c877 /path.c | |
parent | a67c23544888761e940452f7533953b3c368456f (diff) | |
parent | b3256eb8b35937192e85725d0c2bcb422295790c (diff) | |
download | git-0cfba96121b9617668a7b4ad18e3ae3a19dc8755.tar.gz git-0cfba96121b9617668a7b4ad18e3ae3a19dc8755.tar.xz |
Merge branch 'jk/git-dir-lookup' into maint
* jk/git-dir-lookup:
standardize and improve lookup rules for external local repos
Diffstat (limited to 'path.c')
-rw-r--r-- | path.c | 7 |
1 files changed, 5 insertions, 2 deletions
@@ -293,7 +293,7 @@ const char *enter_repo(const char *path, int strict) if (!strict) { static const char *suffix[] = { - ".git/.git", "/.git", ".git", "", NULL, + "/.git", "", ".git/.git", ".git", NULL, }; const char *gitfile; int len = strlen(path); @@ -324,8 +324,11 @@ const char *enter_repo(const char *path, int strict) return NULL; len = strlen(used_path); for (i = 0; suffix[i]; i++) { + struct stat st; strcpy(used_path + len, suffix[i]); - if (!access(used_path, F_OK)) { + if (!stat(used_path, &st) && + (S_ISREG(st.st_mode) || + (S_ISDIR(st.st_mode) && is_git_directory(used_path)))) { strcat(validated_path, suffix[i]); break; } |