{"thread":{"id":"17576","subject":"[BUG] 'git log --quiet' doesn't suppress the output","startedAt":"2009-02-05T02:19:28Z","lastAt":"2009-02-07T07:18:52Z","messageCount":5,"participants":["James Pickens","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"103264","messageId":"885649360902041819k4a168407wc57017e6a1c7d00a@mail.gmail.com","threadId":"17576","inReplyTo":null,"subject":"[BUG] 'git log --quiet' doesn't suppress the output","fromName":"James Pickens","fromEmail":"jepicken@gmail.com","sentAt":"2009-02-05T02:19:28Z","receivedAt":"2009-02-05T02:19:28Z","isPatch":false,"sender":{"key":"jepicken@gmail.com","avatar":null},"body":"The --quiet switch to 'git log' doesn't suppress the output.  It only\ndoes the same as --exit-code.\n\nTested with version 1.6.1.2.\n\nJames\n"},{"id":"103543","messageId":"20090206191146.GC19494@coredump.intra.peff.net","threadId":"17576","inReplyTo":"885649360902041819k4a168407wc57017e6a1c7d00a@mail.gmail.com","subject":"Re: [BUG] 'git log --quiet' doesn't suppress the output","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-02-06T19:11:46Z","receivedAt":"2009-02-06T19:11:46Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, Feb 04, 2009 at 07:19:28PM -0700, James Pickens wrote:\n\n> The --quiet switch to 'git log' doesn't suppress the output.  It only\n> does the same as --exit-code.\n\nIt suppresses the diff output (which is why it supports --quiet at all:\nit is a diff option). So\n\n  git log -p --quiet\n\nlooks just like\n\n  git log\n\nmaking it largely pointless.\n\nIt would probably be trivial to for \"git log\" to see that the quiet\nswitch was given and silence the commit output. But I am having trouble\nenvisioning exactly what that would be useful for (except for being a\nslower version of \"cat /dev/null\"). Care to elaborate?\n\n-Peff\n"},{"id":"103585","messageId":"885649360902062244v715a61b7nf32003c97cc4f707@mail.gmail.com","threadId":"17576","inReplyTo":"20090206191146.GC19494@coredump.intra.peff.net","subject":"Re: [BUG] 'git log --quiet' doesn't suppress the output","fromName":"James Pickens","fromEmail":"jepicken@gmail.com","sentAt":"2009-02-07T06:44:59Z","receivedAt":"2009-02-07T06:44:59Z","isPatch":false,"sender":{"key":"jepicken@gmail.com","avatar":null},"body":"On Fri, Feb 6, 2009 at 12:11 PM, Jeff King <peff@peff.net> wrote:\n> It would probably be trivial to for \"git log\" to see that the quiet\n> switch was given and silence the commit output. But I am having trouble\n> envisioning exactly what that would be useful for (except for being a\n> slower version of \"cat /dev/null\"). Care to elaborate?\n\nI was writing a script, and looking for a way to figure out\nwhether there were any commits in origin/master that aren't in\nmaster (i.e., whether I need to pull before I can push), and 'git\nlog --quiet origin/master..master' was the first thing I thought\nof.\n\nJames\n"},{"id":"103587","messageId":"20090207065602.GA14995@coredump.intra.peff.net","threadId":"17576","inReplyTo":"885649360902062244v715a61b7nf32003c97cc4f707@mail.gmail.com","subject":"Re: [BUG] 'git log --quiet' doesn't suppress the output","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-02-07T06:56:02Z","receivedAt":"2009-02-07T06:56:02Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Fri, Feb 06, 2009 at 11:44:59PM -0700, James Pickens wrote:\n\n> I was writing a script, and looking for a way to figure out\n> whether there were any commits in origin/master that aren't in\n> master (i.e., whether I need to pull before I can push), and 'git\n> log --quiet origin/master..master' was the first thing I thought\n> of.\n\nOK, that does make sense.\n\nIn this case, though, you should be using the \"git rev-list\" plumbing\ninstead of the \"git log\" porcelain for a script. And \"git rev-list\" does\nsupport \"--quiet\", but it doesn't quite do what you want. It silences\nthe output, but the exit code does not depend on whether or not there\nwere any commits in range.\n\nSo you would need a patch for rev-list to support --exit-code to mean\n\"did we see anything?\".\n\nIn the past I have accomplished something similar through:\n\n  git rev-list origin/master..master | wc -l\n\nand checking the result for \"0\" (I think you could even speed things up\nby using \"git rev-list -1\", because you only care about whether there\nare 0 or more than 0 commits, so parsing and writing the other N is\npointless).\n\n-Peff\n"},{"id":"103589","messageId":"885649360902062318n4e51ded0r957f6199ff9afc1a@mail.gmail.com","threadId":"17576","inReplyTo":"20090207065602.GA14995@coredump.intra.peff.net","subject":"Re: [BUG] 'git log --quiet' doesn't suppress the output","fromName":"James Pickens","fromEmail":"jepicken@gmail.com","sentAt":"2009-02-07T07:18:52Z","receivedAt":"2009-02-07T07:18:52Z","isPatch":false,"sender":{"key":"jepicken@gmail.com","avatar":null},"body":"On Fri, Feb 6, 2009 at 11:56 PM, Jeff King <peff@peff.net> wrote:\n> On Fri, Feb 06, 2009 at 11:44:59PM -0700, James Pickens wrote:\n>\n>> I was writing a script, and looking for a way to figure out\n>> whether there were any commits in origin/master that aren't in\n>> master (i.e., whether I need to pull before I can push), and 'git\n>> log --quiet origin/master..master' was the first thing I thought\n>> of.\n>\n> OK, that does make sense.\n>\n> In this case, though, you should be using the \"git rev-list\" plumbing\n> instead of the \"git log\" porcelain for a script. And \"git rev-list\" does\n> support \"--quiet\", but it doesn't quite do what you want. It silences\n> the output, but the exit code does not depend on whether or not there\n> were any commits in range.\n\nThanks for the tip; I'll just use rev-list and check if it gave any\noutput.\n\nJames\n"}]}