summaryrefslogtreecommitdiff
path: root/builtin-send-pack.c
diff options
context:
space:
mode:
authorClemens Buchacher <drizzd@aon.at>2009-05-31 14:26:48 (GMT)
committerJunio C Hamano <gitster@pobox.com>2009-06-02 02:41:24 (GMT)
commit6d2bf96e550731499c73731e5623017d193f837f (patch)
treebccf71ac9e47910a378878be963a2851a432f74d /builtin-send-pack.c
parent6a01554e6350123c78de805d820e90f1c56e5fdc (diff)
downloadgit-6d2bf96e550731499c73731e5623017d193f837f.zip
git-6d2bf96e550731499c73731e5623017d193f837f.tar.gz
git-6d2bf96e550731499c73731e5623017d193f837f.tar.bz2
match_refs: search ref list tail internally
Avoid code duplication by moving list tail search to match_refs(). This does not change the semantics, except for http-push, which now inserts to the front of the ref list in order to get rid of the global remote_tail. Signed-off-by: Clemens Buchacher <drizzd@aon.at> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin-send-pack.c')
-rw-r--r--builtin-send-pack.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/builtin-send-pack.c b/builtin-send-pack.c
index 473a3de..0b3d00b 100644
--- a/builtin-send-pack.c
+++ b/builtin-send-pack.c
@@ -473,7 +473,7 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
int fd[2];
struct child_process *conn;
struct extra_have_objects extra_have;
- struct ref *remote_refs, **remote_tail, *local_refs;
+ struct ref *remote_refs, *local_refs;
int ret;
int send_all = 0;
const char *receivepack = "git-receive-pack";
@@ -567,13 +567,8 @@ int cmd_send_pack(int argc, const char **argv, const char *prefix)
flags |= MATCH_REFS_MIRROR;
/* match them up */
- remote_tail = &remote_refs;
- while (*remote_tail)
- remote_tail = &((*remote_tail)->next);
- if (match_refs(local_refs, remote_refs, &remote_tail,
- nr_refspecs, refspecs, flags)) {
+ if (match_refs(local_refs, &remote_refs, nr_refspecs, refspecs, flags))
return -1;
- }
ret = send_pack(&args, fd, conn, remote_refs, &extra_have);