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

Re: [PATCH] contrib/subtree: verify HEAD is valid before adding a subtree

From
BZBingwu Zhang <xtex@envs.net>
Date
Feb 11, 2025, 01:13 UTC
Message-ID
<12606159.O9o76ZdvQC@xtex1>
In-Reply-To
<xmqq8qqddarl.fsf@gitster.g>
On Tuesday, February 11, 2025 12:28:46 AM GMT+8 Junio C Hamano wrote:
> In short, "is not" -> "may not be", perhaps?
Yes, thank you!
Show 7 quoted lines
> And if we want to treat an unborn HEAD equivalent to an empty tree,
> then dying upon seeing "show-ref" fail would not be a good solution
> to the problem, no?  Shouldn't the updated logic to deal with an
> unborn HEAD be more like "if we see that the HEAD is unborn, then we
> are happy iff the index is empty; if HEAD already points at a
> commit, then we are happy iff the working tree has no changes
> relative to it"?

I did consider treating an unborn HEAD as a empty tree and test if index is empty. However I searched and failed to find out a git subcommand to do that test (: Do you have any suggestions?

-- 
Bingwu Zhang
xtex @ Tue, 11 Feb 2025 01:10:17 +0000
Previous: Junio C Hamano
Message 3 of 3 in “contrib/subtree: verify HEAD is valid before adding a subtree”
  1. contrib/subtree: verify HEAD is valid before adding a subtreeBingwu Zhang, Feb 10, 2025
  2. Junio C HamanoFeb 10, 2025
  3. Bingwu ZhangFeb 11, 2025

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.