OSDN Git Service

Merge branch 'sb/submodule-parallel-update'
authorJunio C Hamano <gitster@pobox.com>
Wed, 6 Apr 2016 18:39:01 +0000 (11:39 -0700)
committerJunio C Hamano <gitster@pobox.com>
Wed, 6 Apr 2016 18:39:01 +0000 (11:39 -0700)
A major part of "git submodule update" has been ported to C to take
advantage of the recently added framework to run download tasks in
parallel.

* sb/submodule-parallel-update:
  clone: allow an explicit argument for parallel submodule clones
  submodule update: expose parallelism to the user
  submodule helper: remove double 'fatal: ' prefix
  git submodule update: have a dedicated helper for cloning
  run_processes_parallel: rename parameters for the callbacks
  run_processes_parallel: treat output of children as byte array
  submodule update: direct error message to stderr
  fetching submodules: respect `submodule.fetchJobs` config option
  submodule-config: drop check against NULL
  submodule-config: keep update strategy around

16 files changed:
1  2 
Documentation/config.txt
Documentation/git-clone.txt
builtin/clone.c
builtin/fetch.c
builtin/submodule--helper.c
git-submodule.sh
run-command.c
run-command.h
strbuf.c
strbuf.h
submodule-config.c
submodule-config.h
submodule.c
submodule.h
t/t7400-submodule-basic.sh
t/t7406-submodule-update.sh

Simple merge
Simple merge
diff --cc builtin/clone.c
Simple merge
diff --cc builtin/fetch.c
@@@ -37,8 -37,7 +37,8 @@@ static int prune = -1; /* unspecified *
  static int all, append, dry_run, force, keep, multiple, update_head_ok, verbosity;
  static int progress = -1, recurse_submodules = RECURSE_SUBMODULES_DEFAULT;
  static int tags = TAGS_DEFAULT, unshallow, update_shallow;
- static int max_children = 1;
+ static int max_children = -1;
 +static enum transport_family family;
  static const char *depth;
  static const char *upload_pack;
  static struct strbuf default_rla = STRBUF_INIT;
Simple merge
@@@ -763,24 -740,12 +758,17 @@@ cmd_update(
                        then
                                # Run fetch only if $sha1 isn't present or it
                                # is not reachable from a ref.
 -                              (clear_local_git_env; cd "$sm_path" &&
 -                                      ( (rev=$(git rev-list -n 1 $sha1 --not --all 2>/dev/null) &&
 -                                       test -z "$rev") || git-fetch)) ||
 +                              is_tip_reachable "$sm_path" "$sha1" ||
 +                              fetch_in_submodule "$sm_path" ||
                                die "$(eval_gettext "Unable to fetch in submodule path '\$displaypath'")"
 +
 +                              # Now we tried the usual fetch, but $sha1 may
 +                              # not be reachable from any of the refs
 +                              is_tip_reachable "$sm_path" "$sha1" ||
 +                              fetch_in_submodule "$sm_path" "$sha1" ||
 +                              die "$(eval_gettext "Fetched in submodule path '\$displaypath', but it did not contain $sha1. Direct fetching of that commit failed.")"
                        fi
  
-                       # Is this something we just cloned?
-                       case ";$cloned_modules;" in
-                       *";$name;"*)
-                               # then there is no local change to integrate
-                               update_module=checkout ;;
-                       esac
                        must_die_on_failure=
                        case "$update_module" in
                        checkout)
diff --cc run-command.c
Simple merge
diff --cc run-command.h
Simple merge
diff --cc strbuf.c
Simple merge
diff --cc strbuf.h
+++ b/strbuf.h
@@@ -387,10 -387,15 +387,16 @@@ extern ssize_t strbuf_read_file(struct 
  extern int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint);
  
  /**
 - * Read a line from a FILE *, overwriting the existing contents
 - * of the strbuf. The second argument specifies the line
 - * terminator character, typically `'\n'`.
+  * Write the whole content of the strbuf to the stream not stopping at
+  * NUL bytes.
+  */
+ extern ssize_t strbuf_write(struct strbuf *sb, FILE *stream);
+ /**
 + * Read a line from a FILE *, overwriting the existing contents of
 + * the strbuf.  The strbuf_getline*() family of functions share
 + * this signature, but have different line termination conventions.
 + *
   * Reading stops after the terminator or at EOF.  The terminator
   * is removed from the buffer before returning.  Returns 0 unless
   * there was nothing left before EOF, in which case it returns `EOF`.
Simple merge
Simple merge
diff --cc submodule.c
Simple merge
diff --cc submodule.h
Simple merge
Simple merge
Simple merge