Re: Strange effect merging empty file

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03/21/2012 11:28 AM, Ralf Nyren wrote:
Hi,

I found a "strange effect" when merging from a branch containing a
change of a previously empty file. The change is added to another empty
file in the current branch by the merge.

I guess git sees it as a renamed file which is logical from a
content-perspective.

Not sure what to do with this, I would not say it is a bug really...
It does seem like a bug. An unrelated file is clobbered.

Reproduce as follows (should be cut-n-paste friendly):
Here's a slightly simplified version that is actually cut-n-paste friendly after recent changes to always edit merge comments...

# Start with a new repository
git init
echo Readme file >README
git add README
git commit -m 'Initial commit'

# Setup the branch to be merged
git checkout -b import
touch empty.txt
echo hello world >hello.txt
git add empty.txt hello.txt
git commit -m 'Import 1.0'
echo This file is no longer empty >empty.txt
git commit -m 'Import 1.1' empty.txt

# Setup master branch
git checkout master
touch .gitignore
git add .gitignore
git commit -m 'Static web content'

# Merge import 1.0 and remove the empty file
git merge  --no-edit import^
git rm empty.txt
git commit -m 'Remove empty file'

# Merge import 1.1 and watch empty.txt contents show up in .gitignore
git merge --no-edit import
cat .gitignore


Regards,
Zbyszek
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]