Merge branch 'jt/submodule-fetch-errmsg'
authorJunio C Hamano <gitster@pobox.com>
Tue, 9 Apr 2019 17:14:26 +0000 (02:14 +0900)
committerJunio C Hamano <gitster@pobox.com>
Tue, 9 Apr 2019 17:14:26 +0000 (02:14 +0900)
Error message update.

* jt/submodule-fetch-errmsg:
  submodule: explain first attempt failure clearly

1  2 
git-submodule.sh
submodule.c

diff --combined git-submodule.sh
@@@ -5,8 -5,7 +5,8 @@@
  # Copyright (c) 2007 Lars Hjemli
  
  dashless=$(basename "$0" | sed -e 's/-/ /')
 -USAGE="[--quiet] add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--] <repository> [<path>]
 +USAGE="[--quiet] [--cached]
 +   or: $dashless [--quiet] add [-b <branch>] [-f|--force] [--name <name>] [--reference <repository>] [--] <repository> [<path>]
     or: $dashless [--quiet] status [--cached] [--recursive] [--] [<path>...]
     or: $dashless [--quiet] init [--] [<path>...]
     or: $dashless [--quiet] deinit [-f|--force] (--all| [--] <path>...)
@@@ -594,7 -593,7 +594,7 @@@ cmd_update(
                                # is not reachable from a ref.
                                is_tip_reachable "$sm_path" "$sha1" ||
                                fetch_in_submodule "$sm_path" $depth ||
-                               say "$(eval_gettext "Unable to fetch in submodule path '\$displaypath'")"
+                               say "$(eval_gettext "Unable to fetch in submodule path '\$displaypath'; trying to directly fetch \$sha1:")"
  
                                # Now we tried the usual fetch, but $sha1 may
                                # not be reachable from any of the refs
diff --combined submodule.c
@@@ -432,10 -432,6 +432,10 @@@ void handle_ignore_submodules_arg(struc
                diffopt->flags.ignore_dirty_submodules = 1;
        else if (strcmp(arg, "none"))
                die("bad --ignore-submodules argument: %s", arg);
 +      /*
 +       * Please update _git_status() in git-completion.bash when you
 +       * add new options
 +       */
  }
  
  static int prepare_submodule_summary(struct rev_info *rev, const char *path,
@@@ -1548,6 -1544,13 +1548,13 @@@ static int fetch_finish(int retvalue, s
        struct oid_array *commits;
  
        if (retvalue)
+               /*
+                * NEEDSWORK: This indicates that the overall fetch
+                * failed, even though there may be a subsequent fetch
+                * by commit hash that might work. It may be a good
+                * idea to not indicate failure in this case, and only
+                * indicate failure if the subsequent fetch fails.
+                */
                spf->result = 1;
  
        if (!task || !task->sub)
@@@ -1613,12 -1616,11 +1620,12 @@@ int fetch_populated_submodules(struct r
  
        calculate_changed_submodule_paths(r, &spf.changed_submodule_names);
        string_list_sort(&spf.changed_submodule_names);
 -      run_processes_parallel(max_parallel_jobs,
 -                             get_next_submodule,
 -                             fetch_start_failure,
 -                             fetch_finish,
 -                             &spf);
 +      run_processes_parallel_tr2(max_parallel_jobs,
 +                                 get_next_submodule,
 +                                 fetch_start_failure,
 +                                 fetch_finish,
 +                                 &spf,
 +                                 "submodule", "parallel/fetch");
  
        argv_array_clear(&spf.args);
  out: