[PATCH] Implement rebase -q to fix pull --rebase -q

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux