Skip to content

Commit c94d9dc

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 f1d1571 commit c94d9dc

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
@@ -1727,10 +1727,17 @@ static int git_update_clone_config(const char *var, const char *value,
17271727
return 0;
17281728
}
17291729

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

17351742
run_processes_parallel(suc->max_jobs,
17361743
update_clone_get_next_task,
@@ -1749,16 +1756,9 @@ static int update_submodules(struct submodule_update_clone *suc)
17491756
if (suc->quickstop)
17501757
return 1;
17511758

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

1761-
strbuf_release(&sb);
17621762
return 0;
17631763
}
17641764

0 commit comments

Comments
 (0)