mirror of
https://github.com/git/git
synced 2024-10-02 14:45:21 +00:00
submodule--helper: reorganize code for sh to C conversion
Introduce a function, update_submodule2(), that will implement the functionality of run-update-procedure and its surrounding shell code in submodule.sh. This name is temporary; it will replace update_submodule() when the sh to C conversion is complete. Signed-off-by: Glen Choo <chooglen@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
f7bdb32918
commit
1a0b78c953
|
@ -2452,6 +2452,16 @@ static int do_run_update_procedure(struct update_data *ud)
|
|||
return run_update_command(ud, subforce);
|
||||
}
|
||||
|
||||
/*
|
||||
* NEEDSWORK: As we convert "git submodule update" to C,
|
||||
* update_submodule2() will invoke more and more functions, making it
|
||||
* difficult to preserve the function ordering without forward
|
||||
* declarations.
|
||||
*
|
||||
* When the conversion is complete, this forward declaration will be
|
||||
* unnecessary and should be removed.
|
||||
*/
|
||||
static int update_submodule2(struct update_data *update_data);
|
||||
static void update_submodule(struct update_clone_data *ucd)
|
||||
{
|
||||
fprintf(stdout, "dummy %s %d\t%s\n",
|
||||
|
@ -2618,11 +2628,7 @@ static int run_update_procedure(int argc, const char **argv, const char *prefix)
|
|||
&update_data.update_strategy);
|
||||
|
||||
free(prefixed_path);
|
||||
|
||||
if (!oideq(&update_data.oid, &update_data.suboid) || update_data.force)
|
||||
return do_run_update_procedure(&update_data);
|
||||
|
||||
return 3;
|
||||
return update_submodule2(&update_data);
|
||||
}
|
||||
|
||||
static int resolve_relative_path(int argc, const char **argv, const char *prefix)
|
||||
|
@ -3022,6 +3028,16 @@ static int module_create_branch(int argc, const char **argv, const char *prefix)
|
|||
force, reflog, quiet, track, dry_run);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* NEEDSWORK: this is a temporary name until we delete update_submodule() */
|
||||
static int update_submodule2(struct update_data *update_data)
|
||||
{
|
||||
if (!oideq(&update_data->oid, &update_data->suboid) || update_data->force)
|
||||
return do_run_update_procedure(update_data);
|
||||
|
||||
return 3;
|
||||
}
|
||||
|
||||
struct add_data {
|
||||
const char *prefix;
|
||||
const char *branch;
|
||||
|
|
Loading…
Reference in a new issue