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

Re: cherry-picking fails after making a directory a submodule

From
Per Cederqvist <cederp@opera.com>
Date
Jan 8, 2018, 22:15 UTC
Message-ID
<CAP=KgsRR1b8t=qBASf+8EnJyCmpLYPaJQMVHy6VfNxHruJ3--A@mail.gmail.com>
In-Reply-To
<CAGZ79katKiRwXLJscxbO-+JWLedgKmZ7Un-65i4CqefX9Fedqg@mail.gmail.com>
On Mon, Jan 8, 2018 at 10:46 PM, Stefan Beller <sbeller@google.com> wrote:
Show 29 quoted lines
> On Mon, Jan 8, 2018 at 1:08 PM, Per Cederqvist <cederp@opera.com> wrote:
>> I have a situation where I have switched a directory from being a
>> subdirectory to being a submodule.  I then try to cherry-pick a commit
>> from a taskbranch that was made before the switch to the master
>> branch.  The commit touches a file outside the subdirectory/submodule.
>> Yet "git cherry-pick" fails with this error message:
>>
>>> error: could not apply 78c403e... Add a project feature
>>> hint: after resolving the conflicts, mark the corrected paths
>>> hint: with 'git add <paths>' or 'git rm <paths>'
>>> hint: and commit the result with 'git commit'
>>
>> I can resolve the situation by running "git add libfoo && git
>> cherry-pick --continue".  The generated commit contains no changes to
>> "libfoo".
>>
>> I don't understand why I need to manually add libfoo, as the commit
>> I'm cherry-picking doesn't touch anything in libfoo.
>>
>> The script below can reproduce the issue.  Tested with git 2.15.1,
>> 2.14.0 and 2.8.0, all with the same result.
>>
>> Is this a bug in "git cherry-pick"?
>
> Could you please test with
> github.com/git/git/commit/c641ca67072946f95f87e7b21f13f3d4e73701e3
> included? (See its parent commit, for the test)
>
> From my cursory read that commit is the issue addressed in that commit.

Thanks! I can confirm that applying the changes to merge-recursive.c from that commit fixes the issue in 2.15.1.

    /ceder
Previous: Stefan Beller
Message 3 of 3 in “cherry-picking fails after making a directory a submodule”
  1. Per CederqvistJan 8, 2018
  2. Stefan BellerJan 8, 2018
  3. Per CederqvistJan 8, 2018

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.