git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "brian m. carlson" <sandals@crustytoothpaste.net>
To: "Rafał Grzybowski" <aguyngueran@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: Repo state broken due to mismatched file name casing during merge
Date: Wed, 2 Sep 2020 23:23:09 +0000	[thread overview]
Message-ID: <20200902232309.GE241078@camp.crustytoothpaste.net> (raw)
In-Reply-To: <CANG6M-ri1uvEPCcssP=Q0iM25Vhr5QZ220zUUhMdH4AVR9OLSw@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1815 bytes --]

On 2020-09-02 at 16:26:27, Rafał Grzybowski wrote:
> What did you do before the bug happened? (Steps to reproduce your issue)
> 
> mkdir repo
> cd repo
> 
> git init
> 
> "sample file" > file.txt
> git add file.txt
> git commit -m "Added file.txt"
> 
> 
> git checkout -b other_branch
> echo other file > other_file.txt
> git add other_file.txt
> git commit -m "Added other_file.txt"
> 
> git checkout master
> echo Other file > Other_file.txt
> git add Other_file.txt
> git commit -m "Added Other_file.txt"
> 
> git merge other_branch
> git status
> 
> What did you expect to happen? (Expected behavior)
> 
> A clean state, no unstaged changes.
> 
> What happened instead? (Actual behavior)
> 
> There is always an unstaged file other_file.txt which case changes if
> I try to discard and the unstaged change stays.
> If I try to delete the file, I get two unstaged file removal changes.

Git always preserves the case of files internally.  However, the default
configuration on Windows does not.  When you performed this merge, you
ended up with two files, but it's not possible to write both of them
into the working tree.  Since they are not the same, when Git checks the
status of one of the files, it finds it to be modified.

The solution here is to do "git rm --cached Other_file.txt" followed by
a commit.  That removes the file from the index but doesn't touch the
working tree.  In Windows 10, you can also set a directory to be case
sensitive, which should fix this if you do a "git checkout .".

This isn't a bug in Git; Git doesn't know about file name encodings, and
even if it only handled Unicode file names, it's impossible to correctly
perform locale-insensitive case folding, so Git doesn't even try.
-- 
brian m. carlson: Houston, Texas, US

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 263 bytes --]

  reply	other threads:[~2020-09-02 23:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-02 16:26 Repo state broken due to mismatched file name casing during merge Rafał Grzybowski
2020-09-02 23:23 ` brian m. carlson [this message]
2020-09-03  6:20   ` Rafał Grzybowski

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200902232309.GE241078@camp.crustytoothpaste.net \
    --to=sandals@crustytoothpaste.net \
    --cc=aguyngueran@gmail.com \
    --cc=git@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).