Skip to content

Commit 87b3c01

Browse files
committed
Merge branch 'maint'
* maint: format-patch: Squelch 'fatal: Not a range." error
2 parents 6a69551 + 657ab61 commit 87b3c01

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

builtin/log.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1157,8 +1157,15 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
11571157
return 0;
11581158
}
11591159

1160-
if (ignore_if_in_upstream)
1160+
if (ignore_if_in_upstream) {
1161+
/* Don't say anything if head and upstream are the same. */
1162+
if (rev.pending.nr == 2) {
1163+
struct object_array_entry *o = rev.pending.objects;
1164+
if (hashcmp(o[0].item->sha1, o[1].item->sha1) == 0)
1165+
return 0;
1166+
}
11611167
get_patch_ids(&rev, &ids, prefix);
1168+
}
11621169

11631170
if (!use_stdout)
11641171
realstdout = xfdopen(xdup(1), "w");

t/t4014-format-patch.sh

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,4 +609,8 @@ test_expect_success 'format-patch -- <path>' '
609609
! grep "Use .--" error
610610
'
611611

612+
test_expect_success 'format-patch --ignore-if-in-upstream HEAD' '
613+
git format-patch --ignore-if-in-upstream HEAD
614+
'
615+
612616
test_done

0 commit comments

Comments
 (0)