{"thread":{"id":"50145","subject":"Submodule log bug","startedAt":"2019-01-02T22:14:07Z","lastAt":"2019-01-09T23:13:17Z","messageCount":2,"participants":["David Turner","Stefan Beller"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"366055","messageId":"df37313acafdb4bb74c71e476e5acab10248b1a2.camel@novalis.org","threadId":"50145","inReplyTo":null,"subject":"Submodule log bug","fromName":"David Turner","fromEmail":"novalis@novalis.org","sentAt":"2019-01-02T22:14:01Z","receivedAt":"2019-01-02T22:14:07Z","isPatch":false,"sender":{"key":"novalis@novalis.org","avatar":"https://avatars.githubusercontent.com/u/77003?v=4"},"body":"When a submodule is renamed, git log gives incorrect output:\n\ncommit 350ebece9bce8d9c495f9a51e6f5529749c5c3cc (HEAD -> master)\nAuthor:\nDavid Turner <novalis@novalis.org>\nDate:   Wed Jan 2 17:09:56 2019 -0500\n\n    move\n\ndiff --git a/.gitmodules b/.gitmodules\nindex da1a767..f4baf2a 100644\n--- a/.gitmodules\n+++ b/.gitmodules\n@@ -1,3 +1,3 @@\n-[submodule \"mymod\"]\n-\tpath = mymod\n+[submodule \"morx\"]\n+\tpath = morx\n \turl = ../sub\nSubmodule mymod 86da4a4...86da4a4 (commits not present)\n\n^-- I expect this last line to tell me that the submodule has been\nrenamed, rather than that it has changed SHA to the same SHA.\n\nSee the attached shell script for a demo of this.  I tested with\nb21ebb671bb as well as 2.18 and 2.19.  Thanks to Adam Bliss\n<abliss@twosigma.com> for helping to figure out the reproduction steps.\n"},{"id":"366461","messageId":"CAGZ79kbfmxPKZBzRpH2T=WHBjbzORiAyiFPFbPD0R+fQW7XuXg@mail.gmail.com","threadId":"50145","inReplyTo":"df37313acafdb4bb74c71e476e5acab10248b1a2.camel@novalis.org","subject":"Re: Submodule log bug","fromName":"Stefan Beller","fromEmail":"sbeller@google.com","sentAt":"2019-01-09T23:13:02Z","receivedAt":"2019-01-09T23:13:17Z","isPatch":false,"sender":{"key":"stefanbeller@gmail.com","avatar":"https://avatars.githubusercontent.com/u/455868?v=4"},"body":"On Wed, Jan 2, 2019 at 2:14 PM David Turner <novalis@novalis.org> wrote:\n>\n> When a submodule is renamed, git log gives incorrect output:\n>\n> commit 350ebece9bce8d9c495f9a51e6f5529749c5c3cc (HEAD -> master)\n> Author:\n> David Turner <novalis@novalis.org>\n> Date:   Wed Jan 2 17:09:56 2019 -0500\n>\n>     move\n>\n> diff --git a/.gitmodules b/.gitmodules\n> index da1a767..f4baf2a 100644\n> --- a/.gitmodules\n> +++ b/.gitmodules\n> @@ -1,3 +1,3 @@\n> -[submodule \"mymod\"]\n> -       path = mymod\n> +[submodule \"morx\"]\n> +       path = morx\n>         url = ../sub\n> Submodule mymod 86da4a4...86da4a4 (commits not present)\n>\n> ^-- I expect this last line to tell me that the submodule has been\n> renamed, rather than that it has changed SHA to the same SHA.\n\nTrying to reproduce this myself, it seems to work:\n\n    $ git mv supertest-3/ supertest-3-moved\n    $ git commit -m test\n    $ git show\ncommit 463ce75588378a8c5c0ba1fd427cd02c87e2078a (HEAD -> master)\nAuthor: Stefan Beller <sbeller@google.com>\nDate:   Wed Jan 9 14:31:09 2019 -0800\n\n    test\n\ndiff --git a/.gitmodules b/.gitmodules\nindex bf393d9..80e7d91 100644\n--- a/.gitmodules\n+++ b/.gitmodules\n@@ -1,3 +1,3 @@\n [submodule \"supertest-3\"]\n-       path = supertest-3\n+       path = supertest-3-moved\n        url = https://github.com/stefanbeller/supertest-3\ndiff --git a/supertest-3 b/supertest-3-moved\nsimilarity index 100%\nrename from supertest-3\nrename to supertest-3-moved\n\nThe difference is that I did not rename the submodule\nname, which is crucial, as that determines the superprojects\naccess to the submodules. (The sed command in the\ndemo causes the name to change)\nBut this doesn't seem to be the issue of this bug report.\n\nThe core issue is whether --submodule=log is given,\nas that will also produce the line\n    $ git show --submodule=log\n    [...]\nSubmodule supertest-3 636b587...636b587 (commits not present)\n\nI think to fix this, we'd want to pipe struct diff_filepair *p\nfrom run_diff_cmd through builtin_diff to\nshow_submodule_summary and show_submodule_inline_diff\nwhich both use show_submodule_header, which could\ncheck for a rename of the submodule via\np->status == DIFF_STATUS_RENAMED\nand then act appropriately.\n\nStefan\n"}]}