* [BUG] 'git merge --quiet' is not always quiet
@ 2015-04-02 12:42 Carl Mäsak
2015-04-02 21:39 ` Jeff King
0 siblings, 1 reply; 2+ messages in thread
From: Carl Mäsak @ 2015-04-02 12:42 UTC (permalink / raw
To: git
In the following session, a 'git merge' command shows some output even
with the '--quiet' flag supplied.
~/tmp $ git init example
Initialized empty Git repository in /tmp/example/.git/
~/tmp $ cd example/
~/tmp/example $ git commit --allow-empty -m'initial commit'
[master (root-commit) a7329b5] initial commit
~/tmp/example $ git checkout -b b1
Switched to a new branch 'b1'
~/tmp/example $ git commit --allow-empty -m'commit on branch'
[b1 d15e5ac] commit on branch
~/tmp/example $ git checkout master
Switched to branch 'master'
~/tmp/example $ git merge --quiet --no-ff --no-edit b1
Already up-to-date!
~/tmp/example $
My expectation is that '--quiet' would suppress all output, even this one.
I'm on Git 1.9.1, but I've been informed on IRC that this happens even
on latest.
// Carl
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [BUG] 'git merge --quiet' is not always quiet
2015-04-02 12:42 [BUG] 'git merge --quiet' is not always quiet Carl Mäsak
@ 2015-04-02 21:39 ` Jeff King
0 siblings, 0 replies; 2+ messages in thread
From: Jeff King @ 2015-04-02 21:39 UTC (permalink / raw
To: Carl Mäsak; +Cc: git
On Thu, Apr 02, 2015 at 02:42:30PM +0200, Carl Mäsak wrote:
> In the following session, a 'git merge' command shows some output even
> with the '--quiet' flag supplied.
>
> ~/tmp $ git init example
> Initialized empty Git repository in /tmp/example/.git/
> ~/tmp $ cd example/
> ~/tmp/example $ git commit --allow-empty -m'initial commit'
> [master (root-commit) a7329b5] initial commit
> ~/tmp/example $ git checkout -b b1
> Switched to a new branch 'b1'
> ~/tmp/example $ git commit --allow-empty -m'commit on branch'
> [b1 d15e5ac] commit on branch
> ~/tmp/example $ git checkout master
> Switched to branch 'master'
> ~/tmp/example $ git merge --quiet --no-ff --no-edit b1
> Already up-to-date!
> ~/tmp/example $
>
> My expectation is that '--quiet' would suppress all output, even this one.
It looks like we end up calling into merge-recursive here, but the
"--quiet" flag is not passed down. This patch seems to fix it for me.
-- >8 --
Subject: merge: pass verbosity flag down to merge-recursive
This makes "git merge --quiet" really quiet when we call
into merge-recursive.
Note that we can't just pass our flag down as-is; the two
parts of the code use different scales. We center at "0" as
normal for git-merge (with "--quiet" giving a negative
value), but merge-recursive uses "2" as its center. This
patch passes a negative value to merge-recursive rather than
"1", though, as otherwise the user would have to use "-qqq"
to squelch all messages (but the downside is that the user
cannot distinguish between levels 0-2 if without resorting
to the GIT_MERGE_VERBOSITY variable).
We may want to review and renormalize the message severities
in merge-recursive, but that does not have to happen now.
This is at least in improvement in the sense that we are
respecting "--quiet" at all.
Signed-off-by: Jeff King <peff@peff.net>
---
builtin/merge.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/builtin/merge.c b/builtin/merge.c
index 3b0f8f9..068a83b 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -684,6 +684,10 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
o.subtree_shift = "";
o.renormalize = option_renormalize;
+ if (verbosity < 0)
+ o.verbosity = verbosity;
+ else if (verbosity > 0)
+ o.verbosity += verbosity;
o.show_rename_progress =
show_progress == -1 ? isatty(2) : show_progress;
--
2.4.0.rc0.363.gf9f328b
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-04-02 21:40 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-04-02 12:42 [BUG] 'git merge --quiet' is not always quiet Carl Mäsak
2015-04-02 21:39 ` Jeff King
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).