Commit 277e3041 by Russell Belfer

Fix handling of submodules in trees

parent 1db12b00
...@@ -32,7 +32,7 @@ struct git_treebuilder { ...@@ -32,7 +32,7 @@ struct git_treebuilder {
GIT_INLINE(unsigned int) entry_is_tree(const struct git_tree_entry *e) GIT_INLINE(unsigned int) entry_is_tree(const struct git_tree_entry *e)
{ {
return e->attr & 040000; return (S_ISDIR(e->attr) && !S_ISGITLINK(e->attr));
} }
void git_tree__free(git_tree *tree); void git_tree__free(git_tree *tree);
......
...@@ -29,7 +29,7 @@ void test_status_submodules__cleanup(void) ...@@ -29,7 +29,7 @@ void test_status_submodules__cleanup(void)
} }
static int static int
cb_status__count(const char *p, unsigned int s, void *payload) cb_status__submodule_count(const char *p, unsigned int s, void *payload)
{ {
volatile int *count = (int *)payload; volatile int *count = (int *)payload;
...@@ -50,10 +50,10 @@ void test_status_submodules__0(void) ...@@ -50,10 +50,10 @@ void test_status_submodules__0(void)
cl_assert(git_path_isfile("submodules/.gitmodules")); cl_assert(git_path_isfile("submodules/.gitmodules"));
cl_git_pass( cl_git_pass(
git_status_foreach(g_repo, cb_status__count, &counts) git_status_foreach(g_repo, cb_status__submodule_count, &counts)
); );
cl_assert(counts == 7); cl_assert(counts == 6);
} }
static const char *expected_files[] = { static const char *expected_files[] = {
...@@ -62,17 +62,15 @@ static const char *expected_files[] = { ...@@ -62,17 +62,15 @@ static const char *expected_files[] = {
"deleted", "deleted",
"ignored", "ignored",
"modified", "modified",
"testrepo",
"untracked" "untracked"
}; };
static unsigned int expected_status[] = { static unsigned int expected_status[] = {
GIT_STATUS_INDEX_NEW | GIT_STATUS_WT_MODIFIED, GIT_STATUS_WT_MODIFIED,
GIT_STATUS_INDEX_NEW, GIT_STATUS_INDEX_NEW,
GIT_STATUS_INDEX_DELETED, GIT_STATUS_INDEX_DELETED,
GIT_STATUS_IGNORED, GIT_STATUS_IGNORED,
GIT_STATUS_WT_MODIFIED, GIT_STATUS_WT_MODIFIED,
GIT_STATUS_INDEX_NEW, /* submodule added in index, but not committed */
GIT_STATUS_WT_NEW GIT_STATUS_WT_NEW
}; };
...@@ -100,5 +98,5 @@ void test_status_submodules__1(void) ...@@ -100,5 +98,5 @@ void test_status_submodules__1(void)
git_status_foreach(g_repo, cb_status__match, &index) git_status_foreach(g_repo, cb_status__match, &index)
); );
cl_assert(index == 7); cl_assert(index == 6);
} }
0000000000000000000000000000000000000000 09176a980273d801a3e37cc45c84af1366501ed9 Russell Belfer <arrbee@arrbee.com> 1332365253 -0700 commit (initial): initial commit 0000000000000000000000000000000000000000 09176a980273d801a3e37cc45c84af1366501ed9 Russell Belfer <arrbee@arrbee.com> 1332365253 -0700 commit (initial): initial commit
09176a980273d801a3e37cc45c84af1366501ed9 97896810b3210244a62a82458b8e0819ecfc6850 Russell Belfer <arrbee@arrbee.com> 1332780781 -0700 commit: Setting up gitmodules
0000000000000000000000000000000000000000 09176a980273d801a3e37cc45c84af1366501ed9 Russell Belfer <arrbee@arrbee.com> 1332365253 -0700 commit (initial): initial commit 0000000000000000000000000000000000000000 09176a980273d801a3e37cc45c84af1366501ed9 Russell Belfer <arrbee@arrbee.com> 1332365253 -0700 commit (initial): initial commit
09176a980273d801a3e37cc45c84af1366501ed9 97896810b3210244a62a82458b8e0819ecfc6850 Russell Belfer <arrbee@arrbee.com> 1332780781 -0700 commit: Setting up gitmodules
97896810b3210244a62a82458b8e0819ecfc6850
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment