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

git subtree issue in more recent versions

From
K2Kevin Cagle (kcagle) [CONT - Type 2] <kcagle@micron.com>
Date
Apr 29, 2014, 00:50 UTC
Message-ID
<55893188F2F68B4B9819D7F9452F981D09FCDF67@NTXBOIMBX01.micron.com>
Hi,
I've discovered a bug in git subtree related to annotated tags. The command 'git subtree' will fail if you use an annotated tag as the <refspec>. e.g.:
$ git subtree add -P oldGit https://github.com/git/git.git tags/v1.9.2
Will produce this error:
10ff115f5c572299de4e04ade0d7adb3c75fbf1f is not a valid 'commit' object
The bug isn't found in 1.7.1 (installed subtree manually) but is found in 1.9.0 and 2.0.0.rc1. 
It's related to the git fetch putting the "wrong" SHA1 in .git/FETCH_HEAD. Thus, if you do:
$ git ls-remote https://github.com/git/git.git | grep v1.9.2

You'll see this: 10ff115f5c572299de4e04ade0d7adb3c75fbf1f refs/tags/v1.9.2 0bc85abb7aa9b24b093253018801a0fb43d01122 refs/tags/v1.9.2^{}

An older version will put the 0bc85a in FETCH_HEAD but newer versions will put 10ff11 which will not work. I'm new to Git so I don't know when/why that was changed but somewhere along the way, that change broke git subtree add. :( A workaround is to use lightweight tags but that's not suitable for some. 

Thanks, Kevin

Next: Junio C Hamano
Message 1 of 2 in “git subtree issue in more recent versions”
  1. Kevin Cagle (kcagle) [CONT - Type 2]Apr 29, 2014
  2. Junio C HamanoApr 29, 2014

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.