MyFirstObjectWalk: remove unnecessary conditional statement
authorJohannes Schindelin <redacted>
Sat, 28 Mar 2020 15:19:13 +0000 (15:19 +0000)
committerJunio C Hamano <redacted>
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 <redacted>
Reviewed-by: Emily Shaffer <redacted>
Signed-off-by: Junio C Hamano <redacted>
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);
git clone https://git.99rst.org/PROJECT