summaryrefslogtreecommitdiff
path: root/src/path.c
diff options
context:
space:
mode:
authorRussell Belfer <rb@github.com>2013-03-18 17:24:13 -0700
committerRussell Belfer <rb@github.com>2013-03-18 17:24:13 -0700
commit65025cb8934a289460bc64f82c27027c68a85be6 (patch)
tree4b945ad28ff220ffa8500275a5e7a635749e3d11 /src/path.c
parent5b27bf7e5bfd5c2f92a15c0058c801d49faf8403 (diff)
downloadlibgit2-65025cb8934a289460bc64f82c27027c68a85be6.tar.gz
Three submodule status bug fixes
1. Fix sort order problem with submodules where "mod" was sorting after "mod-plus" because they were being sorted as "mod/" and "mod-plus/". This involved pushing the "contains a .git entry" test significantly lower in the stack. 2. Reinstate behavior that a directory which contains a .git entry will be treated as a submodule during iteration even if it is not yet added to the .gitmodules. 3. Now that any directory containing .git is reported as submodule, we have to be more careful checking for GIT_EEXISTS when we do a submodule lookup, because that is the error code that is returned by git_submodule_lookup when you try to look up a directory containing .git that has no record in gitmodules or the index.
Diffstat (limited to 'src/path.c')
-rw-r--r--src/path.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/src/path.c b/src/path.c
index 5767faeed..6437979d5 100644
--- a/src/path.c
+++ b/src/path.c
@@ -877,15 +877,22 @@ int git_path_dirload_with_stat(
if (cmp_len && strncomp(ps->path, end_stat, cmp_len) > 0)
continue;
+ git_buf_truncate(&full, prefix_len);
+
if ((error = git_buf_joinpath(&full, full.ptr, ps->path)) < 0 ||
(error = git_path_lstat(full.ptr, &ps->st)) < 0)
break;
- git_buf_truncate(&full, prefix_len);
-
if (S_ISDIR(ps->st.st_mode)) {
- ps->path[ps->path_len++] = '/';
- ps->path[ps->path_len] = '\0';
+ if ((error = git_buf_joinpath(&full, full.ptr, ".git")) < 0)
+ break;
+
+ if (p_access(full.ptr, F_OK) == 0) {
+ ps->st.st_mode = GIT_FILEMODE_COMMIT;
+ } else {
+ ps->path[ps->path_len++] = '/';
+ ps->path[ps->path_len] = '\0';
+ }
}
}