Re: [RFC/PATCH v2] pull: add --set-upstream

2 messages, 2 authors, 2016-06-16 · open the first message on its own page

Re: [RFC/PATCH v2] pull: add --set-upstream

From: Matthieu Moy <hidden>
Date: 2016-06-16 02:19:46

Junio C Hamano [off-list ref] writes:
Matthieu Moy [off-list ref] writes:
quoted
quoted
+test_config_unchanged () {
+	git config --list --local >original
+	"$@"
+	git config --list --local >modified
+	test_cmp original modified
+}
The test passes if "$@" fails. You should &&-chain the lines here to
catch things like crashes or unexpected "exit 1" in git.
That is true, but allowing "$@" failure may be deliberate. 
I don't think so:

+test_expect_success 'pull -u should not work when merging unrelated histories' '
+	git checkout master &&
+	test_config_unchanged test_must_fail git pull -u step_parent master
+'

;-)

-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/

Re: [RFC/PATCH v2] pull: add --set-upstream

From: Erwan Mathoniere <hidden>
Date: 2016-06-16 02:19:47


On 07/06/2016 09:06, Matthieu Moy wrote:
Junio C Hamano [off-list ref] writes:
quoted
Matthieu Moy [off-list ref] writes:
quoted
quoted
+test_config_unchanged () {
+	git config --list --local >original
+	"$@"
+	git config --list --local >modified
+	test_cmp original modified
+}
The test passes if "$@" fails. You should &&-chain the lines here to
catch things like crashes or unexpected "exit 1" in git.
That is true, but allowing "$@" failure may be deliberate.
I don't think so:

+test_expect_success 'pull -u should not work when merging unrelated histories' '
+	git checkout master &&
+	test_config_unchanged test_must_fail git pull -u step_parent master
+'

;-)
When writing `test_config_unchanged` procedure, I wanted to return the 
comparison even if "$@" failed. But it's indeed not consistent with the 
way I wrote the tests.

Adding "&&" between instructions and using `test_must_fail` when calling 
the procedure is clearer and more logical.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help