{"thread":{"id":"52146","subject":"[PATCH] git-diff.txt: document return code of `--no-index`","startedAt":"2019-10-29T08:19:52Z","lastAt":"2019-11-02T04:18:07Z","messageCount":9,"participants":["Denton Liu","Johannes Schindelin","Junio C Hamano","Phillip Wood"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"385049","messageId":"3f6d132663cacde01df68bfe88c6ef108cf6cf74.1572337045.git.liu.denton@gmail.com","threadId":"52146","inReplyTo":null,"subject":"[PATCH] git-diff.txt: document return code of `--no-index`","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-29T08:19:45Z","receivedAt":"2019-10-29T08:19:52Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"According to the end of diff_no_index(),\n\n\t/*\n\t * The return code for --no-index imitates diff(1):\n\t * 0 = no changes, 1 = changes, else error\n\t */\n\treturn diff_result_code(&revs->diffopt, 0);\n\nHowever, this is not properly documented in git-diff.txt.\n\nShamelessly steal from the `--exit-code` text and give it to the\n`--no-index` documentation to explain that the return code is similar to\ndiff(1).\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\n Documentation/git-diff.txt | 5 ++++-\n 1 file changed, 4 insertions(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-diff.txt b/Documentation/git-diff.txt\nindex 72179d993c..1e363bd200 100644\n--- a/Documentation/git-diff.txt\n+++ b/Documentation/git-diff.txt\n@@ -36,7 +36,10 @@ two blob objects, or changes between two files on disk.\n \trunning the command in a working tree controlled by Git and\n \tat least one of the paths points outside the working tree,\n \tor when running the command outside a working tree\n-\tcontrolled by Git.\n+\tcontrolled by Git. With `--no-index`,\n+\tthe program exits with codes similar to diff(1). That is, it\n+\texits with 1 if there were differences and 0 means no\n+\tdifferences.\n \n 'git diff' [<options>] --cached [<commit>] [--] [<path>...]::\n \n-- \n2.24.0.rc0.197.g0926ab8072\n\n"},{"id":"385076","messageId":"nycvar.QRO.7.76.6.1910291405090.46@tvgsbejvaqbjf.bet","threadId":"52146","inReplyTo":"3f6d132663cacde01df68bfe88c6ef108cf6cf74.1572337045.git.liu.denton@gmail.com","subject":"Re: [PATCH] git-diff.txt: document return code of `--no-index`","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2019-10-29T13:06:38Z","receivedAt":"2019-10-29T13:06:56Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Denton,\n\nOn Tue, 29 Oct 2019, Denton Liu wrote:\n\n> According to the end of diff_no_index(),\n>\n> \t/*\n> \t * The return code for --no-index imitates diff(1):\n> \t * 0 = no changes, 1 = changes, else error\n> \t */\n> \treturn diff_result_code(&revs->diffopt, 0);\n>\n> However, this is not properly documented in git-diff.txt.\n>\n> Shamelessly steal from the `--exit-code` text and give it to the\n> `--no-index` documentation to explain that the return code is similar to\n> diff(1).\n\nSpeaking of `--exit-code`...\n\n> Signed-off-by: Denton Liu <liu.denton@gmail.com>\n> ---\n>  Documentation/git-diff.txt | 5 ++++-\n>  1 file changed, 4 insertions(+), 1 deletion(-)\n>\n> diff --git a/Documentation/git-diff.txt b/Documentation/git-diff.txt\n> index 72179d993c..1e363bd200 100644\n> --- a/Documentation/git-diff.txt\n> +++ b/Documentation/git-diff.txt\n> @@ -36,7 +36,10 @@ two blob objects, or changes between two files on disk.\n>  \trunning the command in a working tree controlled by Git and\n>  \tat least one of the paths points outside the working tree,\n>  \tor when running the command outside a working tree\n> -\tcontrolled by Git.\n> +\tcontrolled by Git. With `--no-index`,\n> +\tthe program exits with codes similar to diff(1). That is, it\n> +\texits with 1 if there were differences and 0 means no\n> +\tdifferences.\n\n... a shorter alternative would be to state: This implies `--exit-code`.\n\nCiao,\nDscho\n\n>\n>  'git diff' [<options>] --cached [<commit>] [--] [<path>...]::\n>\n> --\n> 2.24.0.rc0.197.g0926ab8072\n>\n>\n"},{"id":"385092","messageId":"ed9f16c30a0f3852abaf0053d8c2b4a0ecd12f01.1572367897.git.liu.denton@gmail.com","threadId":"52146","inReplyTo":"3f6d132663cacde01df68bfe88c6ef108cf6cf74.1572337045.git.liu.denton@gmail.com","subject":"[PATCH v2] git-diff.txt: document return code of `--no-index`","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-29T16:54:32Z","receivedAt":"2019-10-29T16:54:37Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Within diff_no_index(), we have the following:\n\n\trevs->diffopt.flags.exit_with_status = 1;\n\n\t...\n\n\t/*\n\t * The return code for --no-index imitates diff(1):\n\t * 0 = no changes, 1 = changes, else error\n\t */\n\treturn diff_result_code(&revs->diffopt, 0);\n\nWhich means when `git diff` is run in `--no-index` mode, `--exit-code`\nis implied. However, the documentation for this is missing in\ngit-diff.txt.\n\nAdd a note about how `--exit-code` is implied in the `--no-index`\ndocumentation to cover this documentation blindspot.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\nThanks for the review, Dscho. I guess it slipped my mind that we could\nwrite it this way too. Oops!\n\n Documentation/git-diff.txt | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-diff.txt b/Documentation/git-diff.txt\nindex 72179d993c..56b396ef81 100644\n--- a/Documentation/git-diff.txt\n+++ b/Documentation/git-diff.txt\n@@ -36,7 +36,7 @@ two blob objects, or changes between two files on disk.\n \trunning the command in a working tree controlled by Git and\n \tat least one of the paths points outside the working tree,\n \tor when running the command outside a working tree\n-\tcontrolled by Git.\n+\tcontrolled by Git. This form implies `--no-exit`.\n \n 'git diff' [<options>] --cached [<commit>] [--] [<path>...]::\n \n-- \n2.24.0.rc0.197.g0926ab8072\n\n"},{"id":"385131","messageId":"xmqqftjb3rz7.fsf@gitster-ct.c.googlers.com","threadId":"52146","inReplyTo":"nycvar.QRO.7.76.6.1910291405090.46@tvgsbejvaqbjf.bet","subject":"Re: [PATCH] git-diff.txt: document return code of `--no-index`","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-10-30T02:08:28Z","receivedAt":"2019-10-30T02:08:33Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n>> @@ -36,7 +36,10 @@ two blob objects, or changes between two files on disk.\n>>  \trunning the command in a working tree controlled by Git and\n>>  \tat least one of the paths points outside the working tree,\n>>  \tor when running the command outside a working tree\n>> -\tcontrolled by Git.\n>> +\tcontrolled by Git. With `--no-index`,\n>> +\tthe program exits with codes similar to diff(1). That is, it\n>> +\texits with 1 if there were differences and 0 means no\n>> +\tdifferences.\n>\n> ... a shorter alternative would be to state: This implies `--exit-code`.\n\nYup, that is great.  Short and to the point.\n"},{"id":"385153","messageId":"4548d037-3fc5-b625-b7f9-646392392d0c@gmail.com","threadId":"52146","inReplyTo":"ed9f16c30a0f3852abaf0053d8c2b4a0ecd12f01.1572367897.git.liu.denton@gmail.com","subject":"Re: [PATCH v2] git-diff.txt: document return code of `--no-index`","fromName":"Phillip Wood","fromEmail":"phillip.wood123@gmail.com","sentAt":"2019-10-30T10:11:08Z","receivedAt":"2019-10-30T10:11:13Z","isPatch":true,"sender":{"key":"phillip.wood@dunelm.org.uk","avatar":null},"body":"Hi Denton\n\nThe description is good, but the patch has a typo\n\nOn 29/10/2019 16:54, Denton Liu wrote:\n> Within diff_no_index(), we have the following:\n> \n> \trevs->diffopt.flags.exit_with_status = 1;\n> \n> \t...\n> \n> \t/*\n> \t * The return code for --no-index imitates diff(1):\n> \t * 0 = no changes, 1 = changes, else error\n> \t */\n> \treturn diff_result_code(&revs->diffopt, 0);\n> \n> Which means when `git diff` is run in `--no-index` mode, `--exit-code`\n> is implied. However, the documentation for this is missing in\n> git-diff.txt.\n> \n> Add a note about how `--exit-code` is implied in the `--no-index`\n> documentation to cover this documentation blindspot.\n> \n> Signed-off-by: Denton Liu <liu.denton@gmail.com>\n> ---\n> Thanks for the review, Dscho. I guess it slipped my mind that we could\n> write it this way too. Oops!\n> \n>   Documentation/git-diff.txt | 2 +-\n>   1 file changed, 1 insertion(+), 1 deletion(-)\n> \n> diff --git a/Documentation/git-diff.txt b/Documentation/git-diff.txt\n> index 72179d993c..56b396ef81 100644\n> --- a/Documentation/git-diff.txt\n> +++ b/Documentation/git-diff.txt\n> @@ -36,7 +36,7 @@ two blob objects, or changes between two files on disk.\n>   \trunning the command in a working tree controlled by Git and\n>   \tat least one of the paths points outside the working tree,\n>   \tor when running the command outside a working tree\n> -\tcontrolled by Git.\n> +\tcontrolled by Git. This form implies `--no-exit`.\n\ns/--no-exit/--exit-code/\n\nBest Wishes\n\nPhillip\n\n>   \n>   'git diff' [<options>] --cached [<commit>] [--] [<path>...]::\n>   \n> \n"},{"id":"385167","messageId":"381b2ca134ffa2f370c3882631dbaf3d591530dc.1572458622.git.liu.denton@gmail.com","threadId":"52146","inReplyTo":"ed9f16c30a0f3852abaf0053d8c2b4a0ecd12f01.1572367897.git.liu.denton@gmail.com","subject":"[PATCH v3] git-diff.txt: document return code of `--no-index`","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-30T18:06:07Z","receivedAt":"2019-10-30T18:06:12Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Within diff_no_index(), we have the following:\n\n\trevs->diffopt.flags.exit_with_status = 1;\n\n\t...\n\n\t/*\n\t * The return code for --no-index imitates diff(1):\n\t * 0 = no changes, 1 = changes, else error\n\t */\n\treturn diff_result_code(&revs->diffopt, 0);\n\nWhich means when `git diff` is run in `--no-index` mode, `--exit-code`\nis implied. However, the documentation for this is missing in\ngit-diff.txt.\n\nAdd a note about how `--exit-code` is implied in the `--no-index`\ndocumentation to cover this documentation blindspot.\n\nSigned-off-by: Denton Liu <liu.denton@gmail.com>\n---\nThanks for catching the typo, Phillip. I can't believe I missed that in\nsuch a simple patch.\n\nRange-diff against v2:\n1:  ed9f16c30a ! 1:  381b2ca134 git-diff.txt: document return code of `--no-index`\n    @@ Documentation/git-diff.txt: two blob objects, or changes between two files on di\n      \tat least one of the paths points outside the working tree,\n      \tor when running the command outside a working tree\n     -\tcontrolled by Git.\n    -+\tcontrolled by Git. This form implies `--no-exit`.\n    ++\tcontrolled by Git. This form implies `--exit-code`.\n      \n      'git diff' [<options>] --cached [<commit>] [--] [<path>...]::\n      \n\n Documentation/git-diff.txt | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/Documentation/git-diff.txt b/Documentation/git-diff.txt\nindex 72179d993c..37781cf175 100644\n--- a/Documentation/git-diff.txt\n+++ b/Documentation/git-diff.txt\n@@ -36,7 +36,7 @@ two blob objects, or changes between two files on disk.\n \trunning the command in a working tree controlled by Git and\n \tat least one of the paths points outside the working tree,\n \tor when running the command outside a working tree\n-\tcontrolled by Git.\n+\tcontrolled by Git. This form implies `--exit-code`.\n \n 'git diff' [<options>] --cached [<commit>] [--] [<path>...]::\n \n-- \n2.24.0.rc1.251.gd52a1e41a1\n\n"},{"id":"385186","messageId":"nycvar.QRO.7.76.6.1910302302060.46@tvgsbejvaqbjf.bet","threadId":"52146","inReplyTo":"4548d037-3fc5-b625-b7f9-646392392d0c@gmail.com","subject":"Re: [PATCH v2] git-diff.txt: document return code of `--no-index`","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2019-10-30T22:02:49Z","receivedAt":"2019-10-30T22:03:13Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi Phillip,\n\nOn Wed, 30 Oct 2019, Phillip Wood wrote:\n\n> Hi Denton\n>\n> The description is good, but the patch has a typo\n>\n> On 29/10/2019 16:54, Denton Liu wrote:\n> > Within diff_no_index(), we have the following:\n> >\n> >  revs->diffopt.flags.exit_with_status = 1;\n> >\n> >  ...\n> >\n> >  /*\n> >   * The return code for --no-index imitates diff(1):\n> >   * 0 = no changes, 1 = changes, else error\n> >   */\n> >  return diff_result_code(&revs->diffopt, 0);\n> >\n> > Which means when `git diff` is run in `--no-index` mode, `--exit-code`\n> > is implied. However, the documentation for this is missing in\n> > git-diff.txt.\n> >\n> > Add a note about how `--exit-code` is implied in the `--no-index`\n> > documentation to cover this documentation blindspot.\n> >\n> > Signed-off-by: Denton Liu <liu.denton@gmail.com>\n> > ---\n> > Thanks for the review, Dscho. I guess it slipped my mind that we could\n> > write it this way too. Oops!\n> >\n> >   Documentation/git-diff.txt | 2 +-\n> >   1 file changed, 1 insertion(+), 1 deletion(-)\n> >\n> > diff --git a/Documentation/git-diff.txt b/Documentation/git-diff.txt\n> > index 72179d993c..56b396ef81 100644\n> > --- a/Documentation/git-diff.txt\n> > +++ b/Documentation/git-diff.txt\n> > @@ -36,7 +36,7 @@ two blob objects, or changes between two files on disk.\n> >    running the command in a working tree controlled by Git and\n> >    at least one of the paths points outside the working tree,\n> >    or when running the command outside a working tree\n> > -\tcontrolled by Git.\n> > +\tcontrolled by Git. This form implies `--no-exit`.\n>\n> s/--no-exit/--exit-code/\n\nOh wow. Did I really type `--no-exit` when I meant `--exit-code`? I\nguess I did. What a serious Freudian.\n\nThanks for pointing it out.\n\nCiao,\nDscho\n\n>\n> Best Wishes\n>\n> Phillip\n>\n> >\n> >   'git diff' [<options>] --cached [<commit>] [--] [<path>...]::\n> >\n> >\n>\n"},{"id":"385188","messageId":"20191030221245.GA44961@generichostname","threadId":"52146","inReplyTo":"nycvar.QRO.7.76.6.1910302302060.46@tvgsbejvaqbjf.bet","subject":"Re: [PATCH v2] git-diff.txt: document return code of `--no-index`","fromName":"Denton Liu","fromEmail":"liu.denton@gmail.com","sentAt":"2019-10-30T22:12:45Z","receivedAt":"2019-10-30T22:12:51Z","isPatch":true,"sender":{"key":"liu.denton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/9620836?v=4"},"body":"Hi Dscho,\n\nOn Wed, Oct 30, 2019 at 11:02:49PM +0100, Johannes Schindelin wrote:\n> > > diff --git a/Documentation/git-diff.txt b/Documentation/git-diff.txt\n> > > index 72179d993c..56b396ef81 100644\n> > > --- a/Documentation/git-diff.txt\n> > > +++ b/Documentation/git-diff.txt\n> > > @@ -36,7 +36,7 @@ two blob objects, or changes between two files on disk.\n> > >    running the command in a working tree controlled by Git and\n> > >    at least one of the paths points outside the working tree,\n> > >    or when running the command outside a working tree\n> > > -\tcontrolled by Git.\n> > > +\tcontrolled by Git. This form implies `--no-exit`.\n> >\n> > s/--no-exit/--exit-code/\n> \n> Oh wow. Did I really type `--no-exit` when I meant `--exit-code`? I\n> guess I did. What a serious Freudian.\n\nNah, you're still good. The error is all mine. I wasn't paying attention\nwhen I rerolled the patch so I copied your text wrong. You initial\nsuggestion was correct.\n\n-Denton\n\n> \n> Thanks for pointing it out.\n> \n> Ciao,\n> Dscho\n"},{"id":"385294","messageId":"xmqq4kzm6he0.fsf@gitster-ct.c.googlers.com","threadId":"52146","inReplyTo":"381b2ca134ffa2f370c3882631dbaf3d591530dc.1572458622.git.liu.denton@gmail.com","subject":"Re: [PATCH v3] git-diff.txt: document return code of `--no-index`","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2019-11-02T04:17:59Z","receivedAt":"2019-11-02T04:18:07Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Denton Liu <liu.denton@gmail.com> writes:\n\n> Add a note about how `--exit-code` is implied in the `--no-index`\n> documentation to cover this documentation blindspot.\n>\n> Signed-off-by: Denton Liu <liu.denton@gmail.com>\n> ---\n> Thanks for catching the typo, Phillip. I can't believe I missed that in\n> such a simple patch.\n\nThanks all.  I can believe that I missed that while reading v2 ;-)\nI'll try to do better next time.\n\nQueued.\n"}]}