Skip to content

Commit

Permalink
Merge branch 'mz/cherry-code-cleanup'
Browse files Browse the repository at this point in the history
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()
  • Loading branch information
Junio C Hamano committed Aug 29, 2012
2 parents 31e0100 + 51f4de3 commit 8748f3c
Showing 1 changed file with 6 additions and 16 deletions.
22 changes: 6 additions & 16 deletions builtin/log.c
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ static int reopen_stdout(struct commit *commit, const char *subject,
return 0;
}

static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids, const char *prefix)
static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids)
{
struct rev_info check_rev;
struct commit *commit;
Expand All @@ -717,7 +717,8 @@ static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids, const cha
init_patch_ids(ids);

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

while ((commit = get_revision(&check_rev)) != NULL) {
/* ignore merges */
if (commit->parents && commit->parents->next)
continue;

add_commit_patch_id(commit, ids);
}

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

if (!use_stdout)
Expand Down Expand Up @@ -1508,10 +1505,7 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)
}

init_revisions(&revs, prefix);
revs.diff = 1;
revs.combine_merges = 0;
revs.ignore_merges = 1;
DIFF_OPT_SET(&revs.diffopt, RECURSIVE);
revs.max_parents = 1;

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

get_patch_ids(&revs, &ids, prefix);
get_patch_ids(&revs, &ids);

if (limit && add_pending_commit(limit, &revs, UNINTERESTING))
die(_("Unknown commit %s"), limit);
Expand All @@ -1534,10 +1528,6 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)
if (prepare_revision_walk(&revs))
die(_("revision walk setup failed"));
while ((commit = get_revision(&revs)) != NULL) {
/* ignore merges */
if (commit->parents && commit->parents->next)
continue;

commit_list_insert(commit, &list);
}

Expand Down

0 comments on commit 8748f3c

Please sign in to comment.