git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* Bug report: OS X git-merge deletes recapitalized files when rename detection fails
@ 2013-10-10 22:46 Dan Fabulich
       [not found] ` <1BABBB4C-F461-40B7-97C6-3E90364D37E8@gmail.com>
  0 siblings, 1 reply; 2+ messages in thread
From: Dan Fabulich @ 2013-10-10 22:46 UTC (permalink / raw)
  To: git

On case-insensitive filesystems, git-merge deletes files that were recapitalized in another branch if rename detection fails.

To repro: Run this script with git 1.8.4 on a case-insensitive filesystem. It repros for me on the default HFS filesystem on OS X 10.8, and also on Win7 NTFS.

#!/bin/sh -x
# create git repo
git --version
rm -rf caps
git init caps
cd caps
git config --get core.ignorecase
# commit empty file called "file"
echo file > file
git add .
git commit -am "initial commit"
# create branch called "branch"
git branch branch
# rename "file" to "File"
# using --force per http://stackoverflow.com/questions/6899582
git mv --force file File
echo "completely different content" > File
git commit -am "renamed to File"
# switch to branch, make a non-conflicting commit
git checkout branch
echo newfile > newfile
git add .
git commit -am "branch commit"
# merge master into branch, commit merge
git merge --verbose --commit --no-edit master
ls File
git status

Actual: At the end of the script, the renamed File has been deleted by git-merge. "ls: File: No such file or directory" According to git-status, the deletion is not yet staged.

Expected: There should be no untracked changes at the end of this script. The script runs as expected on Linux or case-sensitive HFS.

-Dan Fabulich

P.S. On case-insensitive HFS, git-init will automatically set core.ignorecase to true. For the sake of the experiment, I also tried setting core.ignorecase to false in the test repository.

When I did that, I was unable to even checkout the "branch" branch without using --force. ("The following untracked working tree files would be overwritten by checkout: file" But git-status reported no untracked changes.)

And then, once I did use force to switch to the branch, I was unable to merge from master at all. ("The following untracked working tree files would be overwritten by merge: File" But again, git-status reported no untracked changes.)

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Bug report: OS X git-merge deletes recapitalized files when rename detection fails
       [not found] ` <1BABBB4C-F461-40B7-97C6-3E90364D37E8@gmail.com>
@ 2013-10-22  4:27   ` Dan Fabulich
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Fabulich @ 2013-10-22  4:27 UTC (permalink / raw)
  To: git@vger.kernel.org, Eric Boxer

Eric, are you still investigating this bug? (I note that your reply, which cc:ed the list, doesn't seem to have been mailed out to the list, or added to mailing list archives.)

On Oct 10, 2013, at 17:13 , Eric Boxer <boxerspam1@gmail.com> wrote:

> I'm on it and I'll follow up shortly.
> 
> 
> On Thu, Oct 10, 2013 at 05:46 PM, Dan Fabulich wrote:
>> On case-insensitive filesystems, git-merge deletes files that were recapitalized in another branch if rename detection fails.
>> 
>> To repro: Run this script with git 1.8.4 on a case-insensitive filesystem. It repros for me on the default HFS filesystem on OS X 10.8, and also on Win7 NTFS.
>> 
>> #!/bin/sh -x
>> # create git repo
>> git --version
>> rm -rf caps
>> git init caps
>> cd caps
>> git config --get core.ignorecase
>> # commit empty file called "file"
>> echo file > file
>> git add .
>> git commit -am "initial commit"
>> # create branch called "branch"
>> git branch branch
>> # rename "file" to "File"
>> # using --force per http://stackoverflow.com/questions/6899582
>> git mv --force file File
>> echo "completely different content" > File
>> git commit -am "renamed to File"
>> # switch to branch, make a non-conflicting commit
>> git checkout branch
>> echo newfile > newfile
>> git add .
>> git commit -am "branch commit"
>> # merge master into branch, commit merge
>> git merge --verbose --commit --no-edit master
>> ls File
>> git status
>> 
>> Actual: At the end of the script, the renamed File has been deleted by git-merge. "ls: File: No such file or directory" According to git-status, the deletion is not yet staged.
>> 
>> Expected: There should be no untracked changes at the end of this script. The script runs as expected on Linux or case-sensitive HFS.
>> 
>> -Dan Fabulich
>> 
>> P.S. On case-insensitive HFS, git-init will automatically set core.ignorecase to true. For the sake of the experiment, I also tried setting core.ignorecase to false in the test repository.
>> 
>> When I did that, I was unable to even checkout the "branch" branch without using --force. ("The following untracked working tree files would be overwritten by checkout: file" But git-status reported no untracked changes.)
>> 
>> And then, once I did use force to switch to the branch, I was unable to merge from master at all. ("The following untracked working tree files would be overwritten by merge: File" But again, git-status reported no untracked changes.)
>> 
>> --
>> To unsubscribe from this list: send the line "unsubscribe git" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2013-10-22  4:27 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-10 22:46 Bug report: OS X git-merge deletes recapitalized files when rename detection fails Dan Fabulich
     [not found] ` <1BABBB4C-F461-40B7-97C6-3E90364D37E8@gmail.com>
2013-10-22  4:27   ` Dan Fabulich

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).