Re: pulling the root commit overwrites untracked files without warning (1.7.2.3)

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

 



Hi,

On Thu, Oct 21, 2010 at 04:18:19PM +0300, Gert Palok wrote:
> 
> 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

Attachment: signature.asc
Description: Digital signature


[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]