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

Re: [PATCH] branch_get_push: do not segfault when HEAD is detached

From
Kyle Meyer <kyle@kyleam.com>
Date
Jan 7, 2017, 01:09 UTC
Message-ID
<87inprllpv.fsf@kyleam.com>
In-Reply-To
<alpine.DEB.2.20.1701061438300.3469@virtualbox>
Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
[...]
Show 28 quoted lines
>> +test_expect_success 'resolving @{push} fails with a detached HEAD' '
>> +	git checkout HEAD^{} &&
>
> I seem to recall that we prefer HEAD^0 over HEAD^{} and the existing
> scripts seem to agree with me:
>
> $ git grep -c HEAD^0 junio/pu -- t/
> junio/pu:t/t1450-fsck.sh:1
> junio/pu:t/t1507-rev-parse-upstream.sh:2
> junio/pu:t/t2020-checkout-detach.sh:5
> junio/pu:t/t3200-branch.sh:1
> junio/pu:t/t3203-branch-output.sh:3
> junio/pu:t/t3400-rebase.sh:1
> junio/pu:t/t3404-rebase-interactive.sh:1
> junio/pu:t/t5407-post-rewrite-hook.sh:2
> junio/pu:t/t5505-remote.sh:1
> junio/pu:t/t5510-fetch.sh:1
> junio/pu:t/t5533-push-cas.sh:3
> junio/pu:t/t6035-merge-dir-to-symlink.sh:3
> junio/pu:t/t7201-co.sh:2
> junio/pu:t/t7402-submodule-rebase.sh:1
> junio/pu:t/t9105-git-svn-commit-diff.sh:1
> junio/pu:t/t9107-git-svn-migrate.sh:1
>
> $ git grep -c HEAD^{} junio/pu -- t/
> junio/pu:t/t3200-branch.sh:3
>
> Maybe use HEAD^0 just for consistency?
Yes, thanks for pointing that out.

-- Kyle

Previous: Johannes SchindelinNext: Jeff King
Message 4 of 9 in “branch_get_push: do not segfault when HEAD is detached”
  1. branch_get_push: do not segfault when HEAD is detachedKyle Meyer, Jan 6, 2017
  2. Jeff KingJan 6, 2017
  3. Johannes SchindelinJan 6, 2017
  4. Kyle MeyerJan 7, 2017
  5. Jeff KingJan 7, 2017
  6. Kyle MeyerJan 7, 2017
  7. Jeff KingJan 7, 2017
  8. Junio C HamanoJan 9, 2017
  9. branch_get_push: do not segfault when HEAD is detachedKyle Meyer, Jan 7, 2017

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.