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

Re: Questions/investigations on git-subtree and tags

From
JRJeremy Rosen <jeremy.rosen@openwide.fr>
Date
Mar 7, 2013, 16:09 UTC
Message-ID
<1027208424.206728.1362672550530.JavaMail.root@openwide.fr>
In-Reply-To
<CALeLG_noUfcOZ8gUjqftz8sfWiWdXP3kZUjkRNJ4W=_J+V70rw@mail.gmail.com>
> 
> I think I tried adding the ^{} syntax, but I don't think it works on
> remote repos. Or I couldn't get the right syntax.
> 
indeed, it doesn't work on fetch, but it could be used somewhere between the fetch and the commit-tree to move from the ref to the associated commit
Show 5 quoted lines
> 
> Latest patch:
> 
>   http://thread.gmane.org/gmane.comp.version-control.git/217257
> 
oh, that patch, yes I found it while looking around it is a step in the right direction but it doesn't help in my case since i'm using a valid remote ref that can be fetched
(on a side note you could use git ls-remote to check for the remote ref and avoid a fetch in case of an incorrect ref, but that's just a detail)
I just tested with it and here is what happens
git subtree add --squash -P br2 git://git.buildroot.net/buildroot 2013.02 => works ok, br2 is created
however the message of the squash commit is 
    Squashed 'br2/' content from commit f1d2c19
    
    git-subtree-dir: br2
    git-subtree-split: f1d2c19091e1c2ef803ec3267fe71cf6ce7dd948
which is not correct :

git ls-remote git://git.buildroot.net/buildroot 2013.02 f1d2c19091e1c2ef803ec3267fe71cf6ce7dd948 refs/tags/2013.02

git ls-remote git://git.buildroot.net/buildroot 2013.02^{} 15ace1a845c9e7fc65b648bbaf4dd14e03d938fd refs/tags/2013.02^{}

as you can see git subtee thinks it splited from the tag SHA instead of the tag's commit SHA

this is incorrect because the tag isn't here, and at split time git subtree won't be able to find the correct ancestor. We just need to make sure we use the tag's commit instead of the tag

changing
	revs=FETCH_HEAD
to
	revs=FETCH_HEAD^{}
in cmd_add_repository
seems to fix it, both for remote branch pull and remote tag pull
we still have a bug lurking around it's the case where the user does the fetch himself then use subtree add with a tag SHA. but let's discuss problems one at a time :)
Previous: Paul CampbellNext: Jeremy Rosen
Message 9 of 14 in “Questions/investigations on git-subtree and tags”
  1. Jeremy RosenMar 7, 2013
  2. Paul CampbellMar 7, 2013
  3. Jeremy RosenMar 7, 2013
  4. Paul CampbellMar 7, 2013
  5. Jeremy RosenMar 7, 2013
  6. Paul CampbellMar 7, 2013
  7. Jeremy RosenMar 7, 2013
  8. Paul CampbellMar 7, 2013
  9. Jeremy RosenMar 7, 2013
  10. Jeremy RosenMar 8, 2013
  11. Junio C HamanoMar 8, 2013
  12. Jeremy RosenMar 8, 2013
  13. Jeremy RosenMar 12, 2013
  14. Paul CampbellMar 12, 2013

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.