* [PATCH 1/2] set_ref_status_for_push(): use transport-flags abstraction
@ 2011-12-13 23:26 Junio C Hamano
2011-12-14 10:32 ` Thomas Adam
0 siblings, 1 reply; 2+ messages in thread
From: Junio C Hamano @ 2011-12-13 23:26 UTC (permalink / raw)
To: git
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@pobox.com>
---
* 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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH 1/2] set_ref_status_for_push(): use transport-flags abstraction
2011-12-13 23:26 [PATCH 1/2] set_ref_status_for_push(): use transport-flags abstraction Junio C Hamano
@ 2011-12-14 10:32 ` Thomas Adam
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Adam @ 2011-12-14 10:32 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git
On 13 December 2011 23:26, Junio C Hamano <gitster@pobox.com> wrote:
> 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?
This last bit should read:
"Why do we need two to begin with?"
Kindly,
-- Thomas Adam
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2011-12-14 10:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-12-13 23:26 [PATCH 1/2] set_ref_status_for_push(): use transport-flags abstraction Junio C Hamano
2011-12-14 10:32 ` Thomas Adam
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).