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

Re: [PATCHv3] checkout: do not mention detach advice for explicit --detach option

From
Jeff King <peff@peff.net>
Date
Aug 12, 2016, 15:43 UTC
Message-ID
<20160812154331.y2z6pv2w6cwsdsqw@sigill.intra.peff.net>
In-Reply-To
<20160812153744.15045-1-sbeller@google.com>
On Fri, Aug 12, 2016 at 08:37:44AM -0700, Stefan Beller wrote:
Show 6 quoted lines
> > Is there a reason for not unsetting `advice.detachedHead` at the
> > end of the test?
> 
> done
> 
> I did not consider to clean up after myself... what a selfish world!
The right way to do it is:
  test_config advice.detachedHead false &&
  ...

so that the cleanup runs whether or not you may it to the end of the script.

Show 13 quoted lines
> +test_expect_success 'no advice given for explicit detached head state' '
> +	git config advice.detachedHead false &&
> +	git checkout child &&
> +	git checkout --detach HEAD >expect &&
> +	git config advice.detachedHead true &&
> +	git checkout child &&
> +	git checkout --detach HEAD >actual &&
> +	test_cmp expect actual &&
> +	git checkout child &&
> +	git checkout HEAD >actual &&
> +	! test_cmp expect actual &&
> +	git config --unset advice.detachedHead
> +'

Hmm. Using "!test_cmp" seems weird to me, just because it would falsely claim success if something else unexpected changes. Our usual method for making sure some particular output does not appear is "test_i18ngrep" with a liberal pattern.

-Peff
Previous: Stefan BellerNext: Stefan Beller
Message 2 of 5 in “[PATCHv3] checkout: do not mention detach advice for explicit --detach option”
  1. Stefan BellerAug 12, 2016
  2. Jeff KingAug 12, 2016
  3. Stefan BellerAug 12, 2016
  4. Jeff KingAug 12, 2016
  5. Junio C HamanoAug 12, 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.