]> git.ipfire.org Git - thirdparty/git.git/commit
negative-refspec: fix segfault on : refspec
authorNipunn Koorapati <nipunn@dropbox.com>
Tue, 22 Dec 2020 03:58:16 +0000 (03:58 +0000)
committerJunio C Hamano <gitster@pobox.com>
Tue, 22 Dec 2020 06:49:36 +0000 (22:49 -0800)
commit18f9c9884582c743d8ba04ef5cbbe647947d2578
treef8e7c22b60ad01a84af1deba690c385865291509
parentc0192df6306d4d9ad77f6015a053925b13155834
negative-refspec: fix segfault on : refspec

The logic added to check for negative pathspec match by c0192df630
(refspec: add support for negative refspecs, 2020-09-30) looks at
refspec->src assuming it is never NULL, however when
remote.origin.push is set to ":", then refspec->src is NULL,
causing a segfault within strcmp.

Tell git to handle matching refspec by adding the needle to the
set of positively matched refspecs, since matching ":" refspecs
match anything as src.

Add test for matching refspec pushes fetch-negative-refspec
both individually and in combination with a negative refspec.

Signed-off-by: Nipunn Koorapati <nipunn@dropbox.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
remote.c
t/t5582-fetch-negative-refspec.sh