{"thread":{"id":"38977","subject":"[BUG] 'git merge --quiet' is not always quiet","startedAt":"2015-04-02T12:42:30Z","lastAt":"2015-04-02T21:39:52Z","messageCount":2,"participants":["Carl Mäsak","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"258857","messageId":"CADwUm8do1+2aAqSnwMmViTCwA9jpAZM21DtRP9YiniVtCenFKw@mail.gmail.com","threadId":"38977","inReplyTo":null,"subject":"[BUG] 'git merge --quiet' is not always quiet","fromName":"Carl Mäsak","fromEmail":"cmasak@gmail.com","sentAt":"2015-04-02T12:42:30Z","receivedAt":"2015-04-02T12:42:30Z","isPatch":false,"sender":{"key":"cmasak@gmail.com","avatar":null},"body":"In the following session, a 'git merge' command shows some output even\nwith the '--quiet' flag supplied.\n\n    ~/tmp $ git init example\n    Initialized empty Git repository in /tmp/example/.git/\n    ~/tmp $ cd example/\n    ~/tmp/example $ git commit --allow-empty -m'initial commit'\n    [master (root-commit) a7329b5] initial commit\n    ~/tmp/example $ git checkout -b b1\n    Switched to a new branch 'b1'\n    ~/tmp/example $ git commit --allow-empty -m'commit on branch'\n    [b1 d15e5ac] commit on branch\n    ~/tmp/example $ git checkout master\n    Switched to branch 'master'\n    ~/tmp/example $ git merge --quiet --no-ff --no-edit b1\n    Already up-to-date!\n    ~/tmp/example $\n\nMy expectation is that '--quiet' would suppress all output, even this one.\n\nI'm on Git 1.9.1, but I've been informed on IRC that this happens even\non latest.\n\n// Carl\n"},{"id":"258899","messageId":"20150402213952.GB22988@peff.net","threadId":"38977","inReplyTo":"CADwUm8do1+2aAqSnwMmViTCwA9jpAZM21DtRP9YiniVtCenFKw@mail.gmail.com","subject":"Re: [BUG] 'git merge --quiet' is not always quiet","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2015-04-02T21:39:52Z","receivedAt":"2015-04-02T21:39:52Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Apr 02, 2015 at 02:42:30PM +0200, Carl Mäsak wrote:\n\n> In the following session, a 'git merge' command shows some output even\n> with the '--quiet' flag supplied.\n> \n>     ~/tmp $ git init example\n>     Initialized empty Git repository in /tmp/example/.git/\n>     ~/tmp $ cd example/\n>     ~/tmp/example $ git commit --allow-empty -m'initial commit'\n>     [master (root-commit) a7329b5] initial commit\n>     ~/tmp/example $ git checkout -b b1\n>     Switched to a new branch 'b1'\n>     ~/tmp/example $ git commit --allow-empty -m'commit on branch'\n>     [b1 d15e5ac] commit on branch\n>     ~/tmp/example $ git checkout master\n>     Switched to branch 'master'\n>     ~/tmp/example $ git merge --quiet --no-ff --no-edit b1\n>     Already up-to-date!\n>     ~/tmp/example $\n> \n> My expectation is that '--quiet' would suppress all output, even this one.\n\nIt looks like we end up calling into merge-recursive here, but the\n\"--quiet\" flag is not passed down. This patch seems to fix it for me.\n\n-- >8 --\nSubject: merge: pass verbosity flag down to merge-recursive\n\nThis makes \"git merge --quiet\" really quiet when we call\ninto merge-recursive.\n\nNote that we can't just pass our flag down as-is; the two\nparts of the code use different scales. We center at \"0\" as\nnormal for git-merge (with \"--quiet\" giving a negative\nvalue), but merge-recursive uses \"2\" as its center.  This\npatch passes a negative value to merge-recursive rather than\n\"1\", though, as otherwise the user would have to use \"-qqq\"\nto squelch all messages (but the downside is that the user\ncannot distinguish between levels 0-2 if without resorting\nto the GIT_MERGE_VERBOSITY variable).\n\nWe may want to review and renormalize the message severities\nin merge-recursive, but that does not have to happen now.\nThis is at least in improvement in the sense that we are\nrespecting \"--quiet\" at all.\n\nSigned-off-by: Jeff King <peff@peff.net>\n---\n builtin/merge.c | 4 ++++\n 1 file changed, 4 insertions(+)\n\ndiff --git a/builtin/merge.c b/builtin/merge.c\nindex 3b0f8f9..068a83b 100644\n--- a/builtin/merge.c\n+++ b/builtin/merge.c\n@@ -684,6 +684,10 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,\n \t\t\to.subtree_shift = \"\";\n \n \t\to.renormalize = option_renormalize;\n+\t\tif (verbosity < 0)\n+\t\t\to.verbosity = verbosity;\n+\t\telse if (verbosity > 0)\n+\t\t\to.verbosity += verbosity;\n \t\to.show_rename_progress =\n \t\t\tshow_progress == -1 ? isatty(2) : show_progress;\n \n-- \n2.4.0.rc0.363.gf9f328b\n"}]}