mirror of
https://git.proxmox.com/git/libgit2
synced 2025-12-31 23:33:16 +00:00
Fix handling of submodules in trees
This commit is contained in:
parent
1db12b0053
commit
277e304149
@ -32,7 +32,7 @@ struct git_treebuilder {
|
||||
|
||||
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);
|
||||
|
||||
@ -29,7 +29,7 @@ void test_status_submodules__cleanup(void)
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
@ -50,10 +50,10 @@ void test_status_submodules__0(void)
|
||||
cl_assert(git_path_isfile("submodules/.gitmodules"));
|
||||
|
||||
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[] = {
|
||||
@ -62,17 +62,15 @@ static const char *expected_files[] = {
|
||||
"deleted",
|
||||
"ignored",
|
||||
"modified",
|
||||
"testrepo",
|
||||
"untracked"
|
||||
};
|
||||
|
||||
static unsigned int expected_status[] = {
|
||||
GIT_STATUS_INDEX_NEW | GIT_STATUS_WT_MODIFIED,
|
||||
GIT_STATUS_WT_MODIFIED,
|
||||
GIT_STATUS_INDEX_NEW,
|
||||
GIT_STATUS_INDEX_DELETED,
|
||||
GIT_STATUS_IGNORED,
|
||||
GIT_STATUS_WT_MODIFIED,
|
||||
GIT_STATUS_INDEX_NEW, /* submodule added in index, but not committed */
|
||||
GIT_STATUS_WT_NEW
|
||||
};
|
||||
|
||||
@ -100,5 +98,5 @@ void test_status_submodules__1(void)
|
||||
git_status_foreach(g_repo, cb_status__match, &index)
|
||||
);
|
||||
|
||||
cl_assert(index == 7);
|
||||
cl_assert(index == 6);
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
tests/resources/submodules/.gitted/refs/heads/master
Normal file
BIN
tests/resources/submodules/.gitted/refs/heads/master
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user