git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Philippe Blain <levraiphilippeblain@gmail.com>
To: Johannes Schindelin <johannes.schindelin@gmx.de>
Cc: Git mailing list <git@vger.kernel.org>
Subject: 'git range-diff' does not detect submodule changes if 'diff.submodule=log'
Date: Mon, 19 Jul 2021 16:43:54 -0400	[thread overview]
Message-ID: <e469038c-d78c-cd4b-0214-7094746b9281@gmail.com> (raw)

Hi Johannes,

I noticed that 'git range-diff' silently "drops" submodule changes if
'diff.submodule=log' is set in the config. This is because the 'diff --git'
header is not shown in that case, and the code in range-diff.c::read_patches
expects that header to be found to detect changes.

If 'diff.submodule' is instead set to 'diff', the range-diff outright errors with
(at least in my case):

error: git apply: bad git-diff - inconsistent old filename on line 1
error: could not parse git header 'diff --git path/to/submodule/and/some/file/within
'
error: could not parse log for '@{u}..@{1}'


I think it would make sense to force '--submodule=short' for range-diff, something like:

diff --git a/range-diff.c b/range-diff.c
index 1a4471fe4c..d74b9c7a55 100644
--- a/range-diff.c
+++ b/range-diff.c
@@ -54,7 +54,7 @@ static int read_patches(const char *range, struct string_list *list,

         strvec_pushl(&cp.args, "log", "--no-color", "-p", "--no-merges",
                      "--reverse", "--date-order", "--decorate=no",
-                    "--no-prefix",
+                    "--no-prefix", "--submodule=short",
                      /*
                       * Choose indicators that are not used anywhere
                       * else in diffs, but still look reasonable


What do you think ?

Thanks,
Philippe.

P.S. As an aside,
I'm  not sure why you chose to skip the 'diff --git' header with '--submodule=log'
(I did not search the list), but I think that in general 'git diff' and friends,
it would be nice to be able to still see this header even with --submodule=log...

             reply	other threads:[~2021-07-19 23:16 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-19 20:43 Philippe Blain [this message]
2021-07-22 13:19 ` 'git range-diff' does not detect submodule changes if 'diff.submodule=log' Johannes Schindelin
2021-07-22 22:42   ` Philippe Blain

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=e469038c-d78c-cd4b-0214-7094746b9281@gmail.com \
    --to=levraiphilippeblain@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=johannes.schindelin@gmx.de \
    /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).