All of lore.kernel.org
 help / color / mirror / Atom feed
From: Clemens Buchacher <drizzd@aon.at>
To: Gert Palok <gert@planc.ee>
Cc: git@vger.kernel.org
Subject: Re: pulling the root commit overwrites untracked files without warning (1.7.2.3)
Date: Sun, 14 Nov 2010 22:34:53 +0100	[thread overview]
Message-ID: <20101114213453.GA29287@localhost> (raw)
In-Reply-To: <AANLkTimDnyzyV1FEEwEuxLfG1nSOcNa7Hzwt7DDssjba@mail.gmail.com>

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

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 #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 490 bytes --]

  parent reply	other threads:[~2010-11-14 21:34 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-21 13:18 pulling the root commit overwrites untracked files without warning (1.7.2.3) Gert Palok
2010-10-22 21:14 ` Clemens Buchacher
2010-10-22 21:17   ` Clemens Buchacher
2010-11-14 21:34 ` Clemens Buchacher [this message]
2010-11-14 21:46   ` [PATCH] do not overwrite untracked during merge from unborn branch Clemens Buchacher
2010-11-14 21:49     ` [PATCH w/o PGP] " Clemens Buchacher
2010-11-14 21:53       ` [PATCH v2] " Clemens Buchacher
2010-11-15  1:51         ` Miles Bader
     [not found]     ` <20101114214953.GB16413@burratino>
2010-11-14 22:07       ` [PATCH v3] " Clemens Buchacher

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

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

  git send-email \
    --in-reply-to=20101114213453.GA29287@localhost \
    --to=drizzd@aon.at \
    --cc=gert@planc.ee \
    --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.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.