Skip to content

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

Open

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.

Activity

  1. newren commented on Mar 10, 2020

    @newren

    As a side note, unpack_trees() has code to warn about name-collisions so that if you check out a different branch with one you'll get a warning. merge-ort reuses that code, so when we switch over to it, you should get the same warning at merge time.

    However, it may make sense to also have git-status provide some kind of warning, just thought I'd note that there should soon be some kind of warning assuming people watch all the informational messages printed out at merge time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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