From 2e3a0055d136d13fba365bf2a26638f84bd32d02 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Carlos=20Mart=C3=ADn=20Nieto?= Date: Mon, 16 Apr 2012 11:58:46 +0200 Subject: [PATCH] revwalk: return GIT_EREVWALKER earlier if no references were pushed 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 | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/revwalk.c b/src/revwalk.c index a62576038..041dc1a1c 100644 --- a/src/revwalk.c +++ b/src/revwalk.c @@ -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;