mirror of
https://github.com/git/git.git
synced 2024-11-23 18:05:29 +08:00
submodule: convert push_unpushed_submodules to take a struct refspec
Convert 'push_unpushed_submodules()' to take a 'struct refspec' as a parameter instead of an array of 'const char *'. Signed-off-by: Brandon Williams <bmwill@google.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
afb1aed403
commit
60fba4bf16
19
submodule.c
19
submodule.c
@ -968,7 +968,7 @@ int find_unpushed_submodules(struct oid_array *commits,
|
|||||||
|
|
||||||
static int push_submodule(const char *path,
|
static int push_submodule(const char *path,
|
||||||
const struct remote *remote,
|
const struct remote *remote,
|
||||||
const char **refspec, int refspec_nr,
|
const struct refspec *rs,
|
||||||
const struct string_list *push_options,
|
const struct string_list *push_options,
|
||||||
int dry_run)
|
int dry_run)
|
||||||
{
|
{
|
||||||
@ -991,8 +991,8 @@ static int push_submodule(const char *path,
|
|||||||
if (remote->origin != REMOTE_UNCONFIGURED) {
|
if (remote->origin != REMOTE_UNCONFIGURED) {
|
||||||
int i;
|
int i;
|
||||||
argv_array_push(&cp.args, remote->name);
|
argv_array_push(&cp.args, remote->name);
|
||||||
for (i = 0; i < refspec_nr; i++)
|
for (i = 0; i < rs->raw_nr; i++)
|
||||||
argv_array_push(&cp.args, refspec[i]);
|
argv_array_push(&cp.args, rs->raw[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
prepare_submodule_repo_env(&cp.env_array);
|
prepare_submodule_repo_env(&cp.env_array);
|
||||||
@ -1013,7 +1013,7 @@ static int push_submodule(const char *path,
|
|||||||
*/
|
*/
|
||||||
static void submodule_push_check(const char *path, const char *head,
|
static void submodule_push_check(const char *path, const char *head,
|
||||||
const struct remote *remote,
|
const struct remote *remote,
|
||||||
const char **refspec, int refspec_nr)
|
const struct refspec *rs)
|
||||||
{
|
{
|
||||||
struct child_process cp = CHILD_PROCESS_INIT;
|
struct child_process cp = CHILD_PROCESS_INIT;
|
||||||
int i;
|
int i;
|
||||||
@ -1023,8 +1023,8 @@ static void submodule_push_check(const char *path, const char *head,
|
|||||||
argv_array_push(&cp.args, head);
|
argv_array_push(&cp.args, head);
|
||||||
argv_array_push(&cp.args, remote->name);
|
argv_array_push(&cp.args, remote->name);
|
||||||
|
|
||||||
for (i = 0; i < refspec_nr; i++)
|
for (i = 0; i < rs->raw_nr; i++)
|
||||||
argv_array_push(&cp.args, refspec[i]);
|
argv_array_push(&cp.args, rs->raw[i]);
|
||||||
|
|
||||||
prepare_submodule_repo_env(&cp.env_array);
|
prepare_submodule_repo_env(&cp.env_array);
|
||||||
cp.git_cmd = 1;
|
cp.git_cmd = 1;
|
||||||
@ -1043,7 +1043,7 @@ static void submodule_push_check(const char *path, const char *head,
|
|||||||
|
|
||||||
int push_unpushed_submodules(struct oid_array *commits,
|
int push_unpushed_submodules(struct oid_array *commits,
|
||||||
const struct remote *remote,
|
const struct remote *remote,
|
||||||
const char **refspec, int refspec_nr,
|
const struct refspec *rs,
|
||||||
const struct string_list *push_options,
|
const struct string_list *push_options,
|
||||||
int dry_run)
|
int dry_run)
|
||||||
{
|
{
|
||||||
@ -1069,8 +1069,7 @@ int push_unpushed_submodules(struct oid_array *commits,
|
|||||||
|
|
||||||
for (i = 0; i < needs_pushing.nr; i++)
|
for (i = 0; i < needs_pushing.nr; i++)
|
||||||
submodule_push_check(needs_pushing.items[i].string,
|
submodule_push_check(needs_pushing.items[i].string,
|
||||||
head, remote,
|
head, remote, rs);
|
||||||
refspec, refspec_nr);
|
|
||||||
free(head);
|
free(head);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1078,7 +1077,7 @@ int push_unpushed_submodules(struct oid_array *commits,
|
|||||||
for (i = 0; i < needs_pushing.nr; i++) {
|
for (i = 0; i < needs_pushing.nr; i++) {
|
||||||
const char *path = needs_pushing.items[i].string;
|
const char *path = needs_pushing.items[i].string;
|
||||||
fprintf(stderr, "Pushing submodule '%s'\n", path);
|
fprintf(stderr, "Pushing submodule '%s'\n", path);
|
||||||
if (!push_submodule(path, remote, refspec, refspec_nr,
|
if (!push_submodule(path, remote, rs,
|
||||||
push_options, dry_run)) {
|
push_options, dry_run)) {
|
||||||
fprintf(stderr, "Unable to push submodule '%s'\n", path);
|
fprintf(stderr, "Unable to push submodule '%s'\n", path);
|
||||||
ret = 0;
|
ret = 0;
|
||||||
|
@ -100,9 +100,10 @@ extern int submodule_touches_in_range(struct object_id *a,
|
|||||||
extern int find_unpushed_submodules(struct oid_array *commits,
|
extern int find_unpushed_submodules(struct oid_array *commits,
|
||||||
const char *remotes_name,
|
const char *remotes_name,
|
||||||
struct string_list *needs_pushing);
|
struct string_list *needs_pushing);
|
||||||
|
struct refspec;
|
||||||
extern int push_unpushed_submodules(struct oid_array *commits,
|
extern int push_unpushed_submodules(struct oid_array *commits,
|
||||||
const struct remote *remote,
|
const struct remote *remote,
|
||||||
const char **refspec, int refspec_nr,
|
const struct refspec *rs,
|
||||||
const struct string_list *push_options,
|
const struct string_list *push_options,
|
||||||
int dry_run);
|
int dry_run);
|
||||||
/*
|
/*
|
||||||
|
@ -1157,7 +1157,7 @@ int transport_push(struct transport *transport,
|
|||||||
|
|
||||||
if (!push_unpushed_submodules(&commits,
|
if (!push_unpushed_submodules(&commits,
|
||||||
transport->remote,
|
transport->remote,
|
||||||
rs->raw, rs->raw_nr,
|
rs,
|
||||||
transport->push_options,
|
transport->push_options,
|
||||||
pretend)) {
|
pretend)) {
|
||||||
oid_array_clear(&commits);
|
oid_array_clear(&commits);
|
||||||
|
Loading…
Reference in New Issue
Block a user