Commit ef682410 by Carlos Martín Nieto

revwalk: remove one useless layer of functions

We don't currently need to have anything that's different between `get_revision`
and `get_one_revision` so let's just remove the inner function and make the code
more straightforward.
parent 2a6d0956
...@@ -453,12 +453,11 @@ static int limit_list(git_commit_list **out, git_revwalk *walk, git_commit_list ...@@ -453,12 +453,11 @@ static int limit_list(git_commit_list **out, git_revwalk *walk, git_commit_list
return 0; return 0;
} }
static int get_one_revision(git_commit_list_node **out, git_revwalk *walk, git_commit_list **list) static int get_revision(git_commit_list_node **out, git_revwalk *walk, git_commit_list **list)
{ {
int error; int error;
git_commit_list_node *commit; git_commit_list_node *commit;
while(true) {
commit = git_commit_list_pop(list); commit = git_commit_list_pop(list);
if (!commit) { if (!commit) {
giterr_clear(); giterr_clear();
...@@ -476,20 +475,6 @@ static int get_one_revision(git_commit_list_node **out, git_revwalk *walk, git_c ...@@ -476,20 +475,6 @@ static int get_one_revision(git_commit_list_node **out, git_revwalk *walk, git_c
*out = commit; *out = commit;
return 0; return 0;
}
}
static int get_revision(git_commit_list_node **out, git_revwalk *walk, git_commit_list **list)
{
int error;
git_commit_list_node *commit;
if ((error = get_one_revision(&commit, walk, list)) < 0)
return error;
/* Here is where we would handle boundary commits if we implement that */
*out = commit;
return 0;
} }
static int sort_in_topological_order(git_commit_list **out, git_revwalk *walk, git_commit_list *list) static int sort_in_topological_order(git_commit_list **out, git_revwalk *walk, git_commit_list *list)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment