{"thread":{"id":"53123","subject":"[PATCH] MyFirstObjectWalk: remove unnecessary conditional statement","startedAt":"2020-03-28T15:19:18Z","lastAt":"2020-03-30T18:26:12Z","messageCount":3,"participants":["Johannes Schindelin via GitGitGadget","Emily Shaffer","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"394235","messageId":"pull.589.git.1585408753519.gitgitgadget@gmail.com","threadId":"53123","inReplyTo":null,"subject":"[PATCH] MyFirstObjectWalk: remove unnecessary conditional statement","fromName":"Johannes Schindelin via GitGitGadget","fromEmail":"gitgitgadget@gmail.com","sentAt":"2020-03-28T15:19:13Z","receivedAt":"2020-03-28T15:19:18Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"From: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nIn the given example, `commit` cannot be `NULL` (because this is the\nloop condition: if it was `NULL`, the loop body would not be entered at\nall). It took this developer a moment or two to see that this is\ntherefore dead code.\n\nLet's remove it, to avoid puzzling future readers.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n    MyFirstObjectWalk: remove unnecessary conditional statement\n    \n    Our introductory documentation made me scratch my head because our\n    example contains dead code. I'd like to remove it lest we confuse future\n    contributors.\n\nPublished-As: https://github.com/gitgitgadget/git/releases/tag/pr-589%2Fdscho%2Fgit-walken-head-scratcher-v1\nFetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-589/dscho/git-walken-head-scratcher-v1\nPull-Request: https://github.com/gitgitgadget/git/pull/589\n\n Documentation/MyFirstObjectWalk.txt | 3 ---\n 1 file changed, 3 deletions(-)\n\ndiff --git a/Documentation/MyFirstObjectWalk.txt b/Documentation/MyFirstObjectWalk.txt\nindex aa828dfdc44..c3f2d1a831e 100644\n--- a/Documentation/MyFirstObjectWalk.txt\n+++ b/Documentation/MyFirstObjectWalk.txt\n@@ -357,9 +357,6 @@ static void walken_commit_walk(struct rev_info *rev)\n \t...\n \n \twhile ((commit = get_revision(rev))) {\n-\t\tif (!commit)\n-\t\t\tcontinue;\n-\n \t\tstrbuf_reset(&prettybuf);\n \t\tpp_commit_easy(CMIT_FMT_ONELINE, commit, &prettybuf);\n \t\tputs(prettybuf.buf);\n\nbase-commit: 3bab5d56259722843359702bc27111475437ad2a\n-- \ngitgitgadget\n"},{"id":"394386","messageId":"20200330180742.GB37946@google.com","threadId":"53123","inReplyTo":"pull.589.git.1585408753519.gitgitgadget@gmail.com","subject":"Re: [PATCH] MyFirstObjectWalk: remove unnecessary conditional statement","fromName":"Emily Shaffer","fromEmail":"emilyshaffer@google.com","sentAt":"2020-03-30T18:07:42Z","receivedAt":"2020-03-30T18:07:51Z","isPatch":true,"sender":{"key":"nasamuffin@google.com","avatar":"https://avatars.githubusercontent.com/u/1606826?v=4"},"body":"On Sat, Mar 28, 2020 at 03:19:13PM +0000, Johannes Schindelin via GitGitGadget wrote:\n> From: Johannes Schindelin <johannes.schindelin@gmx.de>\n> \n> In the given example, `commit` cannot be `NULL` (because this is the\n> loop condition: if it was `NULL`, the loop body would not be entered at\n> all). It took this developer a moment or two to see that this is\n> therefore dead code.\n\nNice catch. Thanks.\n\n> \n> Let's remove it, to avoid puzzling future readers.\n> \n> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n\nReviewed-by: Emily Shaffer <emilyshaffer@google.com>\n\n> ---\n>     MyFirstObjectWalk: remove unnecessary conditional statement\n>     \n>     Our introductory documentation made me scratch my head because our\n>     example contains dead code. I'd like to remove it lest we confuse future\n>     contributors.\n> \n> Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-589%2Fdscho%2Fgit-walken-head-scratcher-v1\n> Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-589/dscho/git-walken-head-scratcher-v1\n> Pull-Request: https://github.com/gitgitgadget/git/pull/589\n> \n>  Documentation/MyFirstObjectWalk.txt | 3 ---\n>  1 file changed, 3 deletions(-)\n> \n> diff --git a/Documentation/MyFirstObjectWalk.txt b/Documentation/MyFirstObjectWalk.txt\n> index aa828dfdc44..c3f2d1a831e 100644\n> --- a/Documentation/MyFirstObjectWalk.txt\n> +++ b/Documentation/MyFirstObjectWalk.txt\n> @@ -357,9 +357,6 @@ static void walken_commit_walk(struct rev_info *rev)\n>  \t...\n>  \n>  \twhile ((commit = get_revision(rev))) {\n> -\t\tif (!commit)\n> -\t\t\tcontinue;\n> -\n>  \t\tstrbuf_reset(&prettybuf);\n>  \t\tpp_commit_easy(CMIT_FMT_ONELINE, commit, &prettybuf);\n>  \t\tputs(prettybuf.buf);\n> \n> base-commit: 3bab5d56259722843359702bc27111475437ad2a\n> -- \n> gitgitgadget\n"},{"id":"394390","messageId":"xmqq5zel8zsx.fsf@gitster.c.googlers.com","threadId":"53123","inReplyTo":"20200330180742.GB37946@google.com","subject":"Re: [PATCH] MyFirstObjectWalk: remove unnecessary conditional statement","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2020-03-30T18:26:06Z","receivedAt":"2020-03-30T18:26:12Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Emily Shaffer <emilyshaffer@google.com> writes:\n\n> On Sat, Mar 28, 2020 at 03:19:13PM +0000, Johannes Schindelin via GitGitGadget wrote:\n>> From: Johannes Schindelin <johannes.schindelin@gmx.de>\n>> \n>> In the given example, `commit` cannot be `NULL` (because this is the\n>> loop condition: if it was `NULL`, the loop body would not be entered at\n>> all). It took this developer a moment or two to see that this is\n>> therefore dead code.\n>\n> Nice catch. Thanks.\n>\n>> \n>> Let's remove it, to avoid puzzling future readers.\n>> \n>> Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n>\n> Reviewed-by: Emily Shaffer <emilyshaffer@google.com>\n\nThanks, both.\n"}]}