* [RESEND PATCH] diff: recurse into nested submodules for inline diff
@ 2017-05-04 21:43 Stefan Beller
2017-05-06 1:24 ` Jacob Keller
0 siblings, 1 reply; 3+ messages in thread
From: Stefan Beller @ 2017-05-04 21:43 UTC (permalink / raw)
To: jacob.keller, gitster; +Cc: git, Stefan Beller
When fd47ae6a5b (diff: teach diff to display submodule difference with an
inline diff, 2016-08-31) was introduced, we did not think of recursing
into nested submodules.
When showing the inline diff for submodules, automatically recurse
into nested submodules as well with inline submodule diffs.
Signed-off-by: Stefan Beller <sbeller@google.com>
---
This is a resend of
https://public-inbox.org/git/20170331231733.11123-3-sbeller@google.com/
In the cover letter of that patch, I said I would want to redo the tests with
scrubbed output. However given the widespread use of unscrubbed output,
I think this is fine as-is to include.
Thanks,
Stefan
submodule.c | 3 +-
t/t4060-diff-submodule-option-diff-format.sh | 41 ++++++++++++++++++++++++++++
2 files changed, 43 insertions(+), 1 deletion(-)
diff --git a/submodule.c b/submodule.c
index d3299e29c0..2d56a9562e 100644
--- a/submodule.c
+++ b/submodule.c
@@ -554,7 +554,8 @@ void show_submodule_inline_diff(FILE *f, const char *path,
cp.no_stdin = 1;
/* TODO: other options may need to be passed here. */
- argv_array_push(&cp.args, "diff");
+ argv_array_pushl(&cp.args, "diff", "--submodule=diff", NULL);
+
argv_array_pushf(&cp.args, "--line-prefix=%s", line_prefix);
if (DIFF_OPT_TST(o, REVERSE_DIFF)) {
argv_array_pushf(&cp.args, "--src-prefix=%s%s/",
diff --git a/t/t4060-diff-submodule-option-diff-format.sh b/t/t4060-diff-submodule-option-diff-format.sh
index d4a3ffa69c..33ec26d755 100755
--- a/t/t4060-diff-submodule-option-diff-format.sh
+++ b/t/t4060-diff-submodule-option-diff-format.sh
@@ -775,4 +775,45 @@ test_expect_success 'diff --submodule=diff with moved nested submodule HEAD' '
test_cmp expected actual
'
+test_expect_success 'diff --submodule=diff recurses into nested submodules' '
+ cat >expected <<-EOF &&
+ Submodule sm2 contains modified content
+ Submodule sm2 a5a65c9..280969a:
+ diff --git a/sm2/.gitmodules b/sm2/.gitmodules
+ new file mode 100644
+ index 0000000..3a816b8
+ --- /dev/null
+ +++ b/sm2/.gitmodules
+ @@ -0,0 +1,3 @@
+ +[submodule "nested"]
+ + path = nested
+ + url = ../sm2
+ Submodule nested 0000000...b55928c (new submodule)
+ diff --git a/sm2/nested/file b/sm2/nested/file
+ new file mode 100644
+ index 0000000..ca281f5
+ --- /dev/null
+ +++ b/sm2/nested/file
+ @@ -0,0 +1 @@
+ +nested content
+ diff --git a/sm2/nested/foo8 b/sm2/nested/foo8
+ new file mode 100644
+ index 0000000..db9916b
+ --- /dev/null
+ +++ b/sm2/nested/foo8
+ @@ -0,0 +1 @@
+ +foo8
+ diff --git a/sm2/nested/foo9 b/sm2/nested/foo9
+ new file mode 100644
+ index 0000000..9c3b4f6
+ --- /dev/null
+ +++ b/sm2/nested/foo9
+ @@ -0,0 +1 @@
+ +foo9
+ EOF
+ git diff --submodule=diff >actual 2>err &&
+ test_must_be_empty err &&
+ test_cmp expected actual
+'
+
test_done
--
2.13.0.rc1.18.g9ce9a66034
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [RESEND PATCH] diff: recurse into nested submodules for inline diff
2017-05-04 21:43 [RESEND PATCH] diff: recurse into nested submodules for inline diff Stefan Beller
@ 2017-05-06 1:24 ` Jacob Keller
2017-05-08 0:46 ` Junio C Hamano
0 siblings, 1 reply; 3+ messages in thread
From: Jacob Keller @ 2017-05-06 1:24 UTC (permalink / raw)
To: Stefan Beller; +Cc: Junio C Hamano, Git mailing list
On Thu, May 4, 2017 at 2:43 PM, Stefan Beller <sbeller@google.com> wrote:
> When fd47ae6a5b (diff: teach diff to display submodule difference with an
> inline diff, 2016-08-31) was introduced, we did not think of recursing
> into nested submodules.
>
> When showing the inline diff for submodules, automatically recurse
> into nested submodules as well with inline submodule diffs.
>
> Signed-off-by: Stefan Beller <sbeller@google.com>
> ---
>
> This is a resend of
> https://public-inbox.org/git/20170331231733.11123-3-sbeller@google.com/
>
> In the cover letter of that patch, I said I would want to redo the tests with
> scrubbed output. However given the widespread use of unscrubbed output,
> I think this is fine as-is to include.
>
> Thanks,
> Stefan
Fix looks obviously correct to me. I would like to change the tests to
not use the unscrubbed output, but that's a problem for a separate
patch.
Thanks,
Jake
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [RESEND PATCH] diff: recurse into nested submodules for inline diff
2017-05-06 1:24 ` Jacob Keller
@ 2017-05-08 0:46 ` Junio C Hamano
0 siblings, 0 replies; 3+ messages in thread
From: Junio C Hamano @ 2017-05-08 0:46 UTC (permalink / raw)
To: Jacob Keller; +Cc: Stefan Beller, Git mailing list
Jacob Keller <jacob.keller@gmail.com> writes:
> On Thu, May 4, 2017 at 2:43 PM, Stefan Beller <sbeller@google.com> wrote:
>> When fd47ae6a5b (diff: teach diff to display submodule difference with an
>> inline diff, 2016-08-31) was introduced, we did not think of recursing
>> into nested submodules.
>>
>> When showing the inline diff for submodules, automatically recurse
>> into nested submodules as well with inline submodule diffs.
>>
>> Signed-off-by: Stefan Beller <sbeller@google.com>
>> ---
>>
>> This is a resend of
>> https://public-inbox.org/git/20170331231733.11123-3-sbeller@google.com/
>>
>> In the cover letter of that patch, I said I would want to redo the tests with
>> scrubbed output. However given the widespread use of unscrubbed output,
>> I think this is fine as-is to include.
>>
>> Thanks,
>> Stefan
>
> Fix looks obviously correct to me. I would like to change the tests to
> not use the unscrubbed output, but that's a problem for a separate
> patch.
OK.
Thanks, both.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-05-08 0:46 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-05-04 21:43 [RESEND PATCH] diff: recurse into nested submodules for inline diff Stefan Beller
2017-05-06 1:24 ` Jacob Keller
2017-05-08 0:46 ` Junio C Hamano
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).