Skip to content

Commit 30affa1

Browse files
peffgitster
authored andcommitted
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>
1 parent 1442171 commit 30affa1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

builtin-send-pack.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,13 @@ static struct ref *remote_refs, **remote_tail;
132132
static int one_local_ref(const char *refname, const unsigned char *sha1, int flag, void *cb_data)
133133
{
134134
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;
136142
ref = xcalloc(1, sizeof(*ref) + len);
137143
hashcpy(ref->new_sha1, sha1);
138144
memcpy(ref->name, refname, len);

0 commit comments

Comments
 (0)