mirror of
https://git.proxmox.com/git/libgit2
synced 2025-08-07 01:42:27 +00:00
Fix formatting
Signed-off-by: David Turner <dturner@twosigma.com>
This commit is contained in:
parent
df4dfaadcf
commit
ca05857e71
126
src/submodule.c
126
src/submodule.c
@ -324,89 +324,89 @@ done:
|
|||||||
|
|
||||||
static int submodules_from_index(git_strmap *map, git_index *idx, git_config *cfg)
|
static int submodules_from_index(git_strmap *map, git_index *idx, git_config *cfg)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
git_iterator *i;
|
git_iterator *i;
|
||||||
const git_index_entry *entry;
|
const git_index_entry *entry;
|
||||||
git_buf name = GIT_BUF_INIT;
|
git_buf name = GIT_BUF_INIT;
|
||||||
|
|
||||||
if ((error = git_iterator_for_index(&i, git_index_owner(idx), idx, NULL)) < 0)
|
if ((error = git_iterator_for_index(&i, git_index_owner(idx), idx, NULL)) < 0)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
while (!(error = git_iterator_advance(&entry, i))) {
|
while (!(error = git_iterator_advance(&entry, i))) {
|
||||||
khiter_t pos = git_strmap_lookup_index(map, entry->path);
|
khiter_t pos = git_strmap_lookup_index(map, entry->path);
|
||||||
git_submodule *sm;
|
git_submodule *sm;
|
||||||
|
|
||||||
git_buf_clear(&name);
|
git_buf_clear(&name);
|
||||||
if (!name_from_path(&name, cfg, entry->path)) {
|
if (!name_from_path(&name, cfg, entry->path)) {
|
||||||
git_strmap_lookup_index(map, name.ptr);
|
git_strmap_lookup_index(map, name.ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (git_strmap_valid_index(map, pos)) {
|
if (git_strmap_valid_index(map, pos)) {
|
||||||
sm = git_strmap_value_at(map, pos);
|
sm = git_strmap_value_at(map, pos);
|
||||||
|
|
||||||
if (S_ISGITLINK(entry->mode))
|
if (S_ISGITLINK(entry->mode))
|
||||||
submodule_update_from_index_entry(sm, entry);
|
submodule_update_from_index_entry(sm, entry);
|
||||||
else
|
else
|
||||||
sm->flags |= GIT_SUBMODULE_STATUS__INDEX_NOT_SUBMODULE;
|
sm->flags |= GIT_SUBMODULE_STATUS__INDEX_NOT_SUBMODULE;
|
||||||
} else if (S_ISGITLINK(entry->mode)) {
|
} else if (S_ISGITLINK(entry->mode)) {
|
||||||
if (!submodule_get_or_create(&sm, git_index_owner(idx), map, name.ptr ? name.ptr : entry->path)) {
|
if (!submodule_get_or_create(&sm, git_index_owner(idx), map, name.ptr ? name.ptr : entry->path)) {
|
||||||
submodule_update_from_index_entry(sm, entry);
|
submodule_update_from_index_entry(sm, entry);
|
||||||
git_submodule_free(sm);
|
git_submodule_free(sm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error == GIT_ITEROVER)
|
if (error == GIT_ITEROVER)
|
||||||
error = 0;
|
error = 0;
|
||||||
|
|
||||||
git_buf_free(&name);
|
git_buf_free(&name);
|
||||||
git_iterator_free(i);
|
git_iterator_free(i);
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int submodules_from_head(git_strmap *map, git_tree *head, git_config *cfg)
|
static int submodules_from_head(git_strmap *map, git_tree *head, git_config *cfg)
|
||||||
{
|
{
|
||||||
int error;
|
int error;
|
||||||
git_iterator *i;
|
git_iterator *i;
|
||||||
const git_index_entry *entry;
|
const git_index_entry *entry;
|
||||||
git_buf name = GIT_BUF_INIT;
|
git_buf name = GIT_BUF_INIT;
|
||||||
|
|
||||||
if ((error = git_iterator_for_tree(&i, head, NULL)) < 0)
|
if ((error = git_iterator_for_tree(&i, head, NULL)) < 0)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
while (!(error = git_iterator_advance(&entry, i))) {
|
while (!(error = git_iterator_advance(&entry, i))) {
|
||||||
khiter_t pos = git_strmap_lookup_index(map, entry->path);
|
khiter_t pos = git_strmap_lookup_index(map, entry->path);
|
||||||
git_submodule *sm;
|
git_submodule *sm;
|
||||||
|
|
||||||
git_buf_clear(&name);
|
git_buf_clear(&name);
|
||||||
if (!name_from_path(&name, cfg, entry->path)) {
|
if (!name_from_path(&name, cfg, entry->path)) {
|
||||||
git_strmap_lookup_index(map, name.ptr);
|
git_strmap_lookup_index(map, name.ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (git_strmap_valid_index(map, pos)) {
|
if (git_strmap_valid_index(map, pos)) {
|
||||||
sm = git_strmap_value_at(map, pos);
|
sm = git_strmap_value_at(map, pos);
|
||||||
|
|
||||||
if (S_ISGITLINK(entry->mode))
|
if (S_ISGITLINK(entry->mode))
|
||||||
submodule_update_from_head_data(sm, entry->mode, &entry->id);
|
submodule_update_from_head_data(sm, entry->mode, &entry->id);
|
||||||
else
|
else
|
||||||
sm->flags |= GIT_SUBMODULE_STATUS__HEAD_NOT_SUBMODULE;
|
sm->flags |= GIT_SUBMODULE_STATUS__HEAD_NOT_SUBMODULE;
|
||||||
} else if (S_ISGITLINK(entry->mode)) {
|
} else if (S_ISGITLINK(entry->mode)) {
|
||||||
if (!submodule_get_or_create(&sm, git_tree_owner(head), map, name.ptr ? name.ptr : entry->path)) {
|
if (!submodule_get_or_create(&sm, git_tree_owner(head), map, name.ptr ? name.ptr : entry->path)) {
|
||||||
submodule_update_from_head_data(
|
submodule_update_from_head_data(
|
||||||
sm, entry->mode, &entry->id);
|
sm, entry->mode, &entry->id);
|
||||||
git_submodule_free(sm);
|
git_submodule_free(sm);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error == GIT_ITEROVER)
|
if (error == GIT_ITEROVER)
|
||||||
error = 0;
|
error = 0;
|
||||||
|
|
||||||
git_buf_free(&name);
|
git_buf_free(&name);
|
||||||
git_iterator_free(i);
|
git_iterator_free(i);
|
||||||
|
|
||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* If have_sm is true, sm is populated, otherwise map an repo are. */
|
/* If have_sm is true, sm is populated, otherwise map an repo are. */
|
||||||
|
Loading…
Reference in New Issue
Block a user