git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Ericsson <ae@op5.se>
To: Asheesh Laroia <asheesh@asheesh.org>
Cc: git@vger.kernel.org
Subject: Re: Overwriting untracked working tree files (when identical)
Date: Mon, 01 Dec 2008 10:28:37 +0100	[thread overview]
Message-ID: <4933AE45.4050400@op5.se> (raw)
In-Reply-To: <alpine.DEB.2.00.0811290018340.15382@vellum.laroia.net>

Asheesh Laroia wrote:
> I was using git earlier today and got the familiar error:
> 
>     "Untracked working tree file 'filename’ would be overwritten by merge"
> 
> As it happens, I know that filename in my local filesystem and filename 
> in the remote git branch have the same contents.
> 
> Would it make sense for git to check for this possibility, and if the 
> working tree file is the same as the file being merged in with that 
> filename, allow the overwrite?
> 

That depends. git uses the work-tree to merge things. If one file is the
same as that about to be written, it *might* make sense to clobber it,
but what if it's identical to the expected merge-result? Git can't know
that, but it's almost certainly a much saner approach than the other
case, where the merge can go wahoonie-shaped at a later stage and thus
require conflict resolution (which might well end up with the user
getting fed up and doing "git reset --hard" to start over). For such
cases, the file would appear to disappear, and that's a bad thing.

Overall, I think it's best if this is left as-is. The code would be too
complex for the gain it provides.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

      reply	other threads:[~2008-12-01  9:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-29 18:58 Overwriting untracked working tree files (when identical) Asheesh Laroia
2008-12-01  9:28 ` Andreas Ericsson [this message]

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=4933AE45.4050400@op5.se \
    --to=ae@op5.se \
    --cc=asheesh@asheesh.org \
    --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 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 NNTP newsgroup(s).