git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / Atom feed
* Submodule log bug
@ 2019-01-02 22:14 David Turner
  2019-01-09 23:13 ` Stefan Beller
  0 siblings, 1 reply; 2+ messages in thread
From: David Turner @ 2019-01-02 22:14 UTC (permalink / raw)
  To: Git Mailing List

[-- Attachment #1: Type: text/plain, Size: 809 bytes --]

When a submodule is renamed, git log gives incorrect output:

commit 350ebece9bce8d9c495f9a51e6f5529749c5c3cc (HEAD -> master)
Author:
David Turner <novalis@novalis.org>
Date:   Wed Jan 2 17:09:56 2019 -0500

    move

diff --git a/.gitmodules b/.gitmodules
index da1a767..f4baf2a 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,3 @@
-[submodule "mymod"]
-	path = mymod
+[submodule "morx"]
+	path = morx
 	url = ../sub
Submodule mymod 86da4a4...86da4a4 (commits not present)

^-- I expect this last line to tell me that the submodule has been
renamed, rather than that it has changed SHA to the same SHA.

See the attached shell script for a demo of this.  I tested with
b21ebb671bb as well as 2.18 and 2.19.  Thanks to Adam Bliss
<abliss@twosigma.com> for helping to figure out the reproduction steps.

[-- Attachment #2: demo2.sh --]
[-- Type: application/x-shellscript, Size: 575 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: Submodule log bug
  2019-01-02 22:14 Submodule log bug David Turner
@ 2019-01-09 23:13 ` Stefan Beller
  0 siblings, 0 replies; 2+ messages in thread
From: Stefan Beller @ 2019-01-09 23:13 UTC (permalink / raw)
  To: David Turner; +Cc: Git Mailing List

On Wed, Jan 2, 2019 at 2:14 PM David Turner <novalis@novalis.org> wrote:
>
> When a submodule is renamed, git log gives incorrect output:
>
> commit 350ebece9bce8d9c495f9a51e6f5529749c5c3cc (HEAD -> master)
> Author:
> David Turner <novalis@novalis.org>
> Date:   Wed Jan 2 17:09:56 2019 -0500
>
>     move
>
> diff --git a/.gitmodules b/.gitmodules
> index da1a767..f4baf2a 100644
> --- a/.gitmodules
> +++ b/.gitmodules
> @@ -1,3 +1,3 @@
> -[submodule "mymod"]
> -       path = mymod
> +[submodule "morx"]
> +       path = morx
>         url = ../sub
> Submodule mymod 86da4a4...86da4a4 (commits not present)
>
> ^-- I expect this last line to tell me that the submodule has been
> renamed, rather than that it has changed SHA to the same SHA.

Trying to reproduce this myself, it seems to work:

    $ git mv supertest-3/ supertest-3-moved
    $ git commit -m test
    $ git show
commit 463ce75588378a8c5c0ba1fd427cd02c87e2078a (HEAD -> master)
Author: Stefan Beller <sbeller@google.com>
Date:   Wed Jan 9 14:31:09 2019 -0800

    test

diff --git a/.gitmodules b/.gitmodules
index bf393d9..80e7d91 100644
--- a/.gitmodules
+++ b/.gitmodules
@@ -1,3 +1,3 @@
 [submodule "supertest-3"]
-       path = supertest-3
+       path = supertest-3-moved
        url = https://github.com/stefanbeller/supertest-3
diff --git a/supertest-3 b/supertest-3-moved
similarity index 100%
rename from supertest-3
rename to supertest-3-moved

The difference is that I did not rename the submodule
name, which is crucial, as that determines the superprojects
access to the submodules. (The sed command in the
demo causes the name to change)
But this doesn't seem to be the issue of this bug report.

The core issue is whether --submodule=log is given,
as that will also produce the line
    $ git show --submodule=log
    [...]
Submodule supertest-3 636b587...636b587 (commits not present)

I think to fix this, we'd want to pipe struct diff_filepair *p
from run_diff_cmd through builtin_diff to
show_submodule_summary and show_submodule_inline_diff
which both use show_submodule_header, which could
check for a rename of the submodule via
p->status == DIFF_STATUS_RENAMED
and then act appropriately.

Stefan

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, back to index

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-02 22:14 Submodule log bug David Turner
2019-01-09 23:13 ` Stefan Beller

git@vger.kernel.org list mirror (unofficial, one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.org/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox