From: Junio C Hamano Date: Wed, 6 Apr 2016 18:39:01 +0000 (-0700) Subject: Merge branch 'sb/submodule-parallel-update' X-Git-Tag: v2.9.0-rc0~159 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=bdebbeb3346e9867005947aff356b99a7358e5ab;p=thirdparty%2Fgit.git Merge branch 'sb/submodule-parallel-update' 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 --- bdebbeb3346e9867005947aff356b99a7358e5ab diff --cc builtin/fetch.c index e4639d8eb1,5aa1c2de44..f8455bde7a --- a/builtin/fetch.c +++ b/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; diff --cc git-submodule.sh index 43c68deee9,86018ee9c5..0322282120 --- a/git-submodule.sh +++ b/git-submodule.sh @@@ -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 strbuf.h index f72fd14c2e,d4f2aa1365..7987405313 --- a/strbuf.h +++ b/strbuf.h @@@ -386,11 -386,16 +386,17 @@@ extern ssize_t strbuf_read_file(struct */ extern int strbuf_readlink(struct strbuf *sb, const char *path, size_t hint); + /** + * 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 second argument specifies the line - * terminator character, typically `'\n'`. + * 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`.