git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v4 2/2] diff: add SUBMODULE_DIFF format to display submodule diff

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 11, 2016, 17:53 UTC
Message-ID
<xmqqd1lf2nvj.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20160810231908.26330-2-jacob.e.keller@intel.com>
Jacob Keller <jacob.e.keller@intel.com> writes:
Show 18 quoted lines
> From: Jacob Keller <jacob.keller@gmail.com>
>
> Teach git-diff and friends a new format for displaying the difference of
> a submodule using git-diff inside the submodule project. This allows
> users to easily see exactly what source changed in a given commit that
> updates the submodule pointer. To do this, remove DIFF_SUBMODULE_LOG bit
> from the diff options, and instead add a new enum type for these
> formats.
>
> Signed-off-by: Jacob Keller <jacob.keller@gmail.com>
> ---
>  Documentation/diff-config.txt  |  3 +-
>  Documentation/diff-options.txt |  6 ++--
>  diff.c                         | 41 ++++++++++++++++----------
>  diff.h                         |  9 +++++-
>  submodule.c                    | 67 ++++++++++++++++++++++++++++++++++++++++++
>  submodule.h                    |  6 ++++
>  6 files changed, 113 insertions(+), 19 deletions(-)
This looks good.

You'd want some tests to make sure that the "--submodule" and the "--submodule=<format>" command line options and the diff.submodule configuration variables are parsed correctly (and when combined, the command line option overrides the configured default), and of course the machinery does the right thing, with and without "--graph" when used in "git log".

Show 14 quoted lines
> diff --git a/Documentation/diff-options.txt b/Documentation/diff-options.txt
> index e7b729f3644f..988068225463 100644
> --- a/Documentation/diff-options.txt
> +++ b/Documentation/diff-options.txt
> @@ -215,8 +215,10 @@ any of those replacements occurred.
>  	the commits in the range like linkgit:git-submodule[1] `summary` does.
>  	Omitting the `--submodule` option or specifying `--submodule=short`,
>  	uses the 'short' format. This format just shows the names of the commits
> -	at the beginning and end of the range.  Can be tweaked via the
> -	`diff.submodule` configuration variable.
> +	at the beginning and end of the range. When `--submodule=diff` is
> +	given, the 'diff' format is used. This format shows the diff between
> +	the old and new submodule commmit from the perspective of the
> +	submodule.  Can be tweaked via the `diff.submodule` configuration variable.

This is carried over from the existing text, but "Can be tweaked via" sounds a bit wasteful (and strange); "Defaults to" (or "The default is taken from") is the phrase we seem to use more often.

Thanks.
Previous: Jacob KellerNext: Jacob Keller
Message 3 of 8 in “diff: add --line-prefix option for passing in a prefix”
  1. 1/2 diff: add --line-prefix option for passing in a prefixJacob Keller, Aug 10, 2016
  2. 2/2 diff: add SUBMODULE_DIFF format to display submodule diffJacob Keller, Aug 10, 2016
  3. Junio C HamanoAug 11, 2016
  4. Jacob KellerAug 11, 2016
  5. Junio C HamanoAug 11, 2016
  6. Junio C HamanoAug 11, 2016
  7. Jacob KellerAug 11, 2016
  8. Junio C HamanoAug 11, 2016

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.