git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Directory replaced with a file confuses cherry-pick

From
AFAlexey Feldgendler <alexeyf@opera.com>
Date
Feb 18, 2011, 14:06 UTC
Message-ID
<op.vq3qtqtj56e9f9@xman.eng.oslo.osa>
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. After resolving the conflicts, mark the corrected paths with 'git add <paths>' or 'git rm <paths>' and commit the result with:

         git commit -c 64f21a85fa3deb4d3952b0471f442a76e5147b05
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

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. Trying to cherry-pick anything from branches that stem off from before the change of a directory to a file fails like this.

Known? Is replacing directories with files maybe a taboo?
-- 
Alexey Feldgendler
Software Developer, Desktop Team, Opera Software ASA
[ICQ: 115226275] http://my.opera.com/feldgendler/
Next: Johan Herland
Message 1 of 6 in “Directory replaced with a file confuses cherry-pick”
  1. Alexey FeldgendlerFeb 18, 2011
  2. Johan HerlandFeb 18, 2011
  3. Alexey FeldgendlerFeb 18, 2011
  4. Johan HerlandFeb 18, 2011
  5. NickFeb 18, 2011
  6. Junio C HamanoFeb 18, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.