git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Tuncer Ayaz <tuncer.ayaz@gmail.com>
To: gitster@pobox.com
Cc: git@vger.kernel.org
Subject: [PATCH] Implement rebase -q to fix pull --rebase -q
Date: Wed,  3 Dec 2008 05:06:52 +0100	[thread overview]
Message-ID: <1228277212-5917-1-git-send-email-tuncer.ayaz@gmail.com> (raw)

This is needed on top of the fetch/pull -q/-v changes
to make
$ git pull --rebase -q
as quiet as expected.

Signed-off-by: Tuncer Ayaz <tuncer.ayaz@gmail.com>
---
 git-pull.sh   |    2 +-
 git-rebase.sh |   31 +++++++++++++++++++++++--------
 2 files changed, 24 insertions(+), 9 deletions(-)

diff --git a/git-pull.sh b/git-pull.sh
index 1cac898..57fcee9 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -184,6 +184,6 @@ fi
 merge_name=$(git fmt-merge-msg $log_arg <"$GIT_DIR/FETCH_HEAD") || exit
 test true = "$rebase" &&
 	exec git-rebase $strategy_args --onto $merge_head \
-	${oldremoteref:-$merge_head}
+	$verbosity ${oldremoteref:-$merge_head}
 exec git-merge $no_stat $no_commit $squash $no_ff $log_arg $strategy_args \
 	"$merge_name" HEAD $merge_head $verbosity
diff --git a/git-rebase.sh b/git-rebase.sh
index 023a6dc..bbfdc2e 100755
--- a/git-rebase.sh
+++ b/git-rebase.sh
@@ -3,7 +3,7 @@
 # Copyright (c) 2005 Junio C Hamano.
 #
 
-USAGE='[--interactive | -i] [-v] [--onto <newbase>] <upstream> [<branch>]'
+USAGE='[--interactive | -i] [-q] [-v] [--onto <newbase>] <upstream> [<branch>]'
 LONG_USAGE='git-rebase replaces <branch> with a new branch of the
 same name.  When the --onto option is provided the new branch starts
 out with a HEAD equal to <newbase>, otherwise it is equal to <upstream>
@@ -45,7 +45,7 @@ strategy=recursive
 do_merge=
 dotest="$GIT_DIR"/rebase-merge
 prec=4
-verbose=
+verbosity=1
 git_am_opt=
 
 continue_merge () {
@@ -135,7 +135,10 @@ move_to_original_branch () {
 finish_rb_merge () {
 	move_to_original_branch
 	rm -r "$dotest"
-	echo "All done."
+	if test $verbosity -gt 0
+	then
+		echo "All done."
+	fi
 }
 
 is_interactive () {
@@ -288,8 +291,11 @@ do
 		esac
 		do_merge=t
 		;;
+	-q|--quiet)
+		verbosity=0
+		;;
 	-v|--verbose)
-		verbose=t
+		verbosity=2
 		;;
 	--whitespace=*)
 		git_am_opt="$git_am_opt $1"
@@ -401,11 +407,14 @@ if test "$upstream" = "$onto" && test "$mb" = "$onto" &&
 then
 	# Lazily switch to the target branch if needed...
 	test -z "$switch_to" || git checkout "$switch_to"
-	echo >&2 "Current branch $branch_name is up to date."
+	if test $verbosity -gt 0
+	then
+		echo >&2 "Current branch $branch_name is up to date."
+	fi
 	exit 0
 fi
 
-if test -n "$verbose"
+if test $verbosity -gt 1
 then
 	echo "Changes from $mb to $onto:"
 	# We want color (if set), but no pager
@@ -413,7 +422,10 @@ then
 fi
 
 # Detach HEAD and reset the tree
-echo "First, rewinding head to replay your work on top of it..."
+if test $verbosity -gt 0
+then
+	echo "First, rewinding head to replay your work on top of it..."
+fi
 git checkout -q "$onto^0" || die "could not detach HEAD"
 git update-ref ORIG_HEAD $branch
 
@@ -421,7 +433,10 @@ git update-ref ORIG_HEAD $branch
 # we just fast forwarded.
 if test "$mb" = "$branch"
 then
-	echo >&2 "Fast-forwarded $branch_name to $onto_name."
+	if test $verbosity -gt 0
+	then
+		echo >&2 "Fast-forwarded $branch_name to $onto_name."
+	fi
 	move_to_original_branch
 	exit 0
 fi
-- 
1.6.0.2.GIT

             reply	other threads:[~2008-12-03  4:08 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-03  4:06 Tuncer Ayaz [this message]
2008-12-03  4:09 ` [PATCH] Implement rebase -q to fix pull --rebase -q Tuncer Ayaz
2008-12-03  7:54 ` Junio C Hamano
2008-12-03  8:07   ` Tuncer Ayaz
2008-12-03  8:26     ` Junio C Hamano
2008-12-03  8:35       ` Tuncer Ayaz
2008-12-03 21:14         ` Junio C Hamano
2008-12-03 22:21           ` Tuncer Ayaz

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=1228277212-5917-1-git-send-email-tuncer.ayaz@gmail.com \
    --to=tuncer.ayaz@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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).