Commit 7c2f08a
get_revision_1(): replace do-while with an early return
The get_revision_1() function tries to avoid entering its
main loop at all when there are no commits to look at. But
it's perfectly safe to call pop_commit() on an empty list
(in which case it will return NULL). Switching to an early
return from the loop lets us skip repeating the loop
condition before we enter the do-while. That will get more
important when we start pulling reflog-walk commits from a
source besides the revs->commits queue, as that condition
will get much more complicated.
Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>1 parent f35650d commit 7c2f08a
1 file changed
+5
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3111 | 3111 | | |
3112 | 3112 | | |
3113 | 3113 | | |
3114 | | - | |
3115 | | - | |
3116 | | - | |
3117 | | - | |
| 3114 | + | |
3118 | 3115 | | |
3119 | 3116 | | |
| 3117 | + | |
| 3118 | + | |
| 3119 | + | |
3120 | 3120 | | |
3121 | 3121 | | |
3122 | 3122 | | |
| |||
3150 | 3150 | | |
3151 | 3151 | | |
3152 | 3152 | | |
3153 | | - | |
3154 | | - | |
| 3153 | + | |
3155 | 3154 | | |
3156 | 3155 | | |
3157 | 3156 | | |
| |||
0 commit comments