Commits

Kevin Ballard committed 657ab61

format-patch: Squelch 'fatal: Not a range." error

Don't output an error on `git format-patch --ignore-if-in-upstream HEAD`.
This matches the behavior of `git format-patch HEAD`.

Signed-off-by: Kevin Ballard <kevin@sb.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>

  • Participants
  • Parent commits e07665e

Comments (0)

Files changed (2)

File builtin-log.c

 			return 0;
 	}
 
-	if (ignore_if_in_upstream)
+	if (ignore_if_in_upstream) {
+		/* Don't say anything if head and upstream are the same. */
+		if (rev.pending.nr == 2) {
+			struct object_array_entry *o = rev.pending.objects;
+			if (hashcmp(o[0].item->sha1, o[1].item->sha1) == 0)
+				return 0;
+		}
 		get_patch_ids(&rev, &ids, prefix);
+	}
 
 	if (!use_stdout)
 		realstdout = xfdopen(xdup(1), "w");

File t/t4014-format-patch.sh

 	! grep "Use .--" error
 '
 
+test_expect_success 'format-patch --ignore-if-in-upstream HEAD' '
+	git format-patch --ignore-if-in-upstream HEAD
+'
+
 test_done