It does not make much sense to have separate "int" parameters to this function with two callsites (why do we need to to begin with? but that is a separate issue) and having to update them every time we need to touch it. Consolidate them into a single "flags" parameter to make it easier to extend later. Signed-off-by: Junio C Hamano <gitster@xxxxxxxxx> --- * A preparatory step for the next one builtin/send-pack.c | 10 ++++++++-- remote.c | 6 ++++-- remote.h | 3 +-- transport.c | 4 +--- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/builtin/send-pack.c b/builtin/send-pack.c index e0b8030..ec107ed 100644 --- a/builtin/send-pack.c +++ b/builtin/send-pack.c @@ -404,6 +404,7 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix) int send_all = 0; const char *receivepack = "git-receive-pack"; int flags; + unsigned transport_flags; int nonfastforward = 0; argv++; @@ -512,8 +513,13 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix) if (match_push_refs(local_refs, &remote_refs, nr_refspecs, refspecs, flags)) return -1; - set_ref_status_for_push(remote_refs, args.send_mirror, - args.force_update); + transport_flags = 0; + if (args.send_mirror) + transport_flags |= TRANSPORT_PUSH_MIRROR; + if (args.force_update) + transport_flags |= TRANSPORT_PUSH_FORCE; + + set_ref_status_for_push(remote_refs, transport_flags); ret = send_pack(&args, fd, conn, remote_refs, &extra_have); diff --git a/remote.c b/remote.c index 6655bb0..95d7f37 100644 --- a/remote.c +++ b/remote.c @@ -7,6 +7,7 @@ #include "dir.h" #include "tag.h" #include "string-list.h" +#include "transport.h" static struct refspec s_tag_refspec = { 0, @@ -1223,10 +1224,11 @@ int match_push_refs(struct ref *src, struct ref **dst, return 0; } -void set_ref_status_for_push(struct ref *remote_refs, int send_mirror, - int force_update) +void set_ref_status_for_push(struct ref *remote_refs, unsigned flags) { struct ref *ref; + int send_mirror = flags & TRANSPORT_PUSH_MIRROR; + int force_update = flags & TRANSPORT_PUSH_FORCE; for (ref = remote_refs; ref; ref = ref->next) { if (ref->peer_ref) diff --git a/remote.h b/remote.h index b395598..0cf3c07 100644 --- a/remote.h +++ b/remote.h @@ -98,8 +98,7 @@ char *apply_refspecs(struct refspec *refspecs, int nr_refspec, int match_push_refs(struct ref *src, struct ref **dst, int nr_refspec, const char **refspec, int all); -void set_ref_status_for_push(struct ref *remote_refs, int send_mirror, - int force_update); +void set_ref_status_for_push(struct ref *remote_refs, unsigned flags); /* * Given a list of the remote refs and the specification of things to diff --git a/transport.c b/transport.c index 51814b5..95556da 100644 --- a/transport.c +++ b/transport.c @@ -1031,9 +1031,7 @@ int transport_push(struct transport *transport, return -1; } - set_ref_status_for_push(remote_refs, - flags & TRANSPORT_PUSH_MIRROR, - flags & TRANSPORT_PUSH_FORCE); + set_ref_status_for_push(remote_refs, flags); if ((flags & TRANSPORT_RECURSE_SUBMODULES_CHECK) && !is_bare_repository()) { struct ref *ref = remote_refs; -- 1.7.8.249.gb1b73 -- To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html