1. Stefan Saasen
  2. git

Commits

Junio C Hamano  committed 57f75f3 Merge with conflicts

Merge branch 'cn/maint-branch-with-bad' into maint

* cn/maint-branch-with-bad:
branch: don't assume the merge filter ref exists

Conflicts:
t/t3200-branch.sh

  • Participants
  • Parent commits 3ecd0c8, 6c41e97
  • Branches master

Comments (0)

Files changed (2)

File builtin/branch.c

View file
 	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, "");

File t/t3200-branch.sh

View file
 	)
 '
 
+test_expect_success '--merged catches invalid object names' '
+	test_must_fail git branch --merged 0000000000000000000000000000000000000000
+'
+
 test_done