@matheusbsbs / matheus-bagliano / commits / 30affa1e9a
Fork 0

send-pack: do not send out single-level refs such as refs/stash

Since no version of receive-pack accepts these "funny refs", we should mirror the check when considering the list of refs to send. IOW, don't even make them eligible for matching or mirroring. Signed-off-by: Junio C Hamano <gitster@pobox.com>

Jeff King committed Oct 29, 2008 at 05:17 UTC 30affa1e9a15e848f77c9c14544dd6dd593559d5
1 file changed +7 -1
builtin-send-pack.c
+7 -1
@@ -132,7 +132,13 @@ static struct ref *remote_refs, **remote_tail;
132 static int one_local_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data)
133 {
134 struct ref *ref;
135 - int len = strlen(refname) + 1;
135 + int len;
136 +
137 + /* we already know it starts with refs/ to get here */
138 + if (check_ref_format(refname + 5))
139 + return 0;
140 +
141 + len = strlen(refname) + 1;
142 ref = xcalloc(1, sizeof(*ref) + len);
143 hashcpy(ref->new_sha1, sha1);
144 memcpy(ref->name, refname, len);