git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Stefan Beller <sbeller@google.com>
To: git@vger.kernel.org
Cc: Stefan Beller <sbeller@google.com>
Subject: [PATCH 5/6] builtin/submodule--helper: factor out method to update a single submodule
Date: Thu, 12 Jul 2018 12:47:53 -0700	[thread overview]
Message-ID: <20180712194754.71979-6-sbeller@google.com> (raw)
In-Reply-To: <20180712194754.71979-1-sbeller@google.com>

In a later patch we'll find this method handy.

Signed-off-by: Stefan Beller <sbeller@google.com>
---
 builtin/submodule--helper.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/builtin/submodule--helper.c b/builtin/submodule--helper.c
index c9c3fe2bf28..4bbf580df79 100644
--- a/builtin/submodule--helper.c
+++ b/builtin/submodule--helper.c
@@ -1725,10 +1725,17 @@ static int gitmodules_update_clone_config(const char *var, const char *value,
 	return 0;
 }
 
+static void update_submodule(struct submodule_update_clone_information *suci)
+{
+	fprintf(stdout, "dummy %s %d\t%s\n",
+		oid_to_hex(&suci->oid),
+		suci->just_cloned,
+		suci->sub->path);
+}
+
 static int update_submodules(struct submodule_update_clone *suc)
 {
 	int i;
-	struct strbuf sb = STRBUF_INIT;
 
 	run_processes_parallel(suc->max_jobs,
 			       update_clone_get_next_task,
@@ -1747,16 +1754,9 @@ static int update_submodules(struct submodule_update_clone *suc)
 	if (suc->quickstop)
 		return 1;
 
-	for (i = 0; i < suc->submodule_lines_nr; i++) {
-		strbuf_addf(&sb, "dummy %s %d\t%s\n",
-			oid_to_hex(&suc->submodule_lines[i].oid),
-			suc->submodule_lines[i].just_cloned,
-			suc->submodule_lines[i].sub->path);
-		fprintf(stdout, "%s", sb.buf);
-		strbuf_reset(&sb);
-	}
+	for (i = 0; i < suc->submodule_lines_nr; i++)
+		update_submodule(&suc->submodule_lines[i]);
 
-	strbuf_release(&sb);
 	return 0;
 }
 
-- 
2.18.0.203.gfac676dfb9-goog


  parent reply	other threads:[~2018-07-12 19:48 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-12 19:47 [PATCH 0/6] git-submodule.sh: convert part of cmd_update to C Stefan Beller
2018-07-12 19:47 ` [PATCH 1/6] git-submodule.sh: align error reporting for update mode to use path Stefan Beller
2018-07-12 21:12   ` Junio C Hamano
2018-07-12 19:47 ` [PATCH 2/6] git-submodule.sh: rename unused variables Stefan Beller
2018-07-12 21:24   ` Junio C Hamano
2018-07-12 19:47 ` [PATCH 3/6] builtin/submodule--helper: factor out submodule updating Stefan Beller
2018-07-12 19:47 ` [PATCH 4/6] builtin/submodule--helper: store update_clone information in a struct Stefan Beller
2018-07-16 19:37   ` Junio C Hamano
2018-07-16 23:55     ` Stefan Beller
2018-07-12 19:47 ` Stefan Beller [this message]
2018-07-12 19:47 ` [PATCH 6/6] submodule--helper: introduce new update-module-mode helper Stefan Beller
2018-07-18 15:00   ` Derrick Stolee
2018-07-18 19:41     ` Stefan Beller
  -- strict thread matches above, loose matches on Subject: below --
2018-07-18 19:48 [PATCH 0/6] Resend of origin/sb/submodule-update-in-c Stefan Beller
2018-07-18 19:48 ` [PATCH 5/6] builtin/submodule--helper: factor out method to update a single submodule Stefan Beller

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=20180712194754.71979-6-sbeller@google.com \
    --to=sbeller@google.com \
    --cc=git@vger.kernel.org \
    /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).