[PATCH 5/6] t/t5528-push-default: generalize test_push_*

2013-06-19 Thread Ramkumar Ramachandra
The setup creates two bare repositories: repo1 and repo2, but
test_push_commit() hard-codes checking in repo1 for the actual output.
Generalize it and its caller, test_push_success(), to optionally accept
a third argument to specify the name of the repository to check for
actual output.  We will use this in the next patch.

Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
---
 t/t5528-push-default.sh | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/t/t5528-push-default.sh b/t/t5528-push-default.sh
index e54dd02..b599186 100755
--- a/t/t5528-push-default.sh
+++ b/t/t5528-push-default.sh
@@ -15,17 +15,19 @@ test_expect_success 'setup bare remotes' '
 
 # $1 = local revision
 # $2 = remote revision (tested to be equal to the local one)
+# $3 = [optional] repo to check for actual output (repo1 by default)
 check_pushed_commit () {
git log -1 --format='%h %s' $1 expect 
-   git --git-dir=repo1 log -1 --format='%h %s' $2 actual 
+   git --git-dir=${3:-repo1} log -1 --format='%h %s' $2 actual 
test_cmp expect actual
 }
 
 # $1 = push.default value
 # $2 = expected target branch for the push
+# $3 = [optional] repo to check for actual output (repo1 by default)
 test_push_success () {
git -c push.default=$1 push 
-   check_pushed_commit HEAD $2
+   check_pushed_commit HEAD $2 $3
 }
 
 # $1 = push.default value
-- 
1.8.3.1.454.g30263f3.dirty

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


Re: [PATCH 5/6] t/t5528-push-default: generalize test_push_*

2013-06-19 Thread Junio C Hamano
Ramkumar Ramachandra artag...@gmail.com writes:

 The setup creates two bare repositories: repo1 and repo2, but
 test_push_commit() hard-codes checking in repo1 for the actual output.
 Generalize it and its caller, test_push_success(), to optionally accept
 a third argument to specify the name of the repository to check for
 actual output.  We will use this in the next patch.

 Signed-off-by: Ramkumar Ramachandra artag...@gmail.com
 ---

Makes sense.

  t/t5528-push-default.sh | 6 --
  1 file changed, 4 insertions(+), 2 deletions(-)

 diff --git a/t/t5528-push-default.sh b/t/t5528-push-default.sh
 index e54dd02..b599186 100755
 --- a/t/t5528-push-default.sh
 +++ b/t/t5528-push-default.sh
 @@ -15,17 +15,19 @@ test_expect_success 'setup bare remotes' '
  
  # $1 = local revision
  # $2 = remote revision (tested to be equal to the local one)
 +# $3 = [optional] repo to check for actual output (repo1 by default)
  check_pushed_commit () {
   git log -1 --format='%h %s' $1 expect 
 - git --git-dir=repo1 log -1 --format='%h %s' $2 actual 
 + git --git-dir=${3:-repo1} log -1 --format='%h %s' $2 actual 
   test_cmp expect actual
  }
  
  # $1 = push.default value
  # $2 = expected target branch for the push
 +# $3 = [optional] repo to check for actual output (repo1 by default)
  test_push_success () {
   git -c push.default=$1 push 
 - check_pushed_commit HEAD $2
 + check_pushed_commit HEAD $2 $3
  }
  
  # $1 = push.default value
--
To unsubscribe from this list: send the line unsubscribe git in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html