Re: [RFC PATCH] fast-export, fast-import: Let tags specify an internal name
- From
Luke Shumaker <lukeshu@lukeshu.com>
- Date
- Apr 21, 2021, 18:48 UTC
- Message-ID
- <87h7jz3248.wl-lukeshu@lukeshu.com>
- In-Reply-To
- <CABPp-BFY65wddHHw2Uhortcux+TzMYBZS1wwfnsasYeishXa-w@mail.gmail.com>
On Wed, 21 Apr 2021 12:34:26 -0600, Elijah Newren wrote:
Show 24 quoted lines
> On Wed, Apr 21, 2021 at 1:19 AM Ævar Arnfjörð Bjarmason > <avarab@gmail.com> wrote: > > There's also perfectly legitimate in-the-wild use-cases for this, > > e.g. "archiving" tags to not-refs/tags/* so e.g. the upload-pack logic > > doesn't consider and follow them. Not being able to export/import those > > repositories as-is due to an overzelous data check there that's not in > > fsck.c would suck. > > Not would suck, but does suck. I had to document it as a shortcoming > of fast-export/fast-import -- see > https://www.mankier.com/1/git-filter-repo#Internals-Limitations, where > I wrote, "annotated and signed tags outside of the refs/tags/ > namespace are not supported (their location will be mangled in weird > ways)". > > The problem is, what's the right backward-compatible way to fix this? > Do we have to add a flag to both fast-export and fast-import to stop > assuming a "refs/tags/" prefix and use the full refname, and require > the user to pass both flags? How is fast-import supposed to know that > "refs/alternate-tags/foo" is or isn't > "refs/tags/refs/alternate-tags/foo"? > > And if we need such a flag, should fast-import die if it sees this new > "name" directive and the flag isn't given?
Elsehwere in the thread, I responded to some feedback by suggesting that perhaps I should flip it around, and instead add a 'refname' sub-command, and have it default to 'refs/tags/{tagname}'
So the stream
tag foo
...would create a tag at "refs/tags/foo" that says "tag foo". And the stream
tag bar
refname refs/alternate-tags/bazwould create a tag at "refs/alternate-tags/baz" that says "tag bar".
Grepping for "refs/tags" in fast-export.c and fast-import.c, I think that would fully address this concern.
-- Happy hacking, ~ Luke Shumaker