author | Junio C Hamano <gitster@pobox.com> | |
Mon, 5 Mar 2012 06:17:52 +0000 (22:17 -0800) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 5 Mar 2012 06:17:52 +0000 (22:17 -0800) |
* cn/maint-branch-with-bad:
branch: don't assume the merge filter ref exists
Conflicts:
t/t3200-branch.sh
branch: don't assume the merge filter ref exists
Conflicts:
t/t3200-branch.sh
builtin/branch.c | patch | blob | history | |
t/t3200-branch.sh | patch | blob | history |
diff --git a/builtin/branch.c b/builtin/branch.c
index cb17bc367571a88b6e6bcac5020c1746c4385480..d8cccf725d3fab24ad585a26629373fc987bb3f8 100644 (file)
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -530,6 +530,10 @@ static int print_ref_list(int kinds, int detached, int verbose, int abbrev, stru
if (merge_filter != NO_FILTER) {
struct commit *filter;
filter = lookup_commit_reference_gently(merge_filter_ref, 0);
+ if (!filter)
+ die("object '%s' does not point to a commit",
+ sha1_to_hex(merge_filter_ref));
+
filter->object.flags |= UNINTERESTING;
add_pending_object(&ref_list.revs,
(struct object *) filter, "");
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index dd1acebd88070b75bbbfd07048b5a255aa00e0f3..9fe1d8feab419e1a8065b2ea5881f991edc68855 100755 (executable)
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
)
'
+test_expect_success '--merged catches invalid object names' '
+ test_must_fail git branch --merged 0000000000000000000000000000000000000000
+'
+
test_done