Re: [PATCH 3/7] t5528-push-default.sh: add helper functions
- From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
- Date
- Apr 23, 2012, 16:02 UTC
- Message-ID
- <vpqobqil9ml.fsf@bauges.imag.fr>
- In-Reply-To
- <xmqqipgqlass.fsf@junio.mtv.corp.google.com>
Junio C Hamano <gitster@pobox.com> writes:
> Hmph. How is $1 used in the above to make it compare between local and > remote? Does the first one need to have "$1" before " >expect"?
Yes, good catch.
>> + test_must_fail git -c push.default="$1" && > > What subcommand does this run with one-shot override configuration? Do > we need " push" before " &&"?
Right.
Plus the "$1" should have been "$push_default" since we just did a shift.
*sigh* this was supposed not to be a draft :-(.
Show 10 quoted lines
>> test_expect_success '"upstream" does not push on unconfigured remote' ' >> @@ -30,7 +61,7 @@ test_expect_success '"upstream" does not push on unconfigured remote' ' >> test_unconfig branch.master.remote && >> test_config push.default upstream && >> test_commit three && >> - test_must_fail git push >> + test_push_failure upstream master >> ' > > ... and we can use --all not master here, right?
Actually, we can even use --all everywhere. And then, we don't even need the second argument, and we can simplify greatly the function:
# $1 = push.default value
# check that push fails and does not modify any remote branch
test_push_failure () {
git --git-dir=repo1 log --no-walk --format='%h %s' --all >expect &&
test_must_fail git -c push.default="$1" push &&
git --git-dir=repo1 log --no-walk --format='%h %s' --all >actual &&
test_cmp expect actual
}-- Matthieu Moy http://www-verimag.imag.fr/~moy/