eclipse-jgit / jgit

JGit, the Java implementation of git
https://www.eclipse.org/jgit/
Other
121 stars 34 forks source link

FetchCommand fails if 2 branches have the same name but differ only in case #86

Open sokai116 opened 3 weeks ago

sokai116 commented 3 weeks ago

Version

6.10.0.202406032230-r

Operating System

Windows

Bug description

FetchCommand fails when fetching all branches in Windows OS if any 2 branches have the same name but differ only in case. This is because it can't create a new file to lock e.g. "feature/branch-A" after another "feature/branch-a" has already been made, so lockLooseRefs(pending); in PackedBatchRefUpdate will return null, and then the fetch silently fails.

Special handling may be needed for Windows, as locking a lower(or upper) case branch is guaranteed to lock all branches differently in case, no need to lock again for any other "synonyms" branches.

Actual behavior

The fetch silently fails, and the FetchCommand shows success but nothing is updated. Try to fetch again will always be the same until one of those branches is deleted in remote.

Expected behavior

The repository remote index is updated.

Relevant log output

No response

Other information

No response

MarkEWaite commented 12 hours ago

Microsoft recommends to avoid this situation by not using refs that differ only in case.