Merge branch 'bw/push-options-recursively-to-submodules'
authorJunio C Hamano <gitster@pobox.com>
Thu, 20 Apr 2017 04:37:14 +0000 (21:37 -0700)
committerJunio C Hamano <gitster@pobox.com>
Thu, 20 Apr 2017 04:37:14 +0000 (21:37 -0700)
"git push --recurse-submodules --push-option=<string>" learned to
propagate the push option recursively down to pushes in submodules.

* bw/push-options-recursively-to-submodules:
push: propagate remote and refspec with --recurse-submodules
submodule--helper: add push-check subcommand
remote: expose parse_push_refspec function
push: propagate push-options with --recurse-submodules
push: unmark a local variable as static

1  2 
remote.c
remote.h
submodule.c
submodule.h
transport.c
diff --combined remote.c
index af72727d760d37e511ba662148029c5d0eb52259,d335a64173b2b19f4ccd25a2613488c59b413aa6..801137c72ebb2edf196811a8031db603c61f376d
+++ b/remote.c
@@@ -630,7 -630,7 +630,7 @@@ struct refspec *parse_fetch_refspec(in
        return parse_refspec_internal(nr_refspec, refspec, 1, 0);
  }
  
- static struct refspec *parse_push_refspec(int nr_refspec, const char **refspec)
+ struct refspec *parse_push_refspec(int nr_refspec, const char **refspec)
  {
        return parse_refspec_internal(nr_refspec, refspec, 0, 0);
  }
@@@ -2279,7 -2279,7 +2279,7 @@@ static struct push_cas *add_cas_entry(s
        return entry;
  }
  
 -int parse_push_cas_option(struct push_cas_option *cas, const char *arg, int unset)
 +static int parse_push_cas_option(struct push_cas_option *cas, const char *arg, int unset)
  {
        const char *colon;
        struct push_cas *entry;
diff --combined remote.h
index 949badc4eea89f32f6839233d658e457721b43af,42c8f017b7d51204d95e73dd8a7374d87606ab96..6c28cd3e4bfe2e8be058485d0b963b23622b999f
+++ b/remote.h
@@@ -149,11 -149,11 +149,11 @@@ int check_ref_type(const struct ref *re
   */
  void free_refs(struct ref *ref);
  
 -struct sha1_array;
 +struct oid_array;
  extern struct ref **get_remote_heads(int in, char *src_buf, size_t src_len,
                                     struct ref **list, unsigned int flags,
 -                                   struct sha1_array *extra_have,
 -                                   struct sha1_array *shallow);
 +                                   struct oid_array *extra_have,
 +                                   struct oid_array *shallow);
  
  int resolve_remote_symref(struct ref *ref, struct ref *list);
  int ref_newer(const struct object_id *new_oid, const struct object_id *old_oid);
@@@ -169,6 -169,7 +169,7 @@@ struct ref *ref_remove_duplicates(struc
  
  int valid_fetch_refspec(const char *refspec);
  struct refspec *parse_fetch_refspec(int nr_refspec, const char **refspec);
+ extern struct refspec *parse_push_refspec(int nr_refspec, const char **refspec);
  
  void free_refspec(int nr_refspec, struct refspec *refspec);
  
@@@ -290,6 -291,7 +291,6 @@@ struct push_cas_option 
  };
  
  extern int parseopt_push_cas_option(const struct option *, const char *arg, int unset);
 -extern int parse_push_cas_option(struct push_cas_option *, const char *arg, int unset);
  
  extern int is_empty_cas(const struct push_cas_option *);
  void apply_push_cas(struct push_cas_option *, struct remote *, struct ref *);
diff --combined submodule.c
index 6368d5fa6afe001d38a63908a5a62cfe498ceaea,49ab132d059448e21b29d445ef342022e0389395..cdbecfbeaf8c16af192845c95477985e659bcd20
@@@ -14,6 -14,7 +14,7 @@@
  #include "blob.h"
  #include "thread-utils.h"
  #include "quote.h"
+ #include "remote.h"
  #include "worktree.h"
  
  static int config_fetch_recurse_submodules = RECURSE_SUBMODULES_ON_DEMAND;
@@@ -21,8 -22,8 +22,8 @@@ static int config_update_recurse_submod
  static int parallel_jobs = 1;
  static struct string_list changed_submodule_paths = STRING_LIST_INIT_NODUP;
  static int initialized_fetch_ref_tips;
 -static struct sha1_array ref_tips_before_fetch;
 -static struct sha1_array ref_tips_after_fetch;
 +static struct oid_array ref_tips_before_fetch;
 +static struct oid_array ref_tips_after_fetch;
  
  /*
   * The following flag is set if the .gitmodules file is unmerged. We then
@@@ -576,7 -577,6 +577,7 @@@ void show_submodule_inline_diff(FILE *f
        if (!(dirty_submodule & DIRTY_SUBMODULE_MODIFIED))
                argv_array_push(&cp.args, oid_to_hex(new));
  
 +      prepare_submodule_repo_env(&cp.env_array);
        if (run_command(&cp))
                fprintf(f, "(diff failed)\n");
  
@@@ -622,35 -622,35 +623,35 @@@ static int has_remote(const char *refna
        return 1;
  }
  
 -static int append_sha1_to_argv(const unsigned char sha1[20], void *data)
 +static int append_oid_to_argv(const struct object_id *oid, void *data)
  {
        struct argv_array *argv = data;
 -      argv_array_push(argv, sha1_to_hex(sha1));
 +      argv_array_push(argv, oid_to_hex(oid));
        return 0;
  }
  
 -static int check_has_commit(const unsigned char sha1[20], void *data)
 +static int check_has_commit(const struct object_id *oid, void *data)
  {
        int *has_commit = data;
  
 -      if (!lookup_commit_reference(sha1))
 +      if (!lookup_commit_reference(oid->hash))
                *has_commit = 0;
  
        return 0;
  }
  
 -static int submodule_has_commits(const char *path, struct sha1_array *commits)
 +static int submodule_has_commits(const char *path, struct oid_array *commits)
  {
        int has_commit = 1;
  
        if (add_submodule_odb(path))
                return 0;
  
 -      sha1_array_for_each_unique(commits, check_has_commit, &has_commit);
 +      oid_array_for_each_unique(commits, check_has_commit, &has_commit);
        return has_commit;
  }
  
 -static int submodule_needs_pushing(const char *path, struct sha1_array *commits)
 +static int submodule_needs_pushing(const char *path, struct oid_array *commits)
  {
        if (!submodule_has_commits(path, commits))
                /*
                int needs_pushing = 0;
  
                argv_array_push(&cp.args, "rev-list");
 -              sha1_array_for_each_unique(commits, append_sha1_to_argv, &cp.args);
 +              oid_array_for_each_unique(commits, append_oid_to_argv, &cp.args);
                argv_array_pushl(&cp.args, "--not", "--remotes", "-n", "1" , NULL);
  
                prepare_submodule_repo_env(&cp.env_array);
        return 0;
  }
  
 -static struct sha1_array *submodule_commits(struct string_list *submodules,
 +static struct oid_array *submodule_commits(struct string_list *submodules,
                                            const char *path)
  {
        struct string_list_item *item;
  
        item = string_list_insert(submodules, path);
        if (item->util)
 -              return (struct sha1_array *) item->util;
 +              return (struct oid_array *) item->util;
  
 -      /* NEEDSWORK: should we have sha1_array_init()? */
 -      item->util = xcalloc(1, sizeof(struct sha1_array));
 -      return (struct sha1_array *) item->util;
 +      /* NEEDSWORK: should we have oid_array_init()? */
 +      item->util = xcalloc(1, sizeof(struct oid_array));
 +      return (struct oid_array *) item->util;
  }
  
  static void collect_submodules_from_diff(struct diff_queue_struct *q,
  
        for (i = 0; i < q->nr; i++) {
                struct diff_filepair *p = q->queue[i];
 -              struct sha1_array *commits;
 +              struct oid_array *commits;
                if (!S_ISGITLINK(p->two->mode))
                        continue;
                commits = submodule_commits(submodules, p->two->path);
 -              sha1_array_append(commits, p->two->oid.hash);
 +              oid_array_append(commits, &p->two->oid);
        }
  }
  
@@@ -741,11 -741,11 +742,11 @@@ static void free_submodules_sha1s(struc
  {
        struct string_list_item *item;
        for_each_string_list_item(item, submodules)
 -              sha1_array_clear((struct sha1_array *) item->util);
 +              oid_array_clear((struct oid_array *) item->util);
        string_list_clear(submodules, 1);
  }
  
 -int find_unpushed_submodules(struct sha1_array *commits,
 +int find_unpushed_submodules(struct oid_array *commits,
                const char *remotes_name, struct string_list *needs_pushing)
  {
        struct rev_info rev;
  
        /* argv.argv[0] will be ignored by setup_revisions */
        argv_array_push(&argv, "find_unpushed_submodules");
 -      sha1_array_for_each_unique(commits, append_sha1_to_argv, &argv);
 +      oid_array_for_each_unique(commits, append_oid_to_argv, &argv);
        argv_array_push(&argv, "--not");
        argv_array_pushf(&argv, "--remotes=%s", remotes_name);
  
        argv_array_clear(&argv);
  
        for_each_string_list_item(submodule, &submodules) {
 -              struct sha1_array *commits = (struct sha1_array *) submodule->util;
 +              struct oid_array *commits = (struct oid_array *) submodule->util;
  
                if (submodule_needs_pushing(submodule->string, commits))
                        string_list_insert(needs_pushing, submodule->string);
        return needs_pushing->nr;
  }
  
- static int push_submodule(const char *path, int dry_run)
+ static int push_submodule(const char *path,
+                         const struct remote *remote,
+                         const char **refspec, int refspec_nr,
+                         const struct string_list *push_options,
+                         int dry_run)
  {
        if (add_submodule_odb(path))
                return 1;
                if (dry_run)
                        argv_array_push(&cp.args, "--dry-run");
  
+               if (push_options && push_options->nr) {
+                       const struct string_list_item *item;
+                       for_each_string_list_item(item, push_options)
+                               argv_array_pushf(&cp.args, "--push-option=%s",
+                                                item->string);
+               }
+               if (remote->origin != REMOTE_UNCONFIGURED) {
+                       int i;
+                       argv_array_push(&cp.args, remote->name);
+                       for (i = 0; i < refspec_nr; i++)
+                               argv_array_push(&cp.args, refspec[i]);
+               }
                prepare_submodule_repo_env(&cp.env_array);
                cp.git_cmd = 1;
                cp.no_stdin = 1;
        return 1;
  }
  
 -int push_unpushed_submodules(struct sha1_array *commits,
+ /*
+  * Perform a check in the submodule to see if the remote and refspec work.
+  * Die if the submodule can't be pushed.
+  */
+ static void submodule_push_check(const char *path, const struct remote *remote,
+                                const char **refspec, int refspec_nr)
+ {
+       struct child_process cp = CHILD_PROCESS_INIT;
+       int i;
+       argv_array_push(&cp.args, "submodule--helper");
+       argv_array_push(&cp.args, "push-check");
+       argv_array_push(&cp.args, remote->name);
+       for (i = 0; i < refspec_nr; i++)
+               argv_array_push(&cp.args, refspec[i]);
+       prepare_submodule_repo_env(&cp.env_array);
+       cp.git_cmd = 1;
+       cp.no_stdin = 1;
+       cp.no_stdout = 1;
+       cp.dir = path;
+       /*
+        * Simply indicate if 'submodule--helper push-check' failed.
+        * More detailed error information will be provided by the
+        * child process.
+        */
+       if (run_command(&cp))
+               die("process for submodule '%s' failed", path);
+ }
-                            const char *remotes_name,
 +int push_unpushed_submodules(struct oid_array *commits,
+                            const struct remote *remote,
+                            const char **refspec, int refspec_nr,
+                            const struct string_list *push_options,
                             int dry_run)
  {
        int i, ret = 1;
        struct string_list needs_pushing = STRING_LIST_INIT_DUP;
  
-       if (!find_unpushed_submodules(commits, remotes_name, &needs_pushing))
+       if (!find_unpushed_submodules(commits, remote->name, &needs_pushing))
                return 1;
  
+       /*
+        * Verify that the remote and refspec can be propagated to all
+        * submodules.  This check can be skipped if the remote and refspec
+        * won't be propagated due to the remote being unconfigured (e.g. a URL
+        * instead of a remote name).
+        */
+       if (remote->origin != REMOTE_UNCONFIGURED)
+               for (i = 0; i < needs_pushing.nr; i++)
+                       submodule_push_check(needs_pushing.items[i].string,
+                                            remote, refspec, refspec_nr);
+       /* Actually push the submodules */
        for (i = 0; i < needs_pushing.nr; i++) {
                const char *path = needs_pushing.items[i].string;
                fprintf(stderr, "Pushing submodule '%s'\n", path);
-               if (!push_submodule(path, dry_run)) {
+               if (!push_submodule(path, remote, refspec, refspec_nr,
+                                   push_options, dry_run)) {
                        fprintf(stderr, "Unable to push submodule '%s'\n", path);
                        ret = 0;
                }
@@@ -888,23 -953,23 +954,23 @@@ static void submodule_collect_changed_c
  static int add_sha1_to_array(const char *ref, const struct object_id *oid,
                             int flags, void *data)
  {
 -      sha1_array_append(data, oid->hash);
 +      oid_array_append(data, oid);
        return 0;
  }
  
 -void check_for_new_submodule_commits(unsigned char new_sha1[20])
 +void check_for_new_submodule_commits(struct object_id *oid)
  {
        if (!initialized_fetch_ref_tips) {
                for_each_ref(add_sha1_to_array, &ref_tips_before_fetch);
                initialized_fetch_ref_tips = 1;
        }
  
 -      sha1_array_append(&ref_tips_after_fetch, new_sha1);
 +      oid_array_append(&ref_tips_after_fetch, oid);
  }
  
 -static int add_sha1_to_argv(const unsigned char sha1[20], void *data)
 +static int add_oid_to_argv(const struct object_id *oid, void *data)
  {
 -      argv_array_push(data, sha1_to_hex(sha1));
 +      argv_array_push(data, oid_to_hex(oid));
        return 0;
  }
  
@@@ -920,11 -985,11 +986,11 @@@ static void calculate_changed_submodule
  
        init_revisions(&rev, NULL);
        argv_array_push(&argv, "--"); /* argv[0] program name */
 -      sha1_array_for_each_unique(&ref_tips_after_fetch,
 -                                 add_sha1_to_argv, &argv);
 +      oid_array_for_each_unique(&ref_tips_after_fetch,
 +                                 add_oid_to_argv, &argv);
        argv_array_push(&argv, "--not");
 -      sha1_array_for_each_unique(&ref_tips_before_fetch,
 -                                 add_sha1_to_argv, &argv);
 +      oid_array_for_each_unique(&ref_tips_before_fetch,
 +                                 add_oid_to_argv, &argv);
        setup_revisions(argv.argc, argv.argv, &rev, NULL);
        if (prepare_revision_walk(&rev))
                die("revision walk setup failed");
        }
  
        argv_array_clear(&argv);
 -      sha1_array_clear(&ref_tips_before_fetch);
 -      sha1_array_clear(&ref_tips_after_fetch);
 +      oid_array_clear(&ref_tips_before_fetch);
 +      oid_array_clear(&ref_tips_after_fetch);
        initialized_fetch_ref_tips = 0;
  }
  
  
  unsigned is_submodule_modified(const char *path, int ignore_untracked)
  {
 -      ssize_t len;
        struct child_process cp = CHILD_PROCESS_INIT;
 -      const char *argv[] = {
 -              "status",
 -              "--porcelain",
 -              NULL,
 -              NULL,
 -      };
        struct strbuf buf = STRBUF_INIT;
 +      FILE *fp;
        unsigned dirty_submodule = 0;
 -      const char *line, *next_line;
        const char *git_dir;
 +      int ignore_cp_exit_code = 0;
  
        strbuf_addf(&buf, "%s/.git", path);
        git_dir = read_gitfile(buf.buf);
        if (!git_dir)
                git_dir = buf.buf;
 -      if (!is_directory(git_dir)) {
 +      if (!is_git_directory(git_dir)) {
 +              if (is_directory(git_dir))
 +                      die(_("'%s' not recognized as a git repository"), git_dir);
                strbuf_release(&buf);
                /* The submodule is not checked out, so it is not modified */
                return 0;
 -
        }
        strbuf_reset(&buf);
  
 +      argv_array_pushl(&cp.args, "status", "--porcelain=2", NULL);
        if (ignore_untracked)
 -              argv[2] = "-uno";
 +              argv_array_push(&cp.args, "-uno");
  
 -      cp.argv = argv;
        prepare_submodule_repo_env(&cp.env_array);
        cp.git_cmd = 1;
        cp.no_stdin = 1;
        cp.out = -1;
        cp.dir = path;
        if (start_command(&cp))
 -              die("Could not run 'git status --porcelain' in submodule %s", path);
 +              die("Could not run 'git status --porcelain=2' in submodule %s", path);
  
 -      len = strbuf_read(&buf, cp.out, 1024);
 -      line = buf.buf;
 -      while (len > 2) {
 -              if ((line[0] == '?') && (line[1] == '?')) {
 +      fp = xfdopen(cp.out, "r");
 +      while (strbuf_getwholeline(&buf, fp, '\n') != EOF) {
 +              /* regular untracked files */
 +              if (buf.buf[0] == '?')
                        dirty_submodule |= DIRTY_SUBMODULE_UNTRACKED;
 -                      if (dirty_submodule & DIRTY_SUBMODULE_MODIFIED)
 -                              break;
 -              } else {
 -                      dirty_submodule |= DIRTY_SUBMODULE_MODIFIED;
 -                      if (ignore_untracked ||
 -                          (dirty_submodule & DIRTY_SUBMODULE_UNTRACKED))
 -                              break;
 +
 +              if (buf.buf[0] == 'u' ||
 +                  buf.buf[0] == '1' ||
 +                  buf.buf[0] == '2') {
 +                      /* T = line type, XY = status, SSSS = submodule state */
 +                      if (buf.len < strlen("T XY SSSS"))
 +                              die("BUG: invalid status --porcelain=2 line %s",
 +                                  buf.buf);
 +
 +                      if (buf.buf[5] == 'S' && buf.buf[8] == 'U')
 +                              /* nested untracked file */
 +                              dirty_submodule |= DIRTY_SUBMODULE_UNTRACKED;
 +
 +                      if (buf.buf[0] == 'u' ||
 +                          buf.buf[0] == '2' ||
 +                          memcmp(buf.buf + 5, "S..U", 4))
 +                              /* other change */
 +                              dirty_submodule |= DIRTY_SUBMODULE_MODIFIED;
                }
 -              next_line = strchr(line, '\n');
 -              if (!next_line)
 +
 +              if ((dirty_submodule & DIRTY_SUBMODULE_MODIFIED) &&
 +                  ((dirty_submodule & DIRTY_SUBMODULE_UNTRACKED) ||
 +                   ignore_untracked)) {
 +                      /*
 +                       * We're not interested in any further information from
 +                       * the child any more, neither output nor its exit code.
 +                       */
 +                      ignore_cp_exit_code = 1;
                        break;
 -              next_line++;
 -              len -= (next_line - line);
 -              line = next_line;
 +              }
        }
 -      close(cp.out);
 +      fclose(fp);
  
 -      if (finish_command(&cp))
 -              die("'git status --porcelain' failed in submodule %s", path);
 +      if (finish_command(&cp) && !ignore_cp_exit_code)
 +              die("'git status --porcelain=2' failed in submodule %s", path);
  
        strbuf_release(&buf);
        return dirty_submodule;
@@@ -1448,7 -1502,7 +1514,7 @@@ static int find_first_merges(struct obj
        memset(&rev_opts, 0, sizeof(rev_opts));
  
        /* get all revisions that merge commit a */
 -      snprintf(merged_revision, sizeof(merged_revision), "^%s",
 +      xsnprintf(merged_revision, sizeof(merged_revision), "^%s",
                        oid_to_hex(&a->object.oid));
        init_revisions(&revs, NULL);
        rev_opts.submodule = path;
diff --combined submodule.h
index a86f757a06720e1bc85d7e9ecad51ffbc6610dbe,127ff9be84399cb67734560fc901f4226ccc73b3..486371d2c34a9397d9f075f052cbae774ad662e7
@@@ -3,7 -3,8 +3,8 @@@
  
  struct diff_options;
  struct argv_array;
 -struct sha1_array;
 +struct oid_array;
+ struct remote;
  
  enum {
        RECURSE_SUBMODULES_ONLY = -5,
@@@ -72,7 -73,7 +73,7 @@@ extern int should_update_submodules(voi
   * and it should be updated. Returns NULL otherwise.
   */
  extern const struct submodule *submodule_from_ce(const struct cache_entry *ce);
 -extern void check_for_new_submodule_commits(unsigned char new_sha1[20]);
 +extern void check_for_new_submodule_commits(struct object_id *oid);
  extern int fetch_populated_submodules(const struct argv_array *options,
                               const char *prefix, int command_line_option,
                               int quiet, int max_parallel_jobs);
@@@ -87,11 -88,13 +88,13 @@@ extern int merge_submodule(unsigned cha
                           const unsigned char base[20],
                           const unsigned char a[20],
                           const unsigned char b[20], int search);
 -extern int find_unpushed_submodules(struct sha1_array *commits,
 +extern int find_unpushed_submodules(struct oid_array *commits,
                                    const char *remotes_name,
                                    struct string_list *needs_pushing);
 -extern int push_unpushed_submodules(struct sha1_array *commits,
 +extern int push_unpushed_submodules(struct oid_array *commits,
-                                   const char *remotes_name,
+                                   const struct remote *remote,
+                                   const char **refspec, int refspec_nr,
+                                   const struct string_list *push_options,
                                    int dry_run);
  extern void connect_work_tree_and_git_dir(const char *work_tree, const char *git_dir);
  extern int parallel_submodules(void);
diff --combined transport.c
index c83f3b71bebffee19daa88cfba76aa8d16938b2f,a62e5118c0575e50b93e9b659287e215369b22f9..4d33138a7525310af3f9f73b699360f159516ad1
@@@ -116,8 -116,8 +116,8 @@@ struct git_transport_data 
        struct child_process *conn;
        int fd[2];
        unsigned got_remote_heads : 1;
 -      struct sha1_array extra_have;
 -      struct sha1_array shallow;
 +      struct oid_array extra_have;
 +      struct oid_array shallow;
  };
  
  static int set_git_option(struct git_transport_options *opts,
@@@ -447,7 -447,7 +447,7 @@@ static int print_one_push_status(struc
  
  static int measure_abbrev(const struct object_id *oid, int sofar)
  {
 -      char hex[GIT_SHA1_HEXSZ + 1];
 +      char hex[GIT_MAX_HEXSZ + 1];
        int w = find_unique_abbrev_r(hex, oid->hash, DEFAULT_ABBREV);
  
        return (w < sofar) ? sofar : w;
@@@ -1023,20 -1023,21 +1023,22 @@@ int transport_push(struct transport *tr
                              TRANSPORT_RECURSE_SUBMODULES_ONLY)) &&
                    !is_bare_repository()) {
                        struct ref *ref = remote_refs;
 -                      struct sha1_array commits = SHA1_ARRAY_INIT;
 +                      struct oid_array commits = OID_ARRAY_INIT;
  
                        for (; ref; ref = ref->next)
                                if (!is_null_oid(&ref->new_oid))
 -                                      sha1_array_append(&commits, ref->new_oid.hash);
 +                                      oid_array_append(&commits,
 +                                                        &ref->new_oid);
  
                        if (!push_unpushed_submodules(&commits,
-                                                     transport->remote->name,
+                                                     transport->remote,
+                                                     refspec, refspec_nr,
+                                                     transport->push_options,
                                                      pretend)) {
 -                              sha1_array_clear(&commits);
 +                              oid_array_clear(&commits);
                                die("Failed to push all needed submodules!");
                        }
 -                      sha1_array_clear(&commits);
 +                      oid_array_clear(&commits);
                }
  
                if (((flags & TRANSPORT_RECURSE_SUBMODULES_CHECK) ||
                      !pretend)) && !is_bare_repository()) {
                        struct ref *ref = remote_refs;
                        struct string_list needs_pushing = STRING_LIST_INIT_DUP;
 -                      struct sha1_array commits = SHA1_ARRAY_INIT;
 +                      struct oid_array commits = OID_ARRAY_INIT;
  
                        for (; ref; ref = ref->next)
                                if (!is_null_oid(&ref->new_oid))
 -                                      sha1_array_append(&commits, ref->new_oid.hash);
 +                                      oid_array_append(&commits,
 +                                                        &ref->new_oid);
  
                        if (find_unpushed_submodules(&commits, transport->remote->name,
                                                &needs_pushing)) {
 -                              sha1_array_clear(&commits);
 +                              oid_array_clear(&commits);
                                die_with_unpushed_submodules(&needs_pushing);
                        }
                        string_list_clear(&needs_pushing, 0);
 -                      sha1_array_clear(&commits);
 +                      oid_array_clear(&commits);
                }
  
                if (!(flags & TRANSPORT_RECURSE_SUBMODULES_ONLY))