# [PATCH] pull: Apply -q and -v options to rebase mode as well

2 messages from 2013-03-15 to 2013-03-17. Participants: Peter Eisentraut, Junio C Hamano.
Thread: https://gitlist.dev/t/33186

## Peter Eisentraut, 2013-03-15 02:26

Subject: [PATCH] pull: Apply -q and -v options to rebase mode as well
Message-ID: <1363314368.14066.3.camel@vanquo.pezone.net>
URL: https://gitlist.dev/e/1363314368.14066.3.camel%40vanquo.pezone.net

```
git pull passed -q and -v only to git merge, but they can be useful for
git rebase as well, so pass them there, too.  In particular, using -q
shuts up the "Already up-to-date." message.  Add test cases to prove it.

Signed-off-by: Peter Eisentraut <peter@eisentraut.org>
---
 git-pull.sh             |    2 +-
 t/t5521-pull-options.sh |   27 +++++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/git-pull.sh b/git-pull.sh
index 266e682..5d97e97 100755
--- a/git-pull.sh
+++ b/git-pull.sh
@@ -279,7 +279,7 @@ fi
 merge_name=$(git fmt-merge-msg $log_arg <"$GIT_DIR/FETCH_HEAD") || exit
 case "$rebase" in
 true)
-	eval="git-rebase $diffstat $strategy_args $merge_args"
+	eval="git-rebase $diffstat $strategy_args $merge_args $verbosity"
 	eval="$eval --onto $merge_head ${oldremoteref:-$merge_head}"
 	;;
 *)
diff --git a/t/t5521-pull-options.sh b/t/t5521-pull-options.sh
index 1b06691..aa31abe 100755
--- a/t/t5521-pull-options.sh
+++ b/t/t5521-pull-options.sh
@@ -19,6 +19,17 @@ test_expect_success 'git pull -q' '
 	test ! -s out)
 '
 
+test_expect_success 'git pull -q --rebase' '
+	mkdir clonedqrb &&
+	(cd clonedqrb && git init &&
+	git pull -q --rebase "../parent" >out 2>err &&
+	test ! -s err &&
+	test ! -s out &&
+	git pull -q --rebase "../parent" >out 2>err &&
+	test ! -s err &&
+	test ! -s out)
+'
+
 test_expect_success 'git pull' '
 	mkdir cloned &&
 	(cd cloned && git init &&
@@ -27,6 +38,14 @@ test_expect_success 'git pull' '
 	test ! -s out)
 '
 
+test_expect_success 'git pull --rebase' '
+	mkdir clonedrb &&
+	(cd clonedrb && git init &&
+	git pull --rebase "../parent" >out 2>err &&
+	test -s err &&
+	test ! -s out)
+'
+
 test_expect_success 'git pull -v' '
 	mkdir clonedv &&
 	(cd clonedv && git init &&
@@ -35,6 +54,14 @@ test_expect_success 'git pull -v' '
 	test ! -s out)
 '
 
+test_expect_success 'git pull -v --rebase' '
+	mkdir clonedvrb &&
+	(cd clonedvrb && git init &&
+	git pull -v --rebase "../parent" >out 2>err &&
+	test -s err &&
+	test ! -s out)
+'
+
 test_expect_success 'git pull -v -q' '
 	mkdir clonedvq &&
 	(cd clonedvq && git init &&
-- 
1.7.10.4

```

## Junio C Hamano, 2013-03-17 04:53

Subject: Re: [PATCH] pull: Apply -q and -v options to rebase mode as well
Message-ID: <7vip4qtymy.fsf@alter.siamese.dyndns.org>
URL: https://gitlist.dev/e/7vip4qtymy.fsf%40alter.siamese.dyndns.org
In-Reply-To: <1363314368.14066.3.camel@vanquo.pezone.net>

```
Peter Eisentraut <peter@eisentraut.org> writes:

> git pull passed -q and -v only to git merge, but they can be useful for
> git rebase as well, so pass them there, too.  In particular, using -q
> shuts up the "Already up-to-date." message.  Add test cases to prove it.
>
> Signed-off-by: Peter Eisentraut <peter@eisentraut.org>
> ---

Looks quite straight-forward.

I wouldn't call our test cases "proving" anything, though.  The
reason we add tests is to make sure that others who touch the code
later will not break the feature you add today by documenting the
behaviour we expect out of our code.

> diff --git a/t/t5521-pull-options.sh b/t/t5521-pull-options.sh
> index 1b06691..aa31abe 100755
> --- a/t/t5521-pull-options.sh
> +++ b/t/t5521-pull-options.sh
> @@ -19,6 +19,17 @@ test_expect_success 'git pull -q' '
>  	test ! -s out)
>  '
>  
> +test_expect_success 'git pull -q --rebase' '
> +	mkdir clonedqrb &&
> +	(cd clonedqrb && git init &&
> +	git pull -q --rebase "../parent" >out 2>err &&
> +	test ! -s err &&
> +	test ! -s out &&
> +	git pull -q --rebase "../parent" >out 2>err &&
> +	test ! -s err &&
> +	test ! -s out)
> +'

Pulling twice is a good thing here, to see how it behaves when there
is something to be fetched, and when you are up to date.  I think it
is a good idea to add it to the normal 'pull -q' test.

Thanks.

```
