summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2007-10-30 18:30:43 (GMT)
committerJunio C Hamano <gitster@pobox.com>2007-10-30 23:21:56 (GMT)
commitb6c9fb5100f8cd4081f1c6df5aea7335a11e9659 (patch)
treea797f4298a3b70d5ca787bdb42fa077959ecea0e
parent562e35c34ced4ca7af024d213737411238dbe0f5 (diff)
downloadgit-b6c9fb5100f8cd4081f1c6df5aea7335a11e9659.zip
git-b6c9fb5100f8cd4081f1c6df5aea7335a11e9659.tar.gz
git-b6c9fb5100f8cd4081f1c6df5aea7335a11e9659.tar.bz2
Prevent send-pack from segfaulting (backport from 'master')
4491e62ae932d5774f628d1bd3be663c11058a73 (Prevent send-pack from segfaulting when a branch doesn't match) is hereby cherry-picked back to 'maint'. If we can't find a source match, and we have no destination, we need to abort the match function early before we try to match the destination against the remote. Signed-off-by: Junio C Hamano <gitster@pobox.com>
-rw-r--r--remote.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/remote.c b/remote.c
index cdbbdcb..9a88917 100644
--- a/remote.c
+++ b/remote.c
@@ -504,8 +504,11 @@ static int match_explicit(struct ref *src, struct ref *dst,
if (!matched_src)
errs = 1;
- if (dst_value == NULL)
+ if (!dst_value) {
+ if (!matched_src)
+ return errs;
dst_value = matched_src->name;
+ }
switch (count_refspec_match(dst_value, dst, &matched_dst)) {
case 1: