{"thread":{"id":"26549","subject":"Directory replaced with a file confuses cherry-pick","startedAt":"2011-02-18T14:06:52Z","lastAt":"2011-02-18T20:00:19Z","messageCount":6,"participants":["Alexey Feldgendler","Johan Herland","Nick","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"161545","messageId":"op.vq3qtqtj56e9f9@xman.eng.oslo.osa","threadId":"26549","inReplyTo":null,"subject":"Directory replaced with a file confuses cherry-pick","fromName":"Alexey Feldgendler","fromEmail":"alexeyf@opera.com","sentAt":"2011-02-18T14:06:52Z","receivedAt":"2011-02-18T14:06:52Z","isPatch":false,"sender":{"key":"alexeyf@opera.com","avatar":null},"body":"\nHello!\n\nI think I've found a bug. Here is how to reproduce.\n\n1. Create an empty repo.\n2. Add the following: file.txt containing \"before\" and directory problem/  \nwith file problem/content containing \"data\". Commit this.\n3. From here, create a branch and commit a change to file.txt: change it  \nto say \"after\".\n4. Checkout master.\n5. Remove directory problem/ and add a file with the same name (problem)  \ncontaining \"newdata\". Commit this.\n6. Try to cherry-pick the commit you made on the side branch on step 3.\n\nHere is what you see:\n\nAutomatic cherry-pick failed.  After resolving the conflicts,\nmark the corrected paths with 'git add <paths>' or 'git rm <paths>'\nand commit the result with:\n\n         git commit -c 64f21a85fa3deb4d3952b0471f442a76e5147b05\n\nAnd git-status says:\n\n# On branch master\n# Changes to be committed:\n#   (use \"git reset HEAD <file>...\" to unstage)\n#\n#       modified:   file.txt\n#\n# Unmerged paths:\n#   (use \"git reset HEAD <file>...\" to unstage)\n#   (use \"git add/rm <file>...\" as appropriate to mark resolution)\n#\n#       added by us:        problem\n#\n# Untracked files:\n#   (use \"git add <file>...\" to include in what will be committed)\n#\n#       problem~HEAD\n\nExpected result: the cherry-pick goes smoothly. The change I'm  \ncherry-picking (modification of file.txt) has nothing to do with the  \nproblem file/directory. Trying to cherry-pick anything from branches that  \nstem off from before the change of a directory to a file fails like this.\n\nKnown? Is replacing directories with files maybe a taboo?\n\n\n-- \nAlexey Feldgendler\nSoftware Developer, Desktop Team, Opera Software ASA\n[ICQ: 115226275] http://my.opera.com/feldgendler/\n"},{"id":"161550","messageId":"201102181544.06045.johan@herland.net","threadId":"26549","inReplyTo":"op.vq3qtqtj56e9f9@xman.eng.oslo.osa","subject":"Re: Directory replaced with a file confuses cherry-pick","fromName":"Johan Herland","fromEmail":"johan@herland.net","sentAt":"2011-02-18T14:44:05Z","receivedAt":"2011-02-18T14:44:05Z","isPatch":false,"sender":{"key":"johan@herland.net","avatar":"https://avatars.githubusercontent.com/u/547031?v=4"},"body":"On Friday 18 February 2011, Alexey Feldgendler wrote:\n> Hello!\n> \n> I think I've found a bug. Here is how to reproduce.\n> \n> 1. Create an empty repo.\n> 2. Add the following: file.txt containing \"before\" and directory problem/\n> with file problem/content containing \"data\". Commit this.\n> 3. From here, create a branch and commit a change to file.txt: change it\n> to say \"after\".\n> 4. Checkout master.\n> 5. Remove directory problem/ and add a file with the same name (problem)\n> containing \"newdata\". Commit this.\n> 6. Try to cherry-pick the commit you made on the side branch on step 3.\n> \n> Here is what you see:\n> \n> Automatic cherry-pick failed.\n> [...]\n\nUnable to reproduce. Here are the commands I used (please post yours):\n\n$ git init\n$ echo before > file.txt\n$ mkdir problem\n$ echo data > problem/content\n$ git add .\n$ git commit -m first\n$ git checkout -b side\n$ echo after > file.txt \n$ git commit -a -m side-commit\n$ git checkout master\n$ git rm -r problem # or: rm -rf problem\n$ echo newdata > problem\n$ git add problem # this is important!\n$ git commit -m second\n$ git cherry-pick side\n[master b975587] side-commit\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\nNo conflict in the cherry-pick.\n\n> And git-status says:\n> \n> # On branch master\n> # Changes to be committed:\n> #   (use \"git reset HEAD <file>...\" to unstage)\n> #\n> #       modified:   file.txt\n> #\n> # Unmerged paths:\n> #   (use \"git reset HEAD <file>...\" to unstage)\n> #   (use \"git add/rm <file>...\" as appropriate to mark resolution)\n> #\n> #       added by us:        problem\n> #\n> # Untracked files:\n> #   (use \"git add <file>...\" to include in what will be committed)\n> #\n> #       problem~HEAD\n\nI cannot easily see how you got into this state. Maybe you forgot to 'git \nadd' the \"problem\" file before making the second commit?\n\n> Expected result: the cherry-pick goes smoothly. The change I'm\n> cherry-picking (modification of file.txt) has nothing to do with the\n> problem file/directory.\n\nAgreed. And that's exactly what I'm seeing above.\n\n> Trying to cherry-pick anything from branches that\n> stem off from before the change of a directory to a file fails like this.\n\nThis should not be the case. Which Git version are you using?\n\n> Known? Is replacing directories with files maybe a taboo?\n\nNope. dir->file replacements should not be problematic.\n\n\n...Johan\n\n-- \nJohan Herland, <johan@herland.net>\nwww.herland.net\n"},{"id":"161551","messageId":"op.vq3sr8w956e9f9@xman.eng.oslo.osa","threadId":"26549","inReplyTo":"201102181544.06045.johan@herland.net","subject":"Re: Directory replaced with a file confuses cherry-pick","fromName":"Alexey Feldgendler","fromEmail":"alexeyf@opera.com","sentAt":"2011-02-18T14:49:10Z","receivedAt":"2011-02-18T14:49:10Z","isPatch":false,"sender":{"key":"alexeyf@opera.com","avatar":null},"body":"On Fri, 18 Feb 2011 15:44:05 +0100, Johan Herland <johan@herland.net>  \nwrote:\n\n> Unable to reproduce. Here are the commands I used (please post yours):\n\nI tried your exact script now, line by line, and it failed in the way I  \ndescribed.\n\n> This should not be the case. Which Git version are you using?\n\ngit is from Debian testing, package version 1:1.7.2.3-2.2.\n\n\n-- \nAlexey Feldgendler\nSoftware Developer, Desktop Team, Opera Software ASA\n[ICQ: 115226275] http://my.opera.com/feldgendler/\n"},{"id":"161552","messageId":"201102181617.55929.johan@herland.net","threadId":"26549","inReplyTo":"op.vq3sr8w956e9f9@xman.eng.oslo.osa","subject":"Re: Directory replaced with a file confuses cherry-pick","fromName":"Johan Herland","fromEmail":"johan@herland.net","sentAt":"2011-02-18T15:17:55Z","receivedAt":"2011-02-18T15:17:55Z","isPatch":false,"sender":{"key":"johan@herland.net","avatar":"https://avatars.githubusercontent.com/u/547031?v=4"},"body":"(please don't cull the CC list when replying)\n\nOn Friday 18 February 2011, Alexey Feldgendler wrote:\n> On Fri, 18 Feb 2011 15:44:05 +0100, Johan Herland <johan@herland.net>\n> \n> wrote:\n> > Unable to reproduce. Here are the commands I used (please post yours):\n> I tried your exact script now, line by line, and it failed in the way I\n> described.\n> \n> > This should not be the case. Which Git version are you using?\n> \n> git is from Debian testing, package version 1:1.7.2.3-2.2.\n\nI'm going away for the weekend, so I can't investigate this right now. Could \nyou please retry with a more recent Git? Maybe someone else already knows \nwhich patch might have fixed this issue?\n\n\nHave fun! :)\n\n...Johan\n\n-- \nJohan Herland, <johan@herland.net>\nwww.herland.net\n"},{"id":"161554","messageId":"4D5E907D.2090808@letterboxes.org","threadId":"26549","inReplyTo":"op.vq3qtqtj56e9f9@xman.eng.oslo.osa","subject":"Re: Directory replaced with a file confuses cherry-pick","fromName":"Nick","fromEmail":"oinksocket@letterboxes.org","sentAt":"2011-02-18T15:30:05Z","receivedAt":"2011-02-18T15:30:05Z","isPatch":false,"sender":{"key":"oinksocket@letterboxes.org","avatar":null},"body":"On 18/02/11 14:06, Alexey Feldgendler wrote:\n> I think I've found a bug. Here is how to reproduce.\n\nIt looks like one I found in 1.7.0.4 - for which Elijah Newren submitted some\npatches, although I don't happen to know what their current status is.\n\n  http://comments.gmane.org/gmane.comp.version-control.git/155147\n\nN\n"},{"id":"161561","messageId":"7vvd0hnmek.fsf@alter.siamese.dyndns.org","threadId":"26549","inReplyTo":"4D5E907D.2090808@letterboxes.org","subject":"Re: Directory replaced with a file confuses cherry-pick","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2011-02-18T20:00:19Z","receivedAt":"2011-02-18T20:00:19Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nick <oinksocket@letterboxes.org> writes:\n\n> On 18/02/11 14:06, Alexey Feldgendler wrote:\n>> I think I've found a bug. Here is how to reproduce.\n>\n> It looks like one I found in 1.7.0.4 - for which Elijah Newren submitted some\n> patches, although I don't happen to know what their current status is.\n>\n>   http://comments.gmane.org/gmane.comp.version-control.git/155147\n\nIsn't v1.7.4-rc0~101 a polished version of that one?\n"}]}