threads / discuss / 53674

regenerating tags when cloning

Subject: regenerating tags when cloning

## tl;dr

2 messages between Jun 13, 2020 and Jun 14, 2020.

replies: 1people: 2as markdown or json

Will Holcomb· Jun 13, 2020, 22:37 UTC · lore

I am working on a git remote (https://github.com/dhappy/git-remote-ipfs), and I am confused as to how to recreate signed tags when cloning.

My remote serializes the commit chain to IPFS and back. It works
correctly for branches, but I'm having difficulty with tags:
 • If I recreate tags, I get the error: "fatal: BUG: initial ref
transaction called with existing refs".
 • If I don't create the tags, I get an error like: "Error: reference
'refs/tags/v0.3.4' not found".
 • If I create the tags and remove the references, the clone will
complete, but the resultant repo has a detached head and no tags.

I created a minimum failing example when I posted to stackoverflow: https://stackoverflow.com/q/62360443/264008

I can do a "git clone --tags" from Github, and it creates a clone with tags, so I know it can be done. I just don't understand what I need to change.

It might be germane that I am translating the git objects into a
CBOR-DAG: https://explore.ipld.io/#/explore/Qmcnzkb1YGyDWBqSaFz1k7qi3F1VDaHNsBWNF2SvRiYeL5/.git
and relying on nodegit to reconstruct objects with the same SHA1
hashes on fetch, so I can't directly insert things into the object
database.
Any suggestions would be greatly appreciated.
–☮W
Philip Oakley· Jun 14, 2020, 09:51 UTC · re: Will Holcomb · lore

Re: regenerating tags when cloning

On 13/06/2020 23:37, Will Holcomb wrote:
Show 27 quoted lines
> I am working on a git remote
> (https://github.com/dhappy/git-remote-ipfs), and I am confused as to
> how to recreate signed tags when cloning.
>
> My remote serializes the commit chain to IPFS and back. It works
> correctly for branches, but I'm having difficulty with tags:
>  • If I recreate tags, I get the error: "fatal: BUG: initial ref
> transaction called with existing refs".
>  • If I don't create the tags, I get an error like: "Error: reference
> 'refs/tags/v0.3.4' not found".
>  • If I create the tags and remove the references, the clone will
> complete, but the resultant repo has a detached head and no tags.
>
> I created a minimum failing example when I posted to stackoverflow:
> https://stackoverflow.com/q/62360443/264008
>
> I can do a "git clone --tags" from Github, and it creates a clone with
> tags, so I know it can be done. I just don't understand what I need to
> change.
>
> It might be germane that I am translating the git objects into a
> CBOR-DAG: https://explore.ipld.io/#/explore/Qmcnzkb1YGyDWBqSaFz1k7qi3F1VDaHNsBWNF2SvRiYeL5/.git
> and relying on nodegit to reconstruct objects with the same SHA1
> hashes on fetch, so I can't directly insert things into the object
> database.
>
> Any suggestions would be greatly appreciated.
Thoughts that come to mind (I know nothing about IPFS..):

Are these annotated tags or lightweight tags? https://stackoverflow.com/questions/11514075/what-is-the-difference-between-an-annotated-and-unannotated-tag

Can you be sure that the commits the tags reference have already been recreated before you start tagging them?

Could the tags have already been implicitly recreated (being mistaken for a commitish object), and so you are trying to create a duplicate.

Is the tag name meant to have 'fancy' symbols https://explore.ipld.io/#/explore/Qmcnzkb1YGyDWBqSaFz1k7qi3F1VDaHNsBWNF2SvRiYeL5/.git/refs/tags/%E2%93%A5/%C2%BD (does the clone work for similar symbols in the commit messages)?

The Git code is available at https://github.com/git/git (you probably already knew that) if you want to search for the error messages and hence code paths.

Philip

← back to recent threads