diff options
author | Jiang Xin <worldhello.net@gmail.com> | 2012-02-28 12:23:26 +0800 |
---|---|---|
committer | Jiang Xin <worldhello.net@gmail.com> | 2012-02-28 12:23:26 +0800 |
commit | 508d1244dc8d38188c70e98207efa8a97d16b47c (patch) | |
tree | fc8688b80be453755f8135df11bf1db2d247725a /path.c | |
parent | 0ad9e96d2e2f42f4d2ce7cd612bf741913242bc0 (diff) | |
parent | 25a7850a106ed0f27b88b8ce0b89fd326120dff4 (diff) | |
download | git-508d1244dc8d38188c70e98207efa8a97d16b47c.tar.gz git-508d1244dc8d38188c70e98207efa8a97d16b47c.tar.xz |
Merge branch 'master' into git-po
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; } |