From: Junio C Hamano Date: Mon, 30 Apr 2012 00:51:30 +0000 (-0700) Subject: Merge branch 'rs/commit-list-append' X-Git-Tag: v1.7.11-rc0~86 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/6a8989709efbd6d5187005497907264fde026ae9?ds=inline;hp=-c Merge branch 'rs/commit-list-append' There is no need for "commit_list_reverse()" function that only invites inefficient code. By René Scharfe * rs/commit-list-append: commit: remove commit_list_reverse() revision: append to list instead of insert and reverse sequencer: export commit_list_append() --- 6a8989709efbd6d5187005497907264fde026ae9 diff --combined revision.c index e0e80f13ef,c1934ba3ca..935e7a7ba4 --- a/revision.c +++ b/revision.c @@@ -1715,21 -1715,17 +1715,21 @@@ int setup_revisions(int argc, const cha submodule = opt->submodule; /* First, search for "--" */ - seen_dashdash = 0; - for (i = 1; i < argc; i++) { - const char *arg = argv[i]; - if (strcmp(arg, "--")) - continue; - argv[i] = NULL; - argc = i; - if (argv[i + 1]) - append_prune_data(&prune_data, argv + i + 1); + if (opt && opt->assume_dashdash) { seen_dashdash = 1; - break; + } else { + seen_dashdash = 0; + for (i = 1; i < argc; i++) { + const char *arg = argv[i]; + if (strcmp(arg, "--")) + continue; + argv[i] = NULL; + argc = i; + if (argv[i + 1]) + append_prune_data(&prune_data, argv + i + 1); + seen_dashdash = 1; + break; + } } /* Second, deal with arguments and options */ @@@ -2066,15 -2062,11 +2066,16 @@@ static void set_children(struct rev_inf } } +void reset_revision_walk(void) +{ + clear_object_flags(SEEN | ADDED | SHOWN); +} + int prepare_revision_walk(struct rev_info *revs) { int nr = revs->pending.nr; struct object_array_entry *e, *list; + struct commit_list **next = &revs->commits; e = list = revs->pending.objects; revs->pending.nr = 0; @@@ -2085,12 -2077,11 +2086,11 @@@ if (commit) { if (!(commit->object.flags & SEEN)) { commit->object.flags |= SEEN; - commit_list_insert(commit, &revs->commits); + next = commit_list_append(commit, next); } } e++; } - commit_list_reverse(&revs->commits); commit_list_sort_by_date(&revs->commits); if (!revs->leak_pending) free(list); diff --combined sequencer.c index cd11e340dd,ac6c8238e5..81d8ace35f --- a/sequencer.c +++ b/sequencer.c @@@ -234,7 -234,7 +234,7 @@@ static int do_recursive_merge(struct co if (!clean) { int i; - strbuf_addstr(msgbuf, "\nConflicts:\n\n"); + strbuf_addstr(msgbuf, "\nConflicts:\n"); for (i = 0; i < active_nr;) { struct cache_entry *ce = active_cache[i++]; if (ce_stage(ce)) { @@@ -468,33 -468,6 +468,6 @@@ static void read_and_refresh_cache(stru rollback_lock_file(&index_lock); } - /* - * Append a commit to the end of the commit_list. - * - * next starts by pointing to the variable that holds the head of an - * empty commit_list, and is updated to point to the "next" field of - * the last item on the list as new commits are appended. - * - * Usage example: - * - * struct commit_list *list; - * struct commit_list **next = &list; - * - * next = commit_list_append(c1, next); - * next = commit_list_append(c2, next); - * assert(commit_list_count(list) == 2); - * return list; - */ - static struct commit_list **commit_list_append(struct commit *commit, - struct commit_list **next) - { - struct commit_list *new = xmalloc(sizeof(struct commit_list)); - new->item = commit; - *next = new; - new->next = NULL; - return &new->next; - } - static int format_todo(struct strbuf *buf, struct commit_list *todo_list, struct replay_opts *opts) {