git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Stefan Beller <sbeller@google.com>
To: David Turner <novalis@novalis.org>
Cc: Git Mailing List <git@vger.kernel.org>
Subject: Re: Submodule log bug
Date: Wed, 9 Jan 2019 15:13:02 -0800	[thread overview]
Message-ID: <CAGZ79kbfmxPKZBzRpH2T=WHBjbzORiAyiFPFbPD0R+fQW7XuXg@mail.gmail.com> (raw)
In-Reply-To: <df37313acafdb4bb74c71e476e5acab10248b1a2.camel@novalis.org>

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

      reply	other threads:[~2019-01-09 23:13 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-02 22:14 Submodule log bug David Turner
2019-01-09 23:13 ` Stefan Beller [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAGZ79kbfmxPKZBzRpH2T=WHBjbzORiAyiFPFbPD0R+fQW7XuXg@mail.gmail.com' \
    --to=sbeller@google.com \
    --cc=git@vger.kernel.org \
    --cc=novalis@novalis.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).