Open
Description
Current behavior 😯
Calling fetch_only
on Windows for a repository with a branch named foo<1.0
fails due to:
Fetch(UpdateRefs(EditReferences(FileTransactionCommit(DeleteReference { full_name: "refs/remotes/origin/foo<1.0", err: Os { code: 123, kind: InvalidFilename, message: "The filename, directory name, or volume label syntax is incorrect." } }))))
Expected behavior 🤔
I would expect this to work on Windows, given that foo<1.0
is a well-formed name according to git's ref naming rules.
Steps to reproduce 🕹
- Use Windows
- Try to
PrepareFetch
andfetch_only
forhttps://github.com/calyptobai/gix-fetch-win-fail.git
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
Byron commentedon Oct 10, 2023
Thanks for reporting!
git
seems to be able to do it by writing packed-refs right away.gix
also does that which works around issues around case-insensitivity for example, but that doesn't seem to kick in here. Instead it tries to create a file with such a name and fails.The goal here would to figure out why it's not writing straight to packed refs.
Byron commentedon Oct 10, 2023
A quick investigation shows that…
gix
(CLI)` already asks to write packed refs only - this doesn't seem to fully kick-ingix-ref
will still try to obtain a lock on each of the refs individually even when moving them into a packed-ref, apparently, even though it shouldn't have to do that.So in this case, it's probably these the last two points to adjust and investigate.
EliahKagan commentedon Jul 29, 2024
I didn't test this prior to the changes in #1374, but currently the failure, if tested with
gix
, is that it attempts to write a reflog for that remote branch to a file of the same name:Byron commentedon Jul 29, 2024
It's amazing that Git can do it - or does it just ignore the reflog maybe?
If so, and it's my guess that it does,
gix
could do the same.EliahKagan commentedon Jul 29, 2024
Yeah, with
git
I don't see any file for it there.(Attempting to switch to the branch with
git
does fail, as I would expect, due to an attempt to create a lockfile that has the branch name as its basename.)EliahKagan commentedon Jul 29, 2024
I should acknowledge that this may not be all that must change. We also want to be able to fetch again.
There, the problem is not related to a log. This may be considered more strongly to resemble the original problem description.
git fetch
succeeds with no output. (git diff
can also compare toorigin/foo<1.0
, and it is shown in the output ofgit log
, which also accepts it as an argument.)Byron commentedon Jul 29, 2024
Great! This is quite actionable, even though it's not trivial to implement. After all, I wonder if
gitoxide
should generally treat the reflog as optional. Maybe Git only treats the creation as optional though, or maybe it's a Windows-only fix?With more research to understand Git as baseline, one can probably make a good decision there.
But with the comment above, it's once again clear that this is more work to get right, probably in many different places then. And with that, I once more wonder if Git has a clever solution for this to also 'do the right thing' instead of just ignoring errors.