Thread (1 message) 1 message, 1 author, 2016-06-15

Re: [PATCH 3/7] t5528-push-default.sh: add helper functions

From: Matthieu Moy <hidden>
Date: 2016-06-15 22:53:39

Junio C Hamano [off-list ref] 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.
quoted
+	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 :-(.
quoted
 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/
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help