summaryrefslogtreecommitdiff
path: root/src/submodule.c
diff options
context:
space:
mode:
authorDavid Turner <dturner@twosigma.com>2016-11-23 18:26:19 -0500
committerDavid Turner <dturner@twosigma.com>2017-01-20 17:33:56 -0500
commitca05857e71f8d11582b1ad82f63c6a61e96fe20e (patch)
tree28d2ee3269c560a921033e02e1247ae46cc23780 /src/submodule.c
parentdf4dfaadcf709646ebab2e57e3589952cf1ac809 (diff)
downloadlibgit2-ca05857e71f8d11582b1ad82f63c6a61e96fe20e.tar.gz
Fix formatting
Signed-off-by: David Turner <dturner@twosigma.com>
Diffstat (limited to 'src/submodule.c')
-rw-r--r--src/submodule.c142
1 files changed, 71 insertions, 71 deletions
diff --git a/src/submodule.c b/src/submodule.c
index 6d6b314d6..46462f165 100644
--- a/src/submodule.c
+++ b/src/submodule.c
@@ -324,89 +324,89 @@ done:
static int submodules_from_index(git_strmap *map, git_index *idx, git_config *cfg)
{
- int error;
- git_iterator *i;
- const git_index_entry *entry;
- git_buf name = GIT_BUF_INIT;
+ int error;
+ git_iterator *i;
+ const git_index_entry *entry;
+ git_buf name = GIT_BUF_INIT;
- if ((error = git_iterator_for_index(&i, git_index_owner(idx), idx, NULL)) < 0)
- return error;
+ if ((error = git_iterator_for_index(&i, git_index_owner(idx), idx, NULL)) < 0)
+ return error;
- while (!(error = git_iterator_advance(&entry, i))) {
- khiter_t pos = git_strmap_lookup_index(map, entry->path);
- git_submodule *sm;
+ while (!(error = git_iterator_advance(&entry, i))) {
+ khiter_t pos = git_strmap_lookup_index(map, entry->path);
+ git_submodule *sm;
- git_buf_clear(&name);
- if (!name_from_path(&name, cfg, entry->path)) {
- git_strmap_lookup_index(map, name.ptr);
- }
+ git_buf_clear(&name);
+ if (!name_from_path(&name, cfg, entry->path)) {
+ git_strmap_lookup_index(map, name.ptr);
+ }
- if (git_strmap_valid_index(map, pos)) {
- sm = git_strmap_value_at(map, pos);
+ if (git_strmap_valid_index(map, pos)) {
+ sm = git_strmap_value_at(map, pos);
- if (S_ISGITLINK(entry->mode))
- submodule_update_from_index_entry(sm, entry);
- else
- sm->flags |= GIT_SUBMODULE_STATUS__INDEX_NOT_SUBMODULE;
- } else if (S_ISGITLINK(entry->mode)) {
- if (!submodule_get_or_create(&sm, git_index_owner(idx), map, name.ptr ? name.ptr : entry->path)) {
- submodule_update_from_index_entry(sm, entry);
- git_submodule_free(sm);
- }
- }
- }
+ if (S_ISGITLINK(entry->mode))
+ submodule_update_from_index_entry(sm, entry);
+ else
+ sm->flags |= GIT_SUBMODULE_STATUS__INDEX_NOT_SUBMODULE;
+ } else if (S_ISGITLINK(entry->mode)) {
+ if (!submodule_get_or_create(&sm, git_index_owner(idx), map, name.ptr ? name.ptr : entry->path)) {
+ submodule_update_from_index_entry(sm, entry);
+ git_submodule_free(sm);
+ }
+ }
+ }
- if (error == GIT_ITEROVER)
- error = 0;
+ if (error == GIT_ITEROVER)
+ error = 0;
- git_buf_free(&name);
- git_iterator_free(i);
+ git_buf_free(&name);
+ git_iterator_free(i);
- return error;
+ return error;
}
static int submodules_from_head(git_strmap *map, git_tree *head, git_config *cfg)
{
- int error;
- git_iterator *i;
- const git_index_entry *entry;
- git_buf name = GIT_BUF_INIT;
-
- if ((error = git_iterator_for_tree(&i, head, NULL)) < 0)
- return error;
-
- while (!(error = git_iterator_advance(&entry, i))) {
- khiter_t pos = git_strmap_lookup_index(map, entry->path);
- git_submodule *sm;
-
- git_buf_clear(&name);
- if (!name_from_path(&name, cfg, entry->path)) {
- git_strmap_lookup_index(map, name.ptr);
- }
-
- if (git_strmap_valid_index(map, pos)) {
- sm = git_strmap_value_at(map, pos);
-
- if (S_ISGITLINK(entry->mode))
- submodule_update_from_head_data(sm, entry->mode, &entry->id);
- else
- sm->flags |= GIT_SUBMODULE_STATUS__HEAD_NOT_SUBMODULE;
- } else if (S_ISGITLINK(entry->mode)) {
- if (!submodule_get_or_create(&sm, git_tree_owner(head), map, name.ptr ? name.ptr : entry->path)) {
- submodule_update_from_head_data(
- sm, entry->mode, &entry->id);
- git_submodule_free(sm);
- }
- }
- }
-
- if (error == GIT_ITEROVER)
- error = 0;
-
- git_buf_free(&name);
- git_iterator_free(i);
-
- return error;
+ int error;
+ git_iterator *i;
+ const git_index_entry *entry;
+ git_buf name = GIT_BUF_INIT;
+
+ if ((error = git_iterator_for_tree(&i, head, NULL)) < 0)
+ return error;
+
+ while (!(error = git_iterator_advance(&entry, i))) {
+ khiter_t pos = git_strmap_lookup_index(map, entry->path);
+ git_submodule *sm;
+
+ git_buf_clear(&name);
+ if (!name_from_path(&name, cfg, entry->path)) {
+ git_strmap_lookup_index(map, name.ptr);
+ }
+
+ if (git_strmap_valid_index(map, pos)) {
+ sm = git_strmap_value_at(map, pos);
+
+ if (S_ISGITLINK(entry->mode))
+ submodule_update_from_head_data(sm, entry->mode, &entry->id);
+ else
+ sm->flags |= GIT_SUBMODULE_STATUS__HEAD_NOT_SUBMODULE;
+ } else if (S_ISGITLINK(entry->mode)) {
+ if (!submodule_get_or_create(&sm, git_tree_owner(head), map, name.ptr ? name.ptr : entry->path)) {
+ submodule_update_from_head_data(
+ sm, entry->mode, &entry->id);
+ git_submodule_free(sm);
+ }
+ }
+ }
+
+ if (error == GIT_ITEROVER)
+ error = 0;
+
+ git_buf_free(&name);
+ git_iterator_free(i);
+
+ return error;
}
/* If have_sm is true, sm is populated, otherwise map an repo are. */