MCPcopy Create free account
hub / github.com/git/git / get_revision

Function get_revision

revision.c:4659–4714  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4657}
4658
4659struct commit *get_revision(struct rev_info *revs)
4660{
4661 struct commit *c;
4662 struct commit_list *reversed;
4663 struct commit_list *queue = NULL;
4664 struct commit_list *p;
4665
4666 if (revs->max_count_type == 1 && !revs->max_count_stage) {
4667 retrieve_oldest_commits(revs, &queue);
4668 commit_list_free(revs->commits);
4669 revs->commits = queue;
4670 revs->max_count_stage = 1;
4671 }
4672
4673 if (revs->reverse) {
4674 reversed = NULL;
4675 if (revs->max_count_type == 1)
4676 while ((c = pop_commit(&revs->commits)))
4677 commit_list_insert(c, &reversed);
4678 else
4679 while ((c = get_revision_internal(revs)))
4680 commit_list_insert(c, &reversed);
4681 commit_list_free(revs->commits);
4682 revs->commits = reversed;
4683 revs->reverse = 0;
4684 revs->reverse_output_stage = 1;
4685 }
4686
4687 if (revs->reverse_output_stage) {
4688 c = pop_commit(&revs->commits);
4689 if (revs->track_linear)
4690 revs->linear = !!(c && c->object.flags & TRACK_LINEAR);
4691 return c;
4692 }
4693
4694 if (revs->max_count_stage) {
4695 c = pop_commit(&revs->commits);
4696 if (c) {
4697 c->object.flags |= SHOWN;
4698 if (!(c->object.flags & BOUNDARY))
4699 for (p = c->parents; p; p = p->next)
4700 p->item->object.flags |= CHILD_SHOWN;
4701 }
4702 } else {
4703 c = get_revision_internal(revs);
4704 }
4705
4706 if (c && revs->graph)
4707 graph_update(revs->graph, c);
4708 if (!c) {
4709 free_saved_parents(revs);
4710 commit_list_free(revs->previous_parents);
4711 revs->previous_parents = NULL;
4712 }
4713 return c;
4714}
4715
4716const char *get_revision_mark(const struct rev_info *revs, const struct commit *commit)

Callers 15

find_first_mergesFunction · 0.85
shortlogFunction · 0.85
get_deltaFunction · 0.85
walk_revs_populate_todoFunction · 0.85
sequencer_pick_revisionsFunction · 0.85
make_script_with_mergesFunction · 0.85
sequencer_make_scriptFunction · 0.85
do_traverseFunction · 0.85
stat_branch_pairFunction · 0.85
replay_revisionsFunction · 0.85

Calls 7

retrieve_oldest_commitsFunction · 0.85
commit_list_freeFunction · 0.85
pop_commitFunction · 0.85
commit_list_insertFunction · 0.85
get_revision_internalFunction · 0.85
graph_updateFunction · 0.85
free_saved_parentsFunction · 0.85

Tested by 1

run_revision_walkFunction · 0.68