Re: pulling the root commit overwrites untracked files without warning (1.7.2.3)
- From
Clemens Buchacher <drizzd@aon.at>
- Date
- Nov 14, 2010, 21:34 UTC
- Message-ID
- <20101114213453.GA29287@localhost>
- In-Reply-To
- <AANLkTimDnyzyV1FEEwEuxLfG1nSOcNa7Hzwt7DDssjba@mail.gmail.com>
Hi,
On Thu, Oct 21, 2010 at 04:18:19PM +0300, Gert Palok wrote:
Show 21 quoted lines
> > On 1.7.2.3, pulling the root commit overwrites untracked files > > Minimal working example: > $ git init wc1 > $ cd wc1 > $ echo a > a > $ git add a > $ git commit -m "added a" > $ mkdir ../wc2 > $ cd ../wc2 > $ echo b > a > $ git init > $ git remote add origin ../wc1 > $ git pull origin master > $ # expected: error: Untracked working tree file 'a' would be > overwritten by merge. Aborting > $ # actual: no error > $ cat a > $ # expected: b > $ # actual: a
I finally got a chance to look at this. Contrary to my initial suspicion, it's not a problem with the merge algorithm at all. It doesn't even do a merge.
Instead, git merge finds that it has no valid HEAD and therefore does a hard reset, which obviously overwrites any files already there.
Patch to follow.
Clemens