Web lists-archives.com

Re: fast-import fails with case sensitive tags due to case insensitive lock files




On Fri, Mar 01, 2019 at 06:19:48AM +0000, Wendeborn, Jonathan wrote:
> Hi,
> 
> I have a problem with fast-import on an NTFS drive: If I try to import tags which are identical apart from their casing a failure due to identical lock file names occurs.
> 
> I am running git for windows 2.15.1.2 x64 on a Windows 10 machine (10.0.15063):
> $ git --version --build-options
> git version 2.15.1.windows.2
> built from commit: 5d5baf91824ec7750b103c8b7c4827ffac202feb
> sizeof-long: 4
> machine: x86_64
> 
> MCVE:
>  (echo "commit refs/heads/master" && 
>  echo "mark :1" &&
>  echo "committer me <> 0 +0000" &&
>  echo "data 0" &&
>  echo "" &&
>  echo "tag tag_A" &&
>  echo "from :1" &&
>  echo "tagger me <> 0 +0000" &&
>  echo "data 0" &&
>  echo "" &&
>  echo "tag tag_a" &&
>  echo "from :1" &&
>  echo "tagger me <> 0 +0000" &&
>  echo "data 0" &&
>  echo "") | git fast-import
> 
> Instead of having 1 commit with two tags ("tag_A" and "tag_a") I get his error message:
> Unpacking objects: 100% (4/4), done.
> error: cannot lock ref 'refs/tags/tag_a': Unable to create 'C:/tmp/.git/refs/tags/tag_a.lock': File exists.

The reason you're seeing this error is because refs can be stored in the
file system. In order to update a reference, Git takes a lock on it, and
as you've seen, Git can't take a lock on the same reference twice.

It's known that multiple references that differ only in case can't be
stored in a case-insensitive file system, and there is a design for a
different system (reftable) which nobody has yet implemented in Git but
does not have this problem.

Even if we accepted this situation in fast-import, we'd destroy one of
your tags, which would be undesirable.

Sometimes this happens to work because when we pack references, we store
them in a file instead, which does not suffer from case-sensitivity
problems.

Right now, you have some choices:

• Volunteer to implement reftable.
• Since you're on Windows 10, set your Git repository directory as
  case-sensitive.
• Use Windows Subsystem for Linux, which is case sensitive and creates
  directories with that flag (even on NTFS), to do your import.
• If you control the fast-export output, adjust the arguments you pass
  such that the output does not contain one of the offending tags.
-- 
brian m. carlson: Houston, Texas, US
OpenPGP: https://keybase.io/bk2204

Attachment: signature.asc
Description: PGP signature