Skip to content

Commit

Permalink
Merge branch 'jc/do-not-feed-tags-to-clear-commit-marks' into maint
Browse files Browse the repository at this point in the history
"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()
  • Loading branch information
Junio C Hamano committed Jul 15, 2015
2 parents 351d06d + 9b7a61d commit 93eba05
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
12 changes: 6 additions & 6 deletions builtin/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -795,17 +795,19 @@ static int reopen_stdout(struct commit *commit, const char *subject,
static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids)
{
struct rev_info check_rev;
struct commit *commit;
struct commit *commit, *c1, *c2;
struct object *o1, *o2;
unsigned flags1, flags2;

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

o1 = rev->pending.objects[0].item;
flags1 = o1->flags;
o2 = rev->pending.objects[1].item;
flags1 = o1->flags;
flags2 = o2->flags;
c1 = lookup_commit_reference(o1->sha1);
c2 = lookup_commit_reference(o2->sha1);

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

/* reset for next revision walk */
clear_commit_marks((struct commit *)o1,
SEEN | UNINTERESTING | SHOWN | ADDED);
clear_commit_marks((struct commit *)o2,
SEEN | UNINTERESTING | SHOWN | ADDED);
clear_commit_marks(c1, SEEN | UNINTERESTING | SHOWN | ADDED);
clear_commit_marks(c2, SEEN | UNINTERESTING | SHOWN | ADDED);
o1->flags = flags1;
o2->flags = flags2;
}
Expand Down
8 changes: 8 additions & 0 deletions t/t4014-format-patch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,14 @@ test_expect_success "format-patch --ignore-if-in-upstream" '
'

test_expect_success "format-patch --ignore-if-in-upstream handles tags" '
git tag -a v1 -m tag side &&
git tag -a v2 -m tag master &&
git format-patch --stdout --ignore-if-in-upstream v2..v1 >patch1 &&
cnt=$(grep "^From " patch1 | wc -l) &&
test $cnt = 2
'

test_expect_success "format-patch doesn't consider merge commits" '
git checkout -b slave master &&
Expand Down

0 comments on commit 93eba05

Please sign in to comment.