Skip to content

Teach Git to warn about name collisions on case-insensitive filesystems #365

Open
@Denton-L

Description

@Denton-L

Consider the following on a case-insensitive filesystem:

git init
echo a >a
git add a
git commit -m 'a'
git checkout --orphan=b
git mv a A
echo A >A
git add A
git commit -m 'A'
git merge --allow-unrelated-histories master

# this will show up as one of the files changed
git diff
git status

In the above, Git simply reports that one of the two files has changed, but perhaps we could do something like this:

$ git status
On branch b
Changes not staged for commit:
  (use "git add <file>..." to update what will be committed)
  (use "git restore <file>..." to discard changes in working directory)
	modified:   A (filename collides with 'a')

no changes added to commit (use "git add" and/or "git commit -a")

and

$ git diff
file 'A' collides with 'a'

diff --git a/A b/A
index f70f10e..7898192 100644
--- a/A
+++ b/A
@@ -1 +1 @@
-A
+a

or something like that? Either way, we shouldn't be blindly ignoring the fact that a collision has happened but we should warn users explicitly so that they're aware.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions