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

Re: [PATCH v2] range-diff: allow to diff files regardless submodule

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Oct 12, 2018, 09:26 UTC
Message-ID
<nycvar.QRO.7.76.6.1810121124570.45@tvgsbejvaqbjf.bet>
In-Reply-To
<20181011081750.24240-1-lucas.demarchi@intel.com>
Hi Lucas,
On Thu, 11 Oct 2018, Lucas De Marchi wrote:
Show 10 quoted lines
> Do like it's done in grep so mode doesn't end up as
> 0160000, which means range-diff doesn't work if one has
> "submodule.diff = log" in the configuration. Without this
> while using range-diff I only get a
> 
>     Submodule a 0000000...0000000 (new submodule)
> 
> instead of the diff between the revisions.
> 
> Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com>
Thank you for this contribution, which I am glad to ACK.

I am especially happy that you added a regression test so that we are confident not to break this again.

Ciao, Dscho

Show 62 quoted lines
> ---
>  range-diff.c          |  2 +-
>  t/t3206-range-diff.sh | 29 +++++++++++++++++++++++++++++
>  2 files changed, 30 insertions(+), 1 deletion(-)
> 
> diff --git a/range-diff.c b/range-diff.c
> index 60edb2f518..bd8083f2d1 100644
> --- a/range-diff.c
> +++ b/range-diff.c
> @@ -354,7 +354,7 @@ static struct diff_filespec *get_filespec(const char *name, const char *p)
>  {
>  	struct diff_filespec *spec = alloc_filespec(name);
>  
> -	fill_filespec(spec, &null_oid, 0, 0644);
> +	fill_filespec(spec, &null_oid, 0, 0100644);
>  	spec->data = (char *)p;
>  	spec->size = strlen(p);
>  	spec->should_munmap = 0;
> diff --git a/t/t3206-range-diff.sh b/t/t3206-range-diff.sh
> index 045aca1c18..6aae364171 100755
> --- a/t/t3206-range-diff.sh
> +++ b/t/t3206-range-diff.sh
> @@ -122,6 +122,35 @@ test_expect_success 'changed commit' '
>  	test_cmp expected actual
>  '
>  
> +test_expect_success 'changed commit with sm config' '
> +	git range-diff --no-color --submodule=log topic...changed >actual &&
> +	cat >expected <<-EOF &&
> +	1:  4de457d = 1:  a4b3333 s/5/A/
> +	2:  fccce22 = 2:  f51d370 s/4/A/
> +	3:  147e64e ! 3:  0559556 s/11/B/
> +	    @@ -10,7 +10,7 @@
> +	      9
> +	      10
> +	     -11
> +	    -+B
> +	    ++BB
> +	      12
> +	      13
> +	      14
> +	4:  a63e992 ! 4:  d966c5c s/12/B/
> +	    @@ -8,7 +8,7 @@
> +	     @@
> +	      9
> +	      10
> +	    - B
> +	    + BB
> +	     -12
> +	     +B
> +	      13
> +	EOF
> +	test_cmp expected actual
> +'
> +
>  test_expect_success 'no commits on one side' '
>  	git commit --amend -m "new message" &&
>  	git range-diff master HEAD@{1} HEAD
> -- 
> 2.19.1.1.g8c3cf03f71
> 
> 
Previous: Lucas De MarchiNext: Junio C Hamano
Message 9 of 17 in “range-diff: allow to diff files regardless submodule”
  1. range-diff: allow to diff files regardless submoduleLucas De Marchi, Oct 10, 2018
  2. brian m. carlsonOct 11, 2018
  3. Lucas De MarchiOct 11, 2018
  4. Johannes SchindelinOct 12, 2018
  5. brian m. carlsonOct 12, 2018
  6. Ævar Arnfjörð BjarmasonOct 11, 2018
  7. Lucas De MarchiOct 11, 2018
  8. range-diff: allow to diff files regardless submoduleLucas De Marchi, Oct 11, 2018
  9. Johannes SchindelinOct 12, 2018
  10. Junio C HamanoOct 11, 2018
  11. Lucas De MarchiOct 23, 2018
  12. Junio C HamanoOct 24, 2018
  13. Lucas De MarchiOct 24, 2018
  14. Junio C HamanoOct 24, 2018
  15. Junio C HamanoOct 24, 2018
  16. Lucas De MarchiOct 24, 2018
  17. range-diff: allow to diff files regardless of submodule configLucas De Marchi, Oct 24, 2018

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.