From: Nick <oinksocket@letterboxes.org>
To: git@vger.kernel.org
Subject: cherry-picking a commit clobbers a file which is a directory in the target commit
Date: Thu, 02 Sep 2010 17:17:43 +0100 [thread overview]
Message-ID: <4C7FCE27.7000500@letterboxes.org> (raw)
This was seen on git version 1.7.0.4 on Ubuntu Lucid.
Basically, cherry-picking a commit from a branch where a file in the current
branch has been replaced by a directory, git clobbers the file and the
cherry-pick fails reporting conflicts.
To replicate:
$ mkdir clobber
$ cd clobber/
$ git init
$ touch sausage
$ git add sausage
$ git commit -m "added sausage"
$ git checkout -b branch1
$ mv sausage sausage1
$ mkdir sausage
$ mv sausage1 sausage/roll
$ git add sausage/roll
$ git commit -m "renamed sausage as sausage/roll"
$ touch falafel
$ git add falafel
$ git commit -m "added falafel"
$ git checkout master
Now if you try to cherry pick the commit just added to branch1 onto master:
$ git cherry-pick branch1
Automatic cherry-pick failed. After resolving the conflicts,
mark the corrected paths with 'git add <paths>' or 'git rm <paths>'
and commit the result with:
git commit -c branch1
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# renamed: sausage -> falafel
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# sausage~HEAD
Not what I expected at all. I'd not expect the file 'sausage' to be modified,
just the new file 'falafel' added, as I did in the original commit.
I know I can recover from this by moving sausage~HEAD back to sausage, or delete
it and check out sausage again, but I suspect it just shouldn't happen at all.
Is this a bug?
N
next reply other threads:[~2010-09-02 16:54 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-02 16:17 Nick [this message]
2010-09-06 9:50 ` cherry-picking a commit clobbers a file which is a directory in the target commit Nick
2010-09-06 15:20 ` Elijah Newren
2010-09-06 20:47 ` [PATCH 0/3] Fix resolvable rename + D/F conflict testcases Elijah Newren
2010-09-06 20:49 ` Elijah Newren
2010-09-06 20:47 ` [PATCH 1/3] t3509: Add rename + D/F conflict testcases that recursive strategy fails Elijah Newren
2010-09-06 20:47 ` [PATCH 2/3] merge-recursive: Small code cleanup Elijah Newren
2010-09-06 21:25 ` Elijah Newren
2010-09-06 23:49 ` Junio C Hamano
2010-09-07 16:23 ` Schalk, Ken
2010-09-08 6:24 ` Elijah Newren
2010-09-09 20:23 ` Schalk, Ken
2010-10-21 19:43 ` Camille Moncelier
2010-09-06 20:47 ` [PATCH 3/3] merge-recursive: D/F conflicts where was_a_dir/file -> was_a_dir Elijah Newren
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=4C7FCE27.7000500@letterboxes.org \
--to=oinksocket@letterboxes.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).