regex: use regexec_buf()
[gitweb.git] / builtin / pull.c
index c7b39b428f7746f0c1925b2d417de91818a8b303..6214af9b10c213046e13b81fb30cea64abc0e619 100644 (file)
@@ -98,6 +98,7 @@ static int opt_force;
 static char *opt_tags;
 static char *opt_prune;
 static char *opt_recurse_submodules;
+static char *max_children;
 static int opt_dry_run;
 static char *opt_keep;
 static char *opt_depth;
@@ -181,6 +182,9 @@ static struct option pull_options[] = {
                N_("on-demand"),
                N_("control recursive fetching of submodules"),
                PARSE_OPT_OPTARG),
+       OPT_PASSTHRU('j', "jobs", &max_children, N_("n"),
+               N_("number of submodules pulled in parallel"),
+               PARSE_OPT_OPTARG),
        OPT_BOOL(0, "dry-run", &opt_dry_run,
                N_("dry run")),
        OPT_PASSTHRU('k', "keep", &opt_keep, NULL,
@@ -381,7 +385,7 @@ static void get_merge_heads(struct sha1_array *merge_heads)
 
        if (!(fp = fopen(filename, "r")))
                die_errno(_("could not open '%s' for reading"), filename);
-       while (strbuf_getline(&sb, fp, '\n') != EOF) {
+       while (strbuf_getline_lf(&sb, fp) != EOF) {
                if (get_sha1_hex(sb.buf, sha1))
                        continue;  /* invalid line: does not start with SHA1 */
                if (starts_with(sb.buf + GIT_SHA1_HEXSZ, "\tnot-for-merge\t"))
@@ -454,13 +458,13 @@ static void NORETURN die_no_merge_candidates(const char *repo, const char **refs
                        fprintf_ln(stderr, _("Please specify which branch you want to merge with."));
                fprintf_ln(stderr, _("See git-pull(1) for details."));
                fprintf(stderr, "\n");
-               fprintf_ln(stderr, "    git pull <remote> <branch>");
+               fprintf_ln(stderr, "    git pull %s %s", _("<remote>"), _("<branch>"));
                fprintf(stderr, "\n");
        } else if (!curr_branch->merge_nr) {
                const char *remote_name = NULL;
 
                if (for_each_remote(get_only_remote, &remote_name) || !remote_name)
-                       remote_name = "<remote>";
+                       remote_name = _("<remote>");
 
                fprintf_ln(stderr, _("There is no tracking information for the current branch."));
                if (opt_rebase)
@@ -469,12 +473,12 @@ static void NORETURN die_no_merge_candidates(const char *repo, const char **refs
                        fprintf_ln(stderr, _("Please specify which branch you want to merge with."));
                fprintf_ln(stderr, _("See git-pull(1) for details."));
                fprintf(stderr, "\n");
-               fprintf_ln(stderr, "    git pull <remote> <branch>");
+               fprintf_ln(stderr, "    git pull %s %s", _("<remote>"), _("<branch>"));
+               fprintf(stderr, "\n");
+               fprintf_ln(stderr, _("If you wish to set tracking information for this branch you can do so with:"));
                fprintf(stderr, "\n");
-               fprintf_ln(stderr, _("If you wish to set tracking information for this branch you can do so with:\n"
-                               "\n"
-                               "    git branch --set-upstream-to=%s/<branch> %s\n"),
-                               remote_name, curr_branch->name);
+               fprintf_ln(stderr, "    git branch --set-upstream-to=%s/%s %s\n",
+                               remote_name, _("<branch>"), curr_branch->name);
        } else
                fprintf_ln(stderr, _("Your configuration specifies to merge with the ref '%s'\n"
                        "from the remote, but no such ref was fetched."),
@@ -528,6 +532,8 @@ static int run_fetch(const char *repo, const char **refspecs)
                argv_array_push(&args, opt_prune);
        if (opt_recurse_submodules)
                argv_array_push(&args, opt_recurse_submodules);
+       if (max_children)
+               argv_array_push(&args, max_children);
        if (opt_dry_run)
                argv_array_push(&args, "--dry-run");
        if (opt_keep)