Subject: cherry-pick fail when a symbolic link has been changed into a file or directory

From: Camille Moncelier <[email-masked]>
Date: Thu, 4 Nov 2010 12:56:41 +0100

I'm reposting this since I didn't get any responses and I think my
message didn't contained enought context.

I think I may have spotted a bug, or a unhandled case when doing a
cherry-pick

Consider a repository like this:

# Initialize a dummy repository
    mkdir -p repo1 ; cd repo1
    git init .

# Create a new directory `dir1' and a link to it `dir2'
    mkdir dir1
    echo file1 > dir1/file1
    ln -s dir1 dir2
    git add dir1 dir2
    git commit -m "Initial status: dir2 -> dir1"

# Create a branch named `test1' remove the `dir2' link and
# replace it by a new directory
    git checkout -b test1
    git rm dir2
    mkdir dir2
    touch file2 > dir2/file1
    git add dir2/file1
    git commit -m "Removing link: dir1/ and dir2/"

# Now create a new file in `test1' branch
    message="New file in test1"
    echo $message > new_file_test1
    git add new_file_test1
    git commit -m "$message"

# Now try to cherry-pick last commit from `test1' into master
    git co master
    git cherry-pick test1

The cherry-pick fails saying if failed to merge `dir2' despite the fact
that the commit doesn't affect `dir2' and 

git diff test1~..test1 | git apply

is working. Am I doing something wrong ?

-- 
Camille Moncelier
http://devlife.org