Code

Convert commit_tree() to take strbuf as message
[git.git] / path.c
diff --git a/path.c b/path.c
index 01028f282630169c6e2e2a148ddfd017e851b38f..b6f71d1086981dc41bdbbc8954eccd9e9b719f98 100644 (file)
--- a/path.c
+++ b/path.c
@@ -295,6 +295,7 @@ const char *enter_repo(const char *path, int strict)
                static const char *suffix[] = {
                        ".git/.git", "/.git", ".git", "", NULL,
                };
+               const char *gitfile;
                int len = strlen(path);
                int i;
                while ((1 < len) && (path[len-1] == '/'))
@@ -329,7 +330,12 @@ const char *enter_repo(const char *path, int strict)
                                break;
                        }
                }
-               if (!suffix[i] || chdir(used_path))
+               if (!suffix[i])
+                       return NULL;
+               gitfile = read_gitfile(used_path) ;
+               if (gitfile)
+                       strcpy(used_path, gitfile);
+               if (chdir(used_path))
                        return NULL;
                path = validated_path;
        }