Re: Directory replaced with a file confuses cherry-pick

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Friday 18 February 2011, Alexey Feldgendler wrote:
> Hello!
> 
> I think I've found a bug. Here is how to reproduce.
> 
> 1. Create an empty repo.
> 2. Add the following: file.txt containing "before" and directory problem/
> with file problem/content containing "data". Commit this.
> 3. From here, create a branch and commit a change to file.txt: change it
> to say "after".
> 4. Checkout master.
> 5. Remove directory problem/ and add a file with the same name (problem)
> containing "newdata". Commit this.
> 6. Try to cherry-pick the commit you made on the side branch on step 3.
> 
> Here is what you see:
> 
> Automatic cherry-pick failed.
> [...]

Unable to reproduce. Here are the commands I used (please post yours):

$ git init
$ echo before > file.txt
$ mkdir problem
$ echo data > problem/content
$ git add .
$ git commit -m first
$ git checkout -b side
$ echo after > file.txt 
$ git commit -a -m side-commit
$ git checkout master
$ git rm -r problem # or: rm -rf problem
$ echo newdata > problem
$ git add problem # this is important!
$ git commit -m second
$ git cherry-pick side
[master b975587] side-commit
 1 files changed, 1 insertions(+), 1 deletions(-)

No conflict in the cherry-pick.

> And git-status says:
> 
> # On branch master
> # Changes to be committed:
> #   (use "git reset HEAD <file>..." to unstage)
> #
> #       modified:   file.txt
> #
> # Unmerged paths:
> #   (use "git reset HEAD <file>..." to unstage)
> #   (use "git add/rm <file>..." as appropriate to mark resolution)
> #
> #       added by us:        problem
> #
> # Untracked files:
> #   (use "git add <file>..." to include in what will be committed)
> #
> #       problem~HEAD

I cannot easily see how you got into this state. Maybe you forgot to 'git 
add' the "problem" file before making the second commit?

> Expected result: the cherry-pick goes smoothly. The change I'm
> cherry-picking (modification of file.txt) has nothing to do with the
> problem file/directory.

Agreed. And that's exactly what I'm seeing above.

> Trying to cherry-pick anything from branches that
> stem off from before the change of a directory to a file fails like this.

This should not be the case. Which Git version are you using?

> Known? Is replacing directories with files maybe a taboo?

Nope. dir->file replacements should not be problematic.


...Johan

-- 
Johan Herland, <johan@xxxxxxxxxxx>
www.herland.net
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]