Skip to content

Commit 65b2a72

Browse files
stefanbellergitster
authored andcommitted
builtin/submodule--helper: factor out method to update a single submodule
In a later patch we'll find this method handy. Signed-off-by: Stefan Beller <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 511e8a1 commit 65b2a72

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

builtin/submodule--helper.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,10 +1725,17 @@ static int gitmodules_update_clone_config(const char *var, const char *value,
17251725
return 0;
17261726
}
17271727

1728+
static void update_submodule(struct update_clone_data *ucd)
1729+
{
1730+
fprintf(stdout, "dummy %s %d\t%s\n",
1731+
oid_to_hex(&ucd->oid),
1732+
ucd->just_cloned,
1733+
ucd->sub->path);
1734+
}
1735+
17281736
static int update_submodules(struct submodule_update_clone *suc)
17291737
{
17301738
int i;
1731-
struct strbuf sb = STRBUF_INIT;
17321739

17331740
run_processes_parallel(suc->max_jobs,
17341741
update_clone_get_next_task,
@@ -1747,16 +1754,9 @@ static int update_submodules(struct submodule_update_clone *suc)
17471754
if (suc->quickstop)
17481755
return 1;
17491756

1750-
for (i = 0; i < suc->update_clone_nr; i++) {
1751-
strbuf_addf(&sb, "dummy %s %d\t%s\n",
1752-
oid_to_hex(&suc->update_clone[i].oid),
1753-
suc->update_clone[i].just_cloned,
1754-
suc->update_clone[i].sub->path);
1755-
fprintf(stdout, "%s", sb.buf);
1756-
strbuf_reset(&sb);
1757-
}
1757+
for (i = 0; i < suc->update_clone_nr; i++)
1758+
update_submodule(&suc->update_clone[i]);
17581759

1759-
strbuf_release(&sb);
17601760
return 0;
17611761
}
17621762

0 commit comments

Comments
 (0)