{"thread":{"id":"28887","subject":"git log --quiet bug?","startedAt":"2011-11-08T14:36:18Z","lastAt":"2011-11-09T00:59:27Z","messageCount":6,"participants":["Prasad Deshpande","Jeff King","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"179138","messageId":"1320762978.3614.YahooMailNeo@web84005.mail.mud.yahoo.com","threadId":"28887","inReplyTo":null,"subject":"git log --quiet bug?","fromName":"Prasad Deshpande","fromEmail":"prasadgdeshpande@yahoo.com","sentAt":"2011-11-08T14:36:18Z","receivedAt":"2011-11-08T14:36:18Z","isPatch":false,"sender":{"key":"prasadgdeshpande@yahoo.com","avatar":null},"body":"\n\nHi,\n\n  I am new to the list so please let me know if I need to take this question somewhere else.\n\n  I am seeing a bug with git log --quiet. It doesn't seem to be quiet :-). Also I have seen cases where the exit status returned is not correct i.e. its 0 even if there is some output (although I cant seem to reproduce that problem at present).\n\n--------------------------------------------------\n[~/Work/ws/tools-common] git --version\ngit version 1.7.0.4\n\n$ git log origin..HEAD \ncommit 632ff3eed4004ad76b7cd253643c66ce0f9223f1\nAuthor: XXX\nDate:   Tue Nov 8 09:30:31 2011 -0500\n\n    test\n$ git log origin..HEAD --quiet\ncommit 632ff3eed4004ad76b7cd253643c66ce0f9223f1\nAuthor: XXX\nDate:   Tue Nov 8 09:30:31 2011 -0500\n\n    test\n[~/Work/ws/tools-common] echo $?\n1\n--------------------------------------------------\n\n\nthanks\n-prasad\n"},{"id":"179162","messageId":"20111108212930.GA18529@sigill.intra.peff.net","threadId":"28887","inReplyTo":"1320762978.3614.YahooMailNeo@web84005.mail.mud.yahoo.com","subject":"Re: git log --quiet bug?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-11-08T21:29:30Z","receivedAt":"2011-11-08T21:29:30Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Nov 08, 2011 at 06:36:18AM -0800, Prasad Deshpande wrote:\n\n>   I am seeing a bug with git log --quiet. It doesn't seem to be quiet\n> :-). Also I have seen cases where the exit status returned is not\n> correct i.e. its 0 even if there is some output (although I cant seem\n> to reproduce that problem at present).\n\nI think the description of \"--quiet\" in the git-log manpage is\naccidentally inherited by including the diff options. In \"git diff\", it\nstops output and makes the exit code useful for determining whether\nthere were changes. But what does the exit code even mean in the context\nof \"git log\"?\n\nIt does look like there is code in \"git log\" to handle --quiet, and\nconvert it to \"no diff output\" (i.e., like \"-s\"). But it doesn't seem to\ndo anything. If I manually specify a format like \"git log -p --quiet\", I\nstill get output. And if I don't say \"-p\", then I wouldn't get diff\noutput anyway. It does seem to have an impact on other log variants that\nhave output by default (e.g., \"git whatchanged --quiet\" won't show the\nusual raw diffs).\n\nI think we should probably just excise it from the git-log manpage, like\nthis:\n\n-- >8 --\nSubject: [PATCH] docs: don't mention --quiet or --exit-code in git-log(1)\n\nThese are diff-options, but they don't actually make sense\nin the context of log.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n Documentation/diff-options.txt |    2 ++\n 1 files changed, 2 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt\nindex 08b581f..9f7cba2 100644\n--- a/Documentation/diff-options.txt\n+++ b/Documentation/diff-options.txt\n@@ -412,15 +412,17 @@ endif::git-format-patch[]\n --function-context::\n \tShow whole surrounding functions of changes.\n \n ifndef::git-format-patch[]\n+ifndef::git-log[]\n --exit-code::\n \tMake the program exit with codes similar to diff(1).\n \tThat is, it exits with 1 if there were differences and\n \t0 means no differences.\n \n --quiet::\n \tDisable all output of the program. Implies `--exit-code`.\n+endif::git-log[]\n endif::git-format-patch[]\n \n --ext-diff::\n \tAllow an external diff helper to be executed. If you set an\n-- \n1.7.7.2.7.g9f96f\n"},{"id":"179164","messageId":"7v7h3axplq.fsf@alter.siamese.dyndns.org","threadId":"28887","inReplyTo":"20111108212930.GA18529@sigill.intra.peff.net","subject":"Re: git log --quiet bug?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-11-08T21:37:37Z","receivedAt":"2011-11-08T21:37:37Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Thanks, the patch makes sense to me.\n"},{"id":"179168","messageId":"20111108232043.GA21957@sigill.intra.peff.net","threadId":"28887","inReplyTo":"1320791465.67359.YahooMailNeo@web84006.mail.mud.yahoo.com","subject":"Re: git log --quiet bug?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-11-08T23:20:43Z","receivedAt":"2011-11-08T23:20:43Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Nov 08, 2011 at 02:31:05PM -0800, Prasad Deshpande wrote:\n\n> Thanks for your response. I was actually trying to write a script to\n> determine if a workspace has commits which haven't been pushed to the\n> repository. \n> For this I was using the following in a bash script:\n> \n>   ..\n>   git log origin..HEAD --quiet\n>   if [ $? -ne 0 ]\n>   then\n>     echo\n> \n>     echo \"git log shows files committed but not pushed.. ABORTING\"\n>     echo\n>     echo \"************* `pwd` ***************\"\n>     git log origin..HEAD --color --graph --stat\n>     exit 1\n>   fi\n> \n>   What is the recommended way to do this?\n\nTry:\n\n  test -z \"$(git rev-list -1 origin..HEAD)\" &&\n  echo nothing that needs pushing\n\nYou can also use --count to get the exact number, but if you just care\nwhether there is something or nothing, using \"-1\" lets git stop the\ngraph traversal immediately.\n\n-Peff\n"},{"id":"179169","messageId":"7vy5vqw47x.fsf@alter.siamese.dyndns.org","threadId":"28887","inReplyTo":"20111108232043.GA21957@sigill.intra.peff.net","subject":"Re: git log --quiet bug?","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-11-09T00:04:50Z","receivedAt":"2011-11-09T00:04:50Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jeff King <peff@peff.net> writes:\n\n> Try:\n>\n>   test -z \"$(git rev-list -1 origin..HEAD)\" &&\n>   echo nothing that needs pushing\n>\n> You can also use --count to get the exact number, but if you just care\n> whether there is something or nothing, using \"-1\" lets git stop the\n> graph traversal immediately.\n\nDoesn't some variant of \"branch -v\" show the ahead/behind information for\nall branches?\n"},{"id":"179173","messageId":"20111109005927.GA25876@sigill.intra.peff.net","threadId":"28887","inReplyTo":"7vy5vqw47x.fsf@alter.siamese.dyndns.org","subject":"Re: git log --quiet bug?","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2011-11-09T00:59:27Z","receivedAt":"2011-11-09T00:59:27Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Tue, Nov 08, 2011 at 04:04:50PM -0800, Junio C Hamano wrote:\n\n> Jeff King <peff@peff.net> writes:\n> \n> > Try:\n> >\n> >   test -z \"$(git rev-list -1 origin..HEAD)\" &&\n> >   echo nothing that needs pushing\n> >\n> > You can also use --count to get the exact number, but if you just care\n> > whether there is something or nothing, using \"-1\" lets git stop the\n> > graph traversal immediately.\n> \n> Doesn't some variant of \"branch -v\" show the ahead/behind information for\n> all branches?\n\nYeah, but I thought the question was how to figure this out\nprogramatically in a script.\n\n-Peff\n"}]}