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

2013-06-24 Thread Johan Herland
On Mon, Jun 24, 2013 at 6:33 AM, Junio C Hamano gits...@pobox.com wrote:
 From: Ramkumar Ramachandra artag...@gmail.com

 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
 Signed-off-by: Junio C Hamano gits...@pobox.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 69ce6bf..db58e7f 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 

Isn't  ${3:-repo1} a bashism?

 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-721-g0a353d3

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



-- 
Johan Herland, jo...@herland.net
www.herland.net
--
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 4/6] t/t5528-push-default: generalize test_push_*

2013-06-24 Thread Junio C Hamano
Johan Herland jo...@herland.net writes:

 +   git --git-dir=${3:-repo1} log -1 --format='%h %s' $2 actual 

 Isn't  ${3:-repo1} a bashism?

I do not think so.  But now I looked at it again, I think I would
use ${3-repo1} form in this case myself.  No caller passes an empty
string to the third place.
--
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 4/6] t/t5528-push-default: generalize test_push_*

2013-06-24 Thread Johan Herland
On Mon, Jun 24, 2013 at 9:28 AM, Junio C Hamano gits...@pobox.com wrote:
 Johan Herland jo...@herland.net writes:

 +   git --git-dir=${3:-repo1} log -1 --format='%h %s' $2 actual 

 Isn't  ${3:-repo1} a bashism?

 I do not think so.  But now I looked at it again, I think I would
 use ${3-repo1} form in this case myself.  No caller passes an empty
 string to the third place.

Ok, I have to admit that I'm not at all sure where the line between sh
and bash goes when it comes to ${magic}... Is there any good
documentation on what is in sh and what is not?

...Johan



-- 
Johan Herland, jo...@herland.net
www.herland.net
c
--
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 4/6] t/t5528-push-default: generalize test_push_*

2013-06-24 Thread Eric Sunshine
On Mon, Jun 24, 2013 at 4:33 AM, Johan Herland jo...@herland.net wrote:
 On Mon, Jun 24, 2013 at 9:28 AM, Junio C Hamano gits...@pobox.com wrote:
 Johan Herland jo...@herland.net writes:

 +   git --git-dir=${3:-repo1} log -1 --format='%h %s' $2 actual 

 Isn't  ${3:-repo1} a bashism?

 I do not think so.  But now I looked at it again, I think I would
 use ${3-repo1} form in this case myself.  No caller passes an empty
 string to the third place.

 Ok, I have to admit that I'm not at all sure where the line between sh
 and bash goes when it comes to ${magic}... Is there any good
 documentation on what is in sh and what is not?

POSIX: 
http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02
--
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 4/6] t/t5528-push-default: generalize test_push_*

2013-06-24 Thread Johan Herland
On Mon, Jun 24, 2013 at 10:44 AM, Eric Sunshine sunsh...@sunshineco.com wrote:
 On Mon, Jun 24, 2013 at 4:33 AM, Johan Herland jo...@herland.net wrote:
 On Mon, Jun 24, 2013 at 9:28 AM, Junio C Hamano gits...@pobox.com wrote:
 Johan Herland jo...@herland.net writes:

 +   git --git-dir=${3:-repo1} log -1 --format='%h %s' $2 actual 
 

 Isn't  ${3:-repo1} a bashism?

 I do not think so.  But now I looked at it again, I think I would
 use ${3-repo1} form in this case myself.  No caller passes an empty
 string to the third place.

 Ok, I have to admit that I'm not at all sure where the line between sh
 and bash goes when it comes to ${magic}... Is there any good
 documentation on what is in sh and what is not?

 POSIX: 
 http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html#tag_18_06_02

Thanks! Learn something new every day, I guess. :)

...Johan

-- 
Johan Herland, jo...@herland.net
www.herland.net
--
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 4/6] t/t5528-push-default: generalize test_push_*

2013-06-24 Thread Junio C Hamano
Junio C Hamano gits...@pobox.com writes:

 Johan Herland jo...@herland.net writes:

 +   git --git-dir=${3:-repo1} log -1 --format='%h %s' $2 actual 

 Isn't  ${3:-repo1} a bashism?

 I do not think so.  But now I looked at it again, I think I would
 use ${3-repo1} form in this case myself.  No caller passes an empty
 string to the third place.

Actually, because the caller blindly does this:

# $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 $3
}

where it should be doing something like this:

check_pushed_commit HEAD $2 ${3+$3}

if it wants $3 to be optional, ${3:-repo1} is needed here to work
it around.

So I'll leave it as-is for now.


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