]> git.proxmox.com Git - libgit2.git/commitdiff
revwalk: return GIT_EREVWALKER earlier if no references were pushed
authorCarlos Martín Nieto <carlos@cmartin.tk>
Mon, 16 Apr 2012 09:58:46 +0000 (11:58 +0200)
committerCarlos Martín Nieto <carlos@cmartin.tk>
Wed, 25 Apr 2012 10:45:03 +0000 (12:45 +0200)
In the case that walk->one is NULL, we know that we have no positive
references, so we already know that the revwalk is over.

src/revwalk.c

index a62576038c8412d40a29e7072dc935e7c23eb110..041dc1a1c7b9d3329a9970b1183173f3dd742c8b 100644 (file)
@@ -689,6 +689,13 @@ static int prepare_walk(git_revwalk *walk)
        commit_object *next, *two;
        commit_list *bases = NULL;
 
+       /*
+        * If walk->one is NULL, there were no positive references,
+        * so we know that the walk is already over.
+        */
+       if (walk->one == NULL)
+               return GIT_EREVWALKOVER;
+
        /* first figure out what the merge bases are */
        if (merge_bases_many(&bases, walk, walk->one, &walk->twos) < 0)
                return -1;