From 6c41e97557d94df7085e3c0cff247305c9401968 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Mon, 27 Feb 2012 16:11:53 +0100 Subject: branch: don't assume the merge filter ref exists MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit print_ref_list looks up the merge_filter_ref and assumes that a valid pointer is returned. When the object doesn't exist, it tries to dereference a NULL pointer. This can be the case when git branch --merged is given an argument that isn't a valid commit name. Check whether the lookup returns a NULL pointer and die with an error if it does. Add a test, while we're at it. Signed-off-by: Carlos Martín Nieto Signed-off-by: Junio C Hamano --- t/t3200-branch.sh | 4 ++++ 1 file changed, 4 insertions(+) (limited to 't/t3200-branch.sh') diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh index 76903323af..6ad1763fda 100755 --- a/t/t3200-branch.sh +++ b/t/t3200-branch.sh @@ -620,4 +620,8 @@ test_expect_success 'use set-upstream on the current branch' ' ' +test_expect_success '--merged catches invalid object names' ' + test_must_fail git branch --merged 0000000000000000000000000000000000000000 +' + test_done -- cgit v1.2.3