commit: Add commit_list prefix in two function names.
Add commit_list prefix to insert_by_date function and to sort_by_date, so it's clear that these functions refer to commit_list structure. Signed-off-by: Thiago Farina <tfransosi@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
7d43de925b
commit
47e44ed1dc
@ -189,7 +189,7 @@ static unsigned long finish_depth_computation(
|
|||||||
struct commit *p = parents->item;
|
struct commit *p = parents->item;
|
||||||
parse_commit(p);
|
parse_commit(p);
|
||||||
if (!(p->object.flags & SEEN))
|
if (!(p->object.flags & SEEN))
|
||||||
insert_by_date(p, list);
|
commit_list_insert_by_date(p, list);
|
||||||
p->object.flags |= c->object.flags;
|
p->object.flags |= c->object.flags;
|
||||||
parents = parents->next;
|
parents = parents->next;
|
||||||
}
|
}
|
||||||
@ -300,7 +300,7 @@ static void describe(const char *arg, int last_one)
|
|||||||
struct commit *p = parents->item;
|
struct commit *p = parents->item;
|
||||||
parse_commit(p);
|
parse_commit(p);
|
||||||
if (!(p->object.flags & SEEN))
|
if (!(p->object.flags & SEEN))
|
||||||
insert_by_date(p, &list);
|
commit_list_insert_by_date(p, &list);
|
||||||
p->object.flags |= c->object.flags;
|
p->object.flags |= c->object.flags;
|
||||||
parents = parents->next;
|
parents = parents->next;
|
||||||
}
|
}
|
||||||
@ -328,7 +328,7 @@ static void describe(const char *arg, int last_one)
|
|||||||
qsort(all_matches, match_cnt, sizeof(all_matches[0]), compare_pt);
|
qsort(all_matches, match_cnt, sizeof(all_matches[0]), compare_pt);
|
||||||
|
|
||||||
if (gave_up_on) {
|
if (gave_up_on) {
|
||||||
insert_by_date(gave_up_on, &list);
|
commit_list_insert_by_date(gave_up_on, &list);
|
||||||
seen_commits--;
|
seen_commits--;
|
||||||
}
|
}
|
||||||
seen_commits += finish_depth_computation(&list, &all_matches[0]);
|
seen_commits += finish_depth_computation(&list, &all_matches[0]);
|
||||||
|
@ -47,7 +47,7 @@ static void rev_list_push(struct commit *commit, int mark)
|
|||||||
if (parse_commit(commit))
|
if (parse_commit(commit))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
insert_by_date(commit, &rev_list);
|
commit_list_insert_by_date(commit, &rev_list);
|
||||||
|
|
||||||
if (!(commit->object.flags & COMMON))
|
if (!(commit->object.flags & COMMON))
|
||||||
non_common_revs++;
|
non_common_revs++;
|
||||||
@ -436,7 +436,7 @@ static int mark_complete(const char *path, const unsigned char *sha1, int flag,
|
|||||||
if (o && o->type == OBJ_COMMIT) {
|
if (o && o->type == OBJ_COMMIT) {
|
||||||
struct commit *commit = (struct commit *)o;
|
struct commit *commit = (struct commit *)o;
|
||||||
commit->object.flags |= COMPLETE;
|
commit->object.flags |= COMPLETE;
|
||||||
insert_by_date(commit, &complete);
|
commit_list_insert_by_date(commit, &complete);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -243,7 +243,7 @@ static void join_revs(struct commit_list **list_p,
|
|||||||
if (mark_seen(p, seen_p) && !still_interesting)
|
if (mark_seen(p, seen_p) && !still_interesting)
|
||||||
extra--;
|
extra--;
|
||||||
p->object.flags |= flags;
|
p->object.flags |= flags;
|
||||||
insert_by_date(p, list_p);
|
commit_list_insert_by_date(p, list_p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -859,7 +859,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
|
|||||||
*/
|
*/
|
||||||
commit->object.flags |= flag;
|
commit->object.flags |= flag;
|
||||||
if (commit->object.flags == flag)
|
if (commit->object.flags == flag)
|
||||||
insert_by_date(commit, &list);
|
commit_list_insert_by_date(commit, &list);
|
||||||
rev[num_rev] = commit;
|
rev[num_rev] = commit;
|
||||||
}
|
}
|
||||||
for (i = 0; i < num_rev; i++)
|
for (i = 0; i < num_rev; i++)
|
||||||
@ -868,7 +868,7 @@ int cmd_show_branch(int ac, const char **av, const char *prefix)
|
|||||||
if (0 <= extra)
|
if (0 <= extra)
|
||||||
join_revs(&list, &seen, num_rev, extra);
|
join_revs(&list, &seen, num_rev, extra);
|
||||||
|
|
||||||
sort_by_date(&seen);
|
commit_list_sort_by_date(&seen);
|
||||||
|
|
||||||
if (merge_base)
|
if (merge_base)
|
||||||
return show_merge_base(seen, num_rev);
|
return show_merge_base(seen, num_rev);
|
||||||
|
24
commit.c
24
commit.c
@ -360,7 +360,7 @@ void free_commit_list(struct commit_list *list)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct commit_list * insert_by_date(struct commit *item, struct commit_list **list)
|
struct commit_list * commit_list_insert_by_date(struct commit *item, struct commit_list **list)
|
||||||
{
|
{
|
||||||
struct commit_list **pp = list;
|
struct commit_list **pp = list;
|
||||||
struct commit_list *p;
|
struct commit_list *p;
|
||||||
@ -374,11 +374,11 @@ struct commit_list * insert_by_date(struct commit *item, struct commit_list **li
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void sort_by_date(struct commit_list **list)
|
void commit_list_sort_by_date(struct commit_list **list)
|
||||||
{
|
{
|
||||||
struct commit_list *ret = NULL;
|
struct commit_list *ret = NULL;
|
||||||
while (*list) {
|
while (*list) {
|
||||||
insert_by_date((*list)->item, &ret);
|
commit_list_insert_by_date((*list)->item, &ret);
|
||||||
*list = (*list)->next;
|
*list = (*list)->next;
|
||||||
}
|
}
|
||||||
*list = ret;
|
*list = ret;
|
||||||
@ -398,7 +398,7 @@ struct commit *pop_most_recent_commit(struct commit_list **list,
|
|||||||
struct commit *commit = parents->item;
|
struct commit *commit = parents->item;
|
||||||
if (!parse_commit(commit) && !(commit->object.flags & mark)) {
|
if (!parse_commit(commit) && !(commit->object.flags & mark)) {
|
||||||
commit->object.flags |= mark;
|
commit->object.flags |= mark;
|
||||||
insert_by_date(commit, list);
|
commit_list_insert_by_date(commit, list);
|
||||||
}
|
}
|
||||||
parents = parents->next;
|
parents = parents->next;
|
||||||
}
|
}
|
||||||
@ -487,7 +487,7 @@ void sort_in_topological_order(struct commit_list ** list, int lifo)
|
|||||||
|
|
||||||
/* process the list in topological order */
|
/* process the list in topological order */
|
||||||
if (!lifo)
|
if (!lifo)
|
||||||
sort_by_date(&work);
|
commit_list_sort_by_date(&work);
|
||||||
|
|
||||||
pptr = list;
|
pptr = list;
|
||||||
*list = NULL;
|
*list = NULL;
|
||||||
@ -513,7 +513,7 @@ void sort_in_topological_order(struct commit_list ** list, int lifo)
|
|||||||
*/
|
*/
|
||||||
if (--parent->indegree == 1) {
|
if (--parent->indegree == 1) {
|
||||||
if (!lifo)
|
if (!lifo)
|
||||||
insert_by_date(parent, &work);
|
commit_list_insert_by_date(parent, &work);
|
||||||
else
|
else
|
||||||
commit_list_insert(parent, &work);
|
commit_list_insert(parent, &work);
|
||||||
}
|
}
|
||||||
@ -573,10 +573,10 @@ static struct commit_list *merge_bases_many(struct commit *one, int n, struct co
|
|||||||
}
|
}
|
||||||
|
|
||||||
one->object.flags |= PARENT1;
|
one->object.flags |= PARENT1;
|
||||||
insert_by_date(one, &list);
|
commit_list_insert_by_date(one, &list);
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
twos[i]->object.flags |= PARENT2;
|
twos[i]->object.flags |= PARENT2;
|
||||||
insert_by_date(twos[i], &list);
|
commit_list_insert_by_date(twos[i], &list);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (interesting(list)) {
|
while (interesting(list)) {
|
||||||
@ -594,7 +594,7 @@ static struct commit_list *merge_bases_many(struct commit *one, int n, struct co
|
|||||||
if (flags == (PARENT1 | PARENT2)) {
|
if (flags == (PARENT1 | PARENT2)) {
|
||||||
if (!(commit->object.flags & RESULT)) {
|
if (!(commit->object.flags & RESULT)) {
|
||||||
commit->object.flags |= RESULT;
|
commit->object.flags |= RESULT;
|
||||||
insert_by_date(commit, &result);
|
commit_list_insert_by_date(commit, &result);
|
||||||
}
|
}
|
||||||
/* Mark parents of a found merge stale */
|
/* Mark parents of a found merge stale */
|
||||||
flags |= STALE;
|
flags |= STALE;
|
||||||
@ -608,7 +608,7 @@ static struct commit_list *merge_bases_many(struct commit *one, int n, struct co
|
|||||||
if (parse_commit(p))
|
if (parse_commit(p))
|
||||||
return NULL;
|
return NULL;
|
||||||
p->object.flags |= flags;
|
p->object.flags |= flags;
|
||||||
insert_by_date(p, &list);
|
commit_list_insert_by_date(p, &list);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -618,7 +618,7 @@ static struct commit_list *merge_bases_many(struct commit *one, int n, struct co
|
|||||||
while (list) {
|
while (list) {
|
||||||
struct commit_list *next = list->next;
|
struct commit_list *next = list->next;
|
||||||
if (!(list->item->object.flags & STALE))
|
if (!(list->item->object.flags & STALE))
|
||||||
insert_by_date(list->item, &result);
|
commit_list_insert_by_date(list->item, &result);
|
||||||
free(list);
|
free(list);
|
||||||
list = next;
|
list = next;
|
||||||
}
|
}
|
||||||
@ -711,7 +711,7 @@ struct commit_list *get_merge_bases_many(struct commit *one,
|
|||||||
result = NULL;
|
result = NULL;
|
||||||
for (i = 0; i < cnt; i++) {
|
for (i = 0; i < cnt; i++) {
|
||||||
if (rslt[i])
|
if (rslt[i])
|
||||||
insert_by_date(rslt[i], &result);
|
commit_list_insert_by_date(rslt[i], &result);
|
||||||
}
|
}
|
||||||
free(rslt);
|
free(rslt);
|
||||||
return result;
|
return result;
|
||||||
|
10
commit.h
10
commit.h
@ -38,20 +38,20 @@ struct commit *lookup_commit_reference_gently(const unsigned char *sha1,
|
|||||||
int quiet);
|
int quiet);
|
||||||
|
|
||||||
int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size);
|
int parse_commit_buffer(struct commit *item, void *buffer, unsigned long size);
|
||||||
|
|
||||||
int parse_commit(struct commit *item);
|
int parse_commit(struct commit *item);
|
||||||
|
|
||||||
/* Find beginning and length of commit subject. */
|
/* Find beginning and length of commit subject. */
|
||||||
int find_commit_subject(const char *commit_buffer, const char **subject);
|
int find_commit_subject(const char *commit_buffer, const char **subject);
|
||||||
|
|
||||||
struct commit_list * commit_list_insert(struct commit *item, struct commit_list **list_p);
|
struct commit_list *commit_list_insert(struct commit *item,
|
||||||
|
struct commit_list **list);
|
||||||
unsigned commit_list_count(const struct commit_list *l);
|
unsigned commit_list_count(const struct commit_list *l);
|
||||||
struct commit_list * insert_by_date(struct commit *item, struct commit_list **list);
|
struct commit_list *commit_list_insert_by_date(struct commit *item,
|
||||||
|
struct commit_list **list);
|
||||||
|
void commit_list_sort_by_date(struct commit_list **list);
|
||||||
|
|
||||||
void free_commit_list(struct commit_list *list);
|
void free_commit_list(struct commit_list *list);
|
||||||
|
|
||||||
void sort_by_date(struct commit_list **list);
|
|
||||||
|
|
||||||
/* Commit formats */
|
/* Commit formats */
|
||||||
enum cmit_fmt {
|
enum cmit_fmt {
|
||||||
CMIT_FMT_RAW,
|
CMIT_FMT_RAW,
|
||||||
|
12
revision.c
12
revision.c
@ -444,15 +444,15 @@ static void try_to_simplify_commit(struct rev_info *revs, struct commit *commit)
|
|||||||
commit->object.flags |= TREESAME;
|
commit->object.flags |= TREESAME;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void insert_by_date_cached(struct commit *p, struct commit_list **head,
|
static void commit_list_insert_by_date_cached(struct commit *p, struct commit_list **head,
|
||||||
struct commit_list *cached_base, struct commit_list **cache)
|
struct commit_list *cached_base, struct commit_list **cache)
|
||||||
{
|
{
|
||||||
struct commit_list *new_entry;
|
struct commit_list *new_entry;
|
||||||
|
|
||||||
if (cached_base && p->date < cached_base->item->date)
|
if (cached_base && p->date < cached_base->item->date)
|
||||||
new_entry = insert_by_date(p, &cached_base->next);
|
new_entry = commit_list_insert_by_date(p, &cached_base->next);
|
||||||
else
|
else
|
||||||
new_entry = insert_by_date(p, head);
|
new_entry = commit_list_insert_by_date(p, head);
|
||||||
|
|
||||||
if (cache && (!*cache || p->date < (*cache)->item->date))
|
if (cache && (!*cache || p->date < (*cache)->item->date))
|
||||||
*cache = new_entry;
|
*cache = new_entry;
|
||||||
@ -494,7 +494,7 @@ static int add_parents_to_list(struct rev_info *revs, struct commit *commit,
|
|||||||
if (p->object.flags & SEEN)
|
if (p->object.flags & SEEN)
|
||||||
continue;
|
continue;
|
||||||
p->object.flags |= SEEN;
|
p->object.flags |= SEEN;
|
||||||
insert_by_date_cached(p, list, cached_base, cache_ptr);
|
commit_list_insert_by_date_cached(p, list, cached_base, cache_ptr);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -521,7 +521,7 @@ static int add_parents_to_list(struct rev_info *revs, struct commit *commit,
|
|||||||
p->object.flags |= left_flag;
|
p->object.flags |= left_flag;
|
||||||
if (!(p->object.flags & SEEN)) {
|
if (!(p->object.flags & SEEN)) {
|
||||||
p->object.flags |= SEEN;
|
p->object.flags |= SEEN;
|
||||||
insert_by_date_cached(p, list, cached_base, cache_ptr);
|
commit_list_insert_by_date_cached(p, list, cached_base, cache_ptr);
|
||||||
}
|
}
|
||||||
if (revs->first_parent_only)
|
if (revs->first_parent_only)
|
||||||
break;
|
break;
|
||||||
@ -1891,7 +1891,7 @@ int prepare_revision_walk(struct rev_info *revs)
|
|||||||
if (commit) {
|
if (commit) {
|
||||||
if (!(commit->object.flags & SEEN)) {
|
if (!(commit->object.flags & SEEN)) {
|
||||||
commit->object.flags |= SEEN;
|
commit->object.flags |= SEEN;
|
||||||
insert_by_date(commit, &revs->commits);
|
commit_list_insert_by_date(commit, &revs->commits);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
e++;
|
e++;
|
||||||
|
@ -683,7 +683,7 @@ static int handle_one_ref(const char *path,
|
|||||||
}
|
}
|
||||||
if (object->type != OBJ_COMMIT)
|
if (object->type != OBJ_COMMIT)
|
||||||
return 0;
|
return 0;
|
||||||
insert_by_date((struct commit *)object, list);
|
commit_list_insert_by_date((struct commit *)object, list);
|
||||||
object->flags |= ONELINE_SEEN;
|
object->flags |= ONELINE_SEEN;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -366,7 +366,7 @@ static int reachable(struct commit *want)
|
|||||||
{
|
{
|
||||||
struct commit_list *work = NULL;
|
struct commit_list *work = NULL;
|
||||||
|
|
||||||
insert_by_date(want, &work);
|
commit_list_insert_by_date(want, &work);
|
||||||
while (work) {
|
while (work) {
|
||||||
struct commit_list *list = work->next;
|
struct commit_list *list = work->next;
|
||||||
struct commit *commit = work->item;
|
struct commit *commit = work->item;
|
||||||
@ -387,7 +387,7 @@ static int reachable(struct commit *want)
|
|||||||
for (list = commit->parents; list; list = list->next) {
|
for (list = commit->parents; list; list = list->next) {
|
||||||
struct commit *parent = list->item;
|
struct commit *parent = list->item;
|
||||||
if (!(parent->object.flags & REACHABLE))
|
if (!(parent->object.flags & REACHABLE))
|
||||||
insert_by_date(parent, &work);
|
commit_list_insert_by_date(parent, &work);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
want->object.flags |= REACHABLE;
|
want->object.flags |= REACHABLE;
|
||||||
|
2
walker.c
2
walker.c
@ -207,7 +207,7 @@ static int mark_complete(const char *path, const unsigned char *sha1, int flag,
|
|||||||
struct commit *commit = lookup_commit_reference_gently(sha1, 1);
|
struct commit *commit = lookup_commit_reference_gently(sha1, 1);
|
||||||
if (commit) {
|
if (commit) {
|
||||||
commit->object.flags |= COMPLETE;
|
commit->object.flags |= COMPLETE;
|
||||||
insert_by_date(commit, &complete);
|
commit_list_insert_by_date(commit, &complete);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user