{"thread":{"id":"47159","subject":"Bug: cherry-pick & submodule","startedAt":"2017-11-10T16:41:20Z","lastAt":"2017-11-11T00:04:51Z","messageCount":2,"participants":["Ефимов Василий","Stefan Beller"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"332190","messageId":"743acc29-85bb-3773-b6a0-68d4a0b8fd63@ispras.ru","threadId":"47159","inReplyTo":null,"subject":"Bug: cherry-pick & submodule","fromName":"Ефимов Василий","fromEmail":"real@ispras.ru","sentAt":"2017-11-10T16:41:15Z","receivedAt":"2017-11-10T16:41:20Z","isPatch":false,"sender":{"key":"real@ispras.ru","avatar":null},"body":"I faced an unexpected behaviour during cherry-picking\na commit to a branch with a submodule.\n\nGit graph:\n\nA -- B [master]\n  \\\n   `- C -- D [test]\n\nBoth branches have a file with name `a_file`.\nIt has been added by commit A.\nCommits B and C add a folder with name `a_submodule` to the respective \nbranches.\nCommit C does it regularly by adding a file with name `a_submodule/content`.\nCommit B adds a submodule with name `a_submodule`.\nCommit D only modifies `a_file`.\nNote that `a_file` and `a_submodule` are not related.\n\n[repo]\n   |- a_file\n   `- a_submodule\n\nWhen I trying to cherry pick commit D on commit B, I got\na conflict with `a_submodule`. Changes of `a_file` are\nsuccessfully cherry-picked.\n\nI expected, that there would be no conflicts.\n\nA bash script reproducing the bug is listed below.\n\nVasily.\n\n====\nrm -rf a_submodule a_repo\n\nmkdir a_submodule\ncd a_submodule\ngit init\ntouch a_file_in_a_submodule\ngit add a_file_in_a_submodule\ngit commit -m \"add a file in a submodule\"\ncd ..\n\nmkdir a_repo\ncd a_repo\ngit init\n\ntouch a_file\ngit add a_file\ngit commit -m \"add a file\"\n\ngit branch test\ngit checkout test\n\nmkdir a_submodule\ntouch a_submodule/content\ngit add a_submodule/content\ngit commit -m \"add a regular folder with name a_submodule\"\n\necho \"123\" > a_file\ngit add a_file\ngit commit -m \"modify a file\"\n\ngit checkout master\n\ngit submodule add ../a_submodule a_submodule\ngit submodule update a_submodule\ngit commit -m \"add a submodule info folder with name a_submodule\"\n\n# Trying to cherry-pick modification of a file from test branch.\ngit cherry-pick test\n\n# some debug\ngit status\n====\n"},{"id":"332270","messageId":"20171111000443.16675-1-sbeller@google.com","threadId":"47159","inReplyTo":"743acc29-85bb-3773-b6a0-68d4a0b8fd63@ispras.ru","subject":"[PATCH] t/3512: demonstrate unrelated submodule/file conflict as cherry-pick failure","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2017-11-11T00:04:43Z","receivedAt":"2017-11-11T00:04:51Z","isPatch":true,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"Signed-off-by: Stefan Beller <sbeller@google.com>\n---\n\nI rewrote your script to integrate with our test suite, potentially acting as\na regression test once we solve the Directory/File conflict issue.\n\nThanks,\nStefan\n\n t/t3512-cherry-pick-submodule.sh | 36 ++++++++++++++++++++++++++++++++++++\n 1 file changed, 36 insertions(+)\n\ndiff --git a/t/t3512-cherry-pick-submodule.sh b/t/t3512-cherry-pick-submodule.sh\nindex 6863b7bb6f..17a6773247 100755\n--- a/t/t3512-cherry-pick-submodule.sh\n+++ b/t/t3512-cherry-pick-submodule.sh\n@@ -10,4 +10,40 @@ KNOWN_FAILURE_NOFF_MERGE_DOESNT_CREATE_EMPTY_SUBMODULE_DIR=1\n KNOWN_FAILURE_NOFF_MERGE_ATTEMPTS_TO_MERGE_REMOVED_SUBMODULE_FILES=1\n test_submodule_switch \"git cherry-pick\"\n \n+test_expect_failure 'unrelated submodule/file conflict is ignored' '\n+\ttest_create_repo sub &&\n+\n+\ttouch sub/file &&\n+\tgit -C sub add file &&\n+\tgit -C sub commit -m \"add a file in a submodule\" &&\n+\n+\ttest_create_repo a_repo &&\n+\t(\n+\t\tcd a_repo &&\n+\t\ttouch a_file &&\n+\t\tgit add a_file &&\n+\t\tgit commit -m \"add a file\" &&\n+\n+\t\tgit branch test &&\n+\t\tgit checkout test &&\n+\n+\t\tmkdir sub &&\n+\t\ttouch sub/content &&\n+\t\tgit add sub/content &&\n+\t\tgit commit -m \"add a regular folder with name sub\" &&\n+\n+\t\techo \"123\" >a_file &&\n+\t\tgit add a_file &&\n+\t\tgit commit -m \"modify a file\" &&\n+\n+\t\tgit checkout master &&\n+\n+\t\tgit submodule add ../sub sub &&\n+\t\tgit submodule update sub &&\n+\t\tgit commit -m \"add a submodule info folder with name sub\" &&\n+\n+\t\tgit cherry-pick test\n+\t)\n+'\n+\n test_done\n-- \n2.15.0.128.gcadd42da22\n\n"}]}