git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Erwan Mathoniere <erwan.mathoniere@grenoble-inp.org>
Date
Jun 7, 2016, 12:54 UTC
Message-ID
<22613f02-06b8-9f5f-fd92-15df3ca3a34f@grenoble-inp.org>
In-Reply-To
<vpqeg89bhqt.fsf@anie.imag.fr>
On 07/06/2016 09:06, Matthieu Moy wrote:
Show 25 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Matthieu Moy <Matthieu.Moy@grenoble-inp.fr> writes:
>>
>>>> +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.

Previous: Matthieu MoyNext: Erwan Mathoniere
Message 8 of 12 in “pull: set-upstream implementation”
  1. pull: set-upstream implementationErwan Mathoniere, May 25, 2016
  2. Junio C HamanoMay 25, 2016
  3. Erwan MathoniereMay 29, 2016
  4. pull: add --set-upstreamErwan Mathoniere, Jun 6, 2016
  5. Matthieu MoyJun 6, 2016
  6. Junio C HamanoJun 6, 2016
  7. Matthieu MoyJun 7, 2016
  8. Erwan MathoniereJun 7, 2016
  9. Erwan MathoniereJun 7, 2016
  10. Erwan MathoniereJun 7, 2016
  11. Philip OakleyJun 6, 2016
  12. Erwan MathoniereJun 7, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.