git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j6t@kdbg.org>
To: git@vger.kernel.org
Subject: Which is wrong? diff or apply?
Date: Fri, 23 Jul 2010 21:03:08 +0200	[thread overview]
Message-ID: <201007232103.08870.j6t@kdbg.org> (raw)

Today, I tried this in my git.git checkout:

  $ mv transport-helper.c wt-status.c
  $ git diff -B -M | git apply --cached
  error: wt-status.c: already exists in index

That is, I overwrote the tracked wt-status.c with a completly different file 
that is also tracked. Then I try to stage the change using git apply.

git diff -B -M reports this:

  diff --git a/transport-helper.c b/wt-status.c
  similarity index 100%
  rename from transport-helper.c
  rename to wt-status.c

Notice that there is no mention that the previously existing wt-status.c was 
removed. I wonder whether this is a bug.

Or is it the safety valve in git apply that does not allow to overwrite an 
existing file which should not trigger in this case?

-- Hannes

             reply	other threads:[~2010-07-23 19:04 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-23 19:03 Johannes Sixt [this message]
2010-07-23 20:49 ` Which is wrong? diff or apply? Junio C Hamano

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=201007232103.08870.j6t@kdbg.org \
    --to=j6t@kdbg.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).