]> git.ipfire.org Git - thirdparty/git.git/commitdiff
MyFirstObjectWalk: remove unnecessary conditional statement
authorJohannes Schindelin <johannes.schindelin@gmx.de>
Sat, 28 Mar 2020 15:19:13 +0000 (15:19 +0000)
committerJunio C Hamano <gitster@pobox.com>
Mon, 30 Mar 2020 18:16:41 +0000 (11:16 -0700)
In the given example, `commit` cannot be `NULL` (because this is the
loop condition: if it was `NULL`, the loop body would not be entered at
all). It took this developer a moment or two to see that this is
therefore dead code.

Let's remove it, to avoid puzzling future readers.

Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
Reviewed-by: Emily Shaffer <emilyshaffer@google.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
Documentation/MyFirstObjectWalk.txt

index aa828dfdc44a856c8bdd8b0826defeb398113bcc..c3f2d1a831e3b1d9c3e7cd5d555248e01bffbd73 100644 (file)
@@ -357,9 +357,6 @@ static void walken_commit_walk(struct rev_info *rev)
        ...
 
        while ((commit = get_revision(rev))) {
-               if (!commit)
-                       continue;
-
                strbuf_reset(&prettybuf);
                pp_commit_easy(CMIT_FMT_ONELINE, commit, &prettybuf);
                puts(prettybuf.buf);