{
if (revs->no_walk && (obj->flags & UNINTERESTING))
die("object ranges do not make sense when not walking revisions");
+ if (revs->reflog_info && obj->type == OBJ_COMMIT &&
+ add_reflog_for_walk(revs->reflog_info,
+ (struct commit *)obj, name))
+ return;
add_object_array_with_mode(obj, name, &revs->pending, mode);
- if (revs->reflog_info && obj->type == OBJ_COMMIT)
- add_reflog_for_walk(revs->reflog_info,
- (struct commit *)obj, name);
}
void add_pending_object(struct rev_info *revs, struct object *obj, const char *name)
return 0;
}
-static void cherry_pick_list(struct commit_list *list)
+static void cherry_pick_list(struct commit_list *list, struct rev_info *revs)
{
struct commit_list *p;
int left_count = 0, right_count = 0;
left_first = left_count < right_count;
init_patch_ids(&ids);
+ if (revs->diffopt.nr_paths) {
+ ids.diffopts.nr_paths = revs->diffopt.nr_paths;
+ ids.diffopts.paths = revs->diffopt.paths;
+ ids.diffopts.pathlens = revs->diffopt.pathlens;
+ }
/* Compute patch-ids for one side */
for (p = list; p; p = p->next) {
p = &commit_list_insert(commit, p)->next;
}
if (revs->cherry_pick)
- cherry_pick_list(newlist);
+ cherry_pick_list(newlist, revs);
revs->commits = newlist;
return 0;
continue;
argv[i] = NULL;
argc = i;
- revs->prune_data = get_pathspec(revs->prefix, argv + i + 1);
+ if (argv[i + 1])
+ revs->prune_data = get_pathspec(revs->prefix, argv + i + 1);
seen_dashdash = 1;
break;
}
}
if (!strcmp(arg, "--cherry-pick")) {
revs->cherry_pick = 1;
+ revs->limited = 1;
continue;
}
if (!strcmp(arg, "--objects")) {
if (!strncmp(arg, "--date=", 7)) {
if (!strcmp(arg + 7, "relative"))
revs->date_mode = DATE_RELATIVE;
+ else if (!strcmp(arg + 7, "iso8601") ||
+ !strcmp(arg + 7, "iso"))
+ revs->date_mode = DATE_ISO8601;
+ else if (!strcmp(arg + 7, "rfc2822") ||
+ !strcmp(arg + 7, "rfc"))
+ revs->date_mode = DATE_RFC2822;
+ else if (!strcmp(arg + 7, "short"))
+ revs->date_mode = DATE_SHORT;
else if (!strcmp(arg + 7, "local"))
revs->date_mode = DATE_LOCAL;
else if (!strcmp(arg + 7, "default"))
die("unknown date format %s", arg);
continue;
}
+ if (!strcmp(arg, "--log-size")) {
+ revs->show_log_size = 1;
+ continue;
+ }
/*
* Grepping the commit log
add_message_grep(revs, arg+7);
continue;
}
- if (!prefixcmp(arg, "--extended-regexp")) {
+ if (!strcmp(arg, "--extended-regexp") ||
+ !strcmp(arg, "-E")) {
regflags |= REG_EXTENDED;
continue;
}
- if (!prefixcmp(arg, "--regexp-ignore-case")) {
+ if (!strcmp(arg, "--regexp-ignore-case") ||
+ !strcmp(arg, "-i")) {
regflags |= REG_ICASE;
continue;
}
revs->reverse ^= 1;
continue;
}
+ if (!strcmp(arg, "--no-walk")) {
+ revs->no_walk = 1;
+ continue;
+ }
+ if (!strcmp(arg, "--do-walk")) {
+ revs->no_walk = 0;
+ continue;
+ }
opts = diff_opt_parse(&revs->diffopt, argv+i, argc-i);
if (opts > 0) {
compile_grep_patterns(revs->grep_filter);
}
+ if (revs->reverse && revs->reflog_info)
+ die("cannot combine --reverse with --walk-reflogs");
+
return left;
}
}
}
+static void remove_duplicate_parents(struct commit *commit)
+{
+ struct commit_list **pp, *p;
+
+ /* Examine existing parents while marking ones we have seen... */
+ pp = &commit->parents;
+ while ((p = *pp) != NULL) {
+ struct commit *parent = p->item;
+ if (parent->object.flags & TMP_MARK) {
+ *pp = p->next;
+ continue;
+ }
+ parent->object.flags |= TMP_MARK;
+ pp = &p->next;
+ }
+ /* ... and clear the temporary mark */
+ for (p = commit->parents; p; p = p->next)
+ p->item->object.flags &= ~TMP_MARK;
+}
+
static int rewrite_parents(struct rev_info *revs, struct commit *commit)
{
struct commit_list **pp = &commit->parents;
}
pp = &parent->next;
}
+ remove_duplicate_parents(commit);
return 0;
}