Skip to content

Commit 8748f3c

Browse files
committed
Merge branch 'mz/cherry-code-cleanup'
Minor code clean-up on the cherry-pick codepath. * mz/cherry-code-cleanup: cherry: remove redundant check for merge commit cherry: don't set ignored rev_info options remove unnecessary parameter from get_patch_ids()
2 parents 31e0100 + 51f4de3 commit 8748f3c

File tree

1 file changed

+6
-16
lines changed

1 file changed

+6
-16
lines changed

builtin/log.c

Lines changed: 6 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -696,7 +696,7 @@ static int reopen_stdout(struct commit *commit, const char *subject,
696696
return 0;
697697
}
698698

699-
static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids, const char *prefix)
699+
static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids)
700700
{
701701
struct rev_info check_rev;
702702
struct commit *commit;
@@ -717,7 +717,8 @@ static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids, const cha
717717
init_patch_ids(ids);
718718

719719
/* given a range a..b get all patch ids for b..a */
720-
init_revisions(&check_rev, prefix);
720+
init_revisions(&check_rev, rev->prefix);
721+
check_rev.max_parents = 1;
721722
o1->flags ^= UNINTERESTING;
722723
o2->flags ^= UNINTERESTING;
723724
add_pending_object(&check_rev, o1, "o1");
@@ -726,10 +727,6 @@ static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids, const cha
726727
die(_("revision walk setup failed"));
727728

728729
while ((commit = get_revision(&check_rev)) != NULL) {
729-
/* ignore merges */
730-
if (commit->parents && commit->parents->next)
731-
continue;
732-
733730
add_commit_patch_id(commit, ids);
734731
}
735732

@@ -1306,7 +1303,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
13061303
if (hashcmp(o[0].item->sha1, o[1].item->sha1) == 0)
13071304
return 0;
13081305
}
1309-
get_patch_ids(&rev, &ids, prefix);
1306+
get_patch_ids(&rev, &ids);
13101307
}
13111308

13121309
if (!use_stdout)
@@ -1508,10 +1505,7 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)
15081505
}
15091506

15101507
init_revisions(&revs, prefix);
1511-
revs.diff = 1;
1512-
revs.combine_merges = 0;
1513-
revs.ignore_merges = 1;
1514-
DIFF_OPT_SET(&revs.diffopt, RECURSIVE);
1508+
revs.max_parents = 1;
15151509

15161510
if (add_pending_commit(head, &revs, 0))
15171511
die(_("Unknown commit %s"), head);
@@ -1525,7 +1519,7 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)
15251519
return 0;
15261520
}
15271521

1528-
get_patch_ids(&revs, &ids, prefix);
1522+
get_patch_ids(&revs, &ids);
15291523

15301524
if (limit && add_pending_commit(limit, &revs, UNINTERESTING))
15311525
die(_("Unknown commit %s"), limit);
@@ -1534,10 +1528,6 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)
15341528
if (prepare_revision_walk(&revs))
15351529
die(_("revision walk setup failed"));
15361530
while ((commit = get_revision(&revs)) != NULL) {
1537-
/* ignore merges */
1538-
if (commit->parents && commit->parents->next)
1539-
continue;
1540-
15411531
commit_list_insert(commit, &list);
15421532
}
15431533

0 commit comments

Comments
 (0)