From: Stefan Beller <sbeller@google.com>
To: gitster@pobox.com
Cc: git@vger.kernel.org, Stefan Beller <sbeller@google.com>
Subject: [PATCHv7 0/8] fetch submodules in parallel
Date: Mon, 12 Oct 2015 11:47:13 -0700 [thread overview]
Message-ID: <1444675641-14866-1-git-send-email-sbeller@google.com> (raw)
fixing two smaller nits noticed by Ramsay
* make struct parallel_processes static
* omit the forward declaration of get_next_submodule by reordering.
Jonathan Nieder (1):
submodule.c: write "Fetching submodule <foo>" to stderr
Stefan Beller (7):
xread: poll on non blocking fds
xread_nonblock: add functionality to read from fds without blocking
strbuf: add strbuf_read_once to read without blocking
sigchain: add command to pop all common signals
run-command: add an asynchronous parallel child processor
fetch_populated_submodules: use new parallel job processing
submodules: allow parallel fetching, add tests and documentation
Documentation/fetch-options.txt | 7 +
builtin/fetch.c | 6 +-
builtin/pull.c | 6 +
git-compat-util.h | 1 +
run-command.c | 350 ++++++++++++++++++++++++++++++++++++++++
run-command.h | 78 +++++++++
sigchain.c | 9 ++
sigchain.h | 1 +
strbuf.c | 11 ++
strbuf.h | 9 ++
submodule.c | 144 ++++++++++++-----
submodule.h | 2 +-
t/t0061-run-command.sh | 20 +++
t/t5526-fetch-submodules.sh | 70 +++++---
test-run-command.c | 25 +++
wrapper.c | 35 +++-
16 files changed, 701 insertions(+), 73 deletions(-)
$ git diff origin/sb/submodule-parallel-fetch
diff --git a/run-command.c b/run-command.c
index 28048a7..ef3da27 100644
--- a/run-command.c
+++ b/run-command.c
@@ -855,7 +855,7 @@ int capture_command(struct child_process *cmd, struct strbuf *buf, size_t hint)
return finish_command(cmd);
}
-struct parallel_processes {
+static struct parallel_processes {
void *data;
int max_processes;
diff --git a/submodule.c b/submodule.c
index cf8bf5d..c21b265 100644
--- a/submodule.c
+++ b/submodule.c
@@ -628,68 +628,6 @@ struct submodule_parallel_fetch {
#define SPF_INIT {0, ARGV_ARRAY_INIT, NULL, NULL, 0, 0, 0}
static int get_next_submodule(void **task_cb, struct child_process *cp,
- struct strbuf *err, void *data);
-
-static int fetch_start_failure(struct child_process *cp,
- struct strbuf *err,
- void *cb, void *task_cb)
-{
- struct submodule_parallel_fetch *spf = cb;
-
- spf->result = 1;
-
- return 0;
-}
-
-static int fetch_finish(int retvalue, struct child_process *cp,
- struct strbuf *err, void *cb, void *task_cb)
-{
- struct submodule_parallel_fetch *spf = cb;
-
- if (retvalue)
- spf->result = 1;
-
- return 0;
-}
-
-int fetch_populated_submodules(const struct argv_array *options,
- const char *prefix, int command_line_option,
- int quiet, int max_parallel_jobs)
-{
- int i;
- struct submodule_parallel_fetch spf = SPF_INIT;
-
- spf.work_tree = get_git_work_tree();
- spf.command_line_option = command_line_option;
- spf.quiet = quiet;
- spf.prefix = prefix;
-
- if (!spf.work_tree)
- goto out;
-
- if (read_cache() < 0)
- die("index file corrupt");
-
- argv_array_push(&spf.args, "fetch");
- for (i = 0; i < options->argc; i++)
- argv_array_push(&spf.args, options->argv[i]);
- argv_array_push(&spf.args, "--recurse-submodules-default");
- /* default value, "--submodule-prefix" and its value are added later */
-
- calculate_changed_submodule_paths();
- run_processes_parallel(max_parallel_jobs,
- get_next_submodule,
- fetch_start_failure,
- fetch_finish,
- &spf);
-
- argv_array_clear(&spf.args);
-out:
- string_list_clear(&changed_submodule_paths, 1);
- return spf.result;
-}
-
-static int get_next_submodule(void **task_cb, struct child_process *cp,
struct strbuf *err, void *data)
{
int ret = 0;
@@ -775,6 +713,65 @@ static int get_next_submodule(void **task_cb, struct child_process *cp,
return 0;
}
+static int fetch_start_failure(struct child_process *cp,
+ struct strbuf *err,
+ void *cb, void *task_cb)
+{
+ struct submodule_parallel_fetch *spf = cb;
+
+ spf->result = 1;
+
+ return 0;
+}
+
+static int fetch_finish(int retvalue, struct child_process *cp,
+ struct strbuf *err, void *cb, void *task_cb)
+{
+ struct submodule_parallel_fetch *spf = cb;
+
+ if (retvalue)
+ spf->result = 1;
+
+ return 0;
+}
+
+int fetch_populated_submodules(const struct argv_array *options,
+ const char *prefix, int command_line_option,
+ int quiet, int max_parallel_jobs)
+{
+ int i;
+ struct submodule_parallel_fetch spf = SPF_INIT;
+
+ spf.work_tree = get_git_work_tree();
+ spf.command_line_option = command_line_option;
+ spf.quiet = quiet;
+ spf.prefix = prefix;
+
+ if (!spf.work_tree)
+ goto out;
+
+ if (read_cache() < 0)
+ die("index file corrupt");
+
+ argv_array_push(&spf.args, "fetch");
+ for (i = 0; i < options->argc; i++)
+ argv_array_push(&spf.args, options->argv[i]);
+ argv_array_push(&spf.args, "--recurse-submodules-default");
+ /* default value, "--submodule-prefix" and its value are added later */
+
+ calculate_changed_submodule_paths();
+ run_processes_parallel(max_parallel_jobs,
+ get_next_submodule,
+ fetch_start_failure,
+ fetch_finish,
+ &spf);
+
+ argv_array_clear(&spf.args);
+out:
+ string_list_clear(&changed_submodule_paths, 1);
+ return spf.result;
+}
+
unsigned is_submodule_modified(const char *path, int ignore_untracked)
{
ssize_t len;
--
2.5.0.268.g453a26a
next reply other threads:[~2015-10-12 18:48 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-10-12 18:47 Stefan Beller [this message]
2015-10-12 18:47 ` [PATCHv7 1/8] submodule.c: write "Fetching submodule <foo>" to stderr Stefan Beller
2015-10-12 18:47 ` [PATCHv7 2/8] xread: poll on non blocking fds Stefan Beller
2015-10-12 18:47 ` [PATCHv7 3/8] xread_nonblock: add functionality to read from fds without blocking Stefan Beller
2015-10-12 18:47 ` [PATCHv7 4/8] strbuf: add strbuf_read_once to read " Stefan Beller
2015-10-12 18:47 ` [PATCHv7 5/8] sigchain: add command to pop all common signals Stefan Beller
2015-10-12 18:47 ` [PATCHv7 6/8] run-command: add an asynchronous parallel child processor Stefan Beller
2015-10-12 18:47 ` [PATCHv7 7/8] fetch_populated_submodules: use new parallel job processing Stefan Beller
2015-10-12 18:47 ` [PATCHv7 8/8] submodules: allow parallel fetching, add tests and documentation Stefan Beller
2015-10-12 19:32 ` [PATCHv7 0/8] fetch submodules in parallel Junio C Hamano
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1444675641-14866-1-git-send-email-sbeller@google.com \
--to=sbeller@google.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).