Merge branch 'jk/git-dir-lookup' into maint

* jk/git-dir-lookup:
  standardize and improve lookup rules for external local repos
This commit is contained in:
Junio C Hamano
2012-02-21 15:13:16 -08:00
5 changed files with 109 additions and 5 deletions

View File

@ -105,7 +105,7 @@ static const char *argv_submodule[] = {
static char *get_repo_path(const char *repo, int *is_bundle)
{
static char *suffix[] = { "/.git", ".git", "" };
static char *suffix[] = { "/.git", "", ".git/.git", ".git" };
static char *bundle_suffix[] = { ".bundle", "" };
struct stat st;
int i;
@ -115,7 +115,7 @@ static char *get_repo_path(const char *repo, int *is_bundle)
path = mkpath("%s%s", repo, suffix[i]);
if (stat(path, &st))
continue;
if (S_ISDIR(st.st_mode)) {
if (S_ISDIR(st.st_mode) && is_git_directory(path)) {
*is_bundle = 0;
return xstrdup(absolute_path(path));
} else if (S_ISREG(st.st_mode) && st.st_size > 8) {