git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Iustin Pop <iusty@k1024.org>
To: git@vger.kernel.org
Cc: Iustin Pop <iusty@k1024.org>
Subject: [PATCH 1/2] Add a quiet option to git merge
Date: Sun,  9 Mar 2008 00:52:35 +0100	[thread overview]
Message-ID: <1205020356-6682-2-git-send-email-iusty@k1024.org> (raw)
In-Reply-To: <1205020356-6682-1-git-send-email-iusty@k1024.org>

Currently it's not possible to do quiet merges in case of no changes
because git merge always outputs the 'Already up to date' message.

This small patch adds a quiet option to git merge that in this case will
skip the output of this message.
---
 Documentation/git-merge.txt     |    2 +-
 Documentation/merge-options.txt |    4 ++++
 git-merge.sh                    |   19 +++++++++++++------
 3 files changed, 18 insertions(+), 7 deletions(-)

diff --git a/Documentation/git-merge.txt b/Documentation/git-merge.txt
index c136b10..0c4cd19 100644
--- a/Documentation/git-merge.txt
+++ b/Documentation/git-merge.txt
@@ -9,7 +9,7 @@ git-merge - Join two or more development histories together
 SYNOPSIS
 --------
 [verse]
-'git-merge' [-n] [--summary] [--no-commit] [--squash] [-s <strategy>]...
+'git-merge' [-n] [-q] [--summary] [--no-commit] [--squash] [-s <strategy>]...
 	[-m <msg>] <remote> <remote>...
 'git-merge' <msg> HEAD <remote>...
 
diff --git a/Documentation/merge-options.txt b/Documentation/merge-options.txt
index 9f1fc82..dbedf40 100644
--- a/Documentation/merge-options.txt
+++ b/Documentation/merge-options.txt
@@ -5,6 +5,10 @@
 -n, \--no-summary::
 	Do not show diffstat at the end of the merge.
 
+-q, \--quiet::
+	Supress the 'Already up to date' message if no merge is
+	needed.
+
 --no-commit::
 	Perform the merge but pretend the merge failed and do
 	not autocommit, to give the user a chance to inspect and
diff --git a/git-merge.sh b/git-merge.sh
index 7dbbb1d..625457e 100755
--- a/git-merge.sh
+++ b/git-merge.sh
@@ -15,6 +15,7 @@ commit               perform a commit if the merge sucesses (default)
 ff                   allow fast forward (default)
 s,strategy=          merge strategy to use
 m,message=           message to be used for the merge commit (if any)
+q,quiet              suppress some default messages
 "
 
 SUBDIRECTORY_OK=Yes
@@ -38,6 +39,7 @@ use_strategies=
 allow_fast_forward=t
 allow_trivial_merge=t
 squash= no_commit=
+quiet=
 
 dropsave() {
 	rm -f -- "$GIT_DIR/MERGE_HEAD" "$GIT_DIR/MERGE_MSG" \
@@ -59,12 +61,15 @@ restorestate() {
 }
 
 finish_up_to_date () {
-	case "$squash" in
-	t)
-		echo "$1 (nothing to squash)" ;;
-	'')
-		echo "$1" ;;
-	esac
+	if test -z "$quiet"
+	then
+		case "$squash" in
+		t)
+			echo "$1 (nothing to squash)" ;;
+		'')
+			echo "$1" ;;
+		esac
+	fi
 	dropsave
 }
 
@@ -182,6 +187,8 @@ parse_config () {
 			merge_msg="$1"
 			have_message=t
 			;;
+		-q|--quiet)
+			quiet=t ;;
 		--)
 			shift
 			break ;;
-- 
1.5.4.3


  reply	other threads:[~2008-03-08 23:53 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-08 23:52 Improve git pull --quiet behaviour Iustin Pop
2008-03-08 23:52 ` Iustin Pop [this message]
2008-03-09 12:18   ` [PATCH] Add a quiet option to git merge Iustin Pop
2008-03-08 23:52 ` [PATCH 2/2] Fix git pull handling of the quiet option Iustin Pop
2008-03-09  4:04   ` Junio C Hamano
2008-03-09 10:31     ` Iustin Pop
2008-03-09 22:31     ` [PATCH] " Iustin Pop

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1205020356-6682-2-git-send-email-iusty@k1024.org \
    --to=iusty@k1024.org \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).