Skip to content

Commit 93eba05

Browse files
committed
Merge branch 'jc/do-not-feed-tags-to-clear-commit-marks' into maint
"git format-patch --ignore-if-upstream A..B" did not like to be fed tags as boundary commits. * jc/do-not-feed-tags-to-clear-commit-marks: format-patch: do not feed tags to clear_commit_marks()
2 parents 351d06d + 9b7a61d commit 93eba05

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

builtin/log.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -795,17 +795,19 @@ static int reopen_stdout(struct commit *commit, const char *subject,
795795
static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids)
796796
{
797797
struct rev_info check_rev;
798-
struct commit *commit;
798+
struct commit *commit, *c1, *c2;
799799
struct object *o1, *o2;
800800
unsigned flags1, flags2;
801801

802802
if (rev->pending.nr != 2)
803803
die(_("Need exactly one range."));
804804

805805
o1 = rev->pending.objects[0].item;
806-
flags1 = o1->flags;
807806
o2 = rev->pending.objects[1].item;
807+
flags1 = o1->flags;
808808
flags2 = o2->flags;
809+
c1 = lookup_commit_reference(o1->sha1);
810+
c2 = lookup_commit_reference(o2->sha1);
809811

810812
if ((flags1 & UNINTERESTING) == (flags2 & UNINTERESTING))
811813
die(_("Not a range."));
@@ -827,10 +829,8 @@ static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids)
827829
}
828830

829831
/* reset for next revision walk */
830-
clear_commit_marks((struct commit *)o1,
831-
SEEN | UNINTERESTING | SHOWN | ADDED);
832-
clear_commit_marks((struct commit *)o2,
833-
SEEN | UNINTERESTING | SHOWN | ADDED);
832+
clear_commit_marks(c1, SEEN | UNINTERESTING | SHOWN | ADDED);
833+
clear_commit_marks(c2, SEEN | UNINTERESTING | SHOWN | ADDED);
834834
o1->flags = flags1;
835835
o2->flags = flags2;
836836
}

t/t4014-format-patch.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@ test_expect_success "format-patch --ignore-if-in-upstream" '
5757
5858
'
5959

60+
test_expect_success "format-patch --ignore-if-in-upstream handles tags" '
61+
git tag -a v1 -m tag side &&
62+
git tag -a v2 -m tag master &&
63+
git format-patch --stdout --ignore-if-in-upstream v2..v1 >patch1 &&
64+
cnt=$(grep "^From " patch1 | wc -l) &&
65+
test $cnt = 2
66+
'
67+
6068
test_expect_success "format-patch doesn't consider merge commits" '
6169
6270
git checkout -b slave master &&

0 commit comments

Comments
 (0)