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

Re: [Outreachy] [PATCH v4] diff: do not show submodule with untracked files as "-dirty"

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 26, 2020, 17:36 UTC
Message-ID
<xmqqblgoga8m.fsf@gitster.c.googlers.com>
In-Reply-To
<CAHjREB6fC6j30MH1Lb7enE3KJaGdX--Ft8+hwVeDfwApab5FNQ@mail.gmail.com>
Sangeeta NB <sangunb09@gmail.com> writes:
Show 23 quoted lines
>> > -     git diff HEAD >actual &&
>> > +     git diff --ignore-submodules=none HEAD >actual &&
>> >       sed -e "1,/^@@/d" actual >actual.body &&
>> >       expect_from_to >expect.body $subprev $subprev-dirty &&
>> >       test_cmp expect.body actual.body &&
>> >       git diff --ignore-submodules=all HEAD >actual2 &&
>> >       test_must_be_empty actual2 &&
>> > -     git diff --ignore-submodules=untracked HEAD >actual3 &&
>> > +     git diff HEAD >actual3 &&
>>
>> This line can be left as-is, no?
>
> Ya, they can be left as it is but I removed the
> --ignore-submodules=untracked because we also have to check the
> default git behavior and adding that doesn't change anything in the
> code so I removed that.
> In general, in all the tests I followed this practice:
> 1. I added --ignore-submodules=none where there were no options
> specified(as this was the earlier default)
> 2. I removed --ignore-submodules=untracked(as this should even work if
> no options are specified)
>
> I would put that back if you still want it?

OK, I re-read the changes to the tests in v5 (an excerpt at the end of this message), and I think this one makes sort-of sense.

We want to see that a plain-vanilla invocation of "git diff" without custom "--ignore-submodules" option would stop saying -dirty when untracked cruft is in the submodule's working tree, and this test, as it says in its title, is exactly testing that case (i.e. "how is a submodule without change relative to the gitlink in the superproject shown when there is untracked cruft there?"). It is a perfect opportunity to give the answer to the question and how that answer will be different from the current system if we took this patch. We used to expect to see that submodule has changed from the commit subprev to the same commit subprev with dirty indicator. What should we expect under the new world order? We should stop claiming that submodule has any change.

So I would have expected that would be shown by the first step in first "what happens without custom --ignore-submodules invocation?" test by changing the expect_from_to that corresponds to it, and then a *new* test added to show that with "--ignore-submodules=none" it is still possible to get "changed from the same commit to the same commit with the -dirty indicator" as a second test.

As long as all cases (i.e. all possible values to --ignore-submodules=<what>, plus the case where --ignore-submodules=<what> is not given at all) are covered, it is OK, but I think it is the best to show the case without an option, especially when the original does so.

Thanks.
@@ -168,13 +177,13 @@ test_expect_success 'git diff HEAD with dirty submodule (untracked, refs match)'
 		git clean -qfdx &&
 		>cruft
 	) &&
-	git diff HEAD >actual &&
+	git diff --ignore-submodules=none HEAD >actual &&
 	sed -e "1,/^@@/d" actual >actual.body &&
 	expect_from_to >expect.body $subprev $subprev-dirty &&
 	test_cmp expect.body actual.body &&
 	git diff --ignore-submodules=all HEAD >actual2 &&
 	test_must_be_empty actual2 &&
-	git diff --ignore-submodules=untracked HEAD >actual3 &&
+	git diff HEAD >actual3 &&
 	test_must_be_empty actual3 &&
 	git diff --ignore-submodules=dirty HEAD >actual4 &&
 	test_must_be_empty actual4
Previous: Sangeeta NBNext: Sangeeta Jain
Message 23 of 36 in “diff: do not show submodule with untracked files as "-dirty"”
  1. diff: do not show submodule with untracked files as "-dirty"Sangeeta via GitGitGadget, Oct 15, 2020
  2. Phillip WoodOct 20, 2020
  3. Sangeeta NBOct 20, 2020
  4. Phillip WoodOct 21, 2020
  5. [Outreachy] [PATCH v2] diff: do not show submodule with untracked files as "-dirty"Sangeeta Jain, Oct 21, 2020
  6. Eric SunshineOct 21, 2020
  7. Sangeeta NBOct 21, 2020
  8. Eric SunshineOct 21, 2020
  9. [Outreachy] [PATCH v3] diff: do not show submodule with untracked files as "-dirty"Sangeeta Jain, Oct 22, 2020
  10. Junio C HamanoOct 22, 2020
  11. Sangeeta NBOct 23, 2020
  12. Junio C HamanoOct 23, 2020
  13. Sangeeta NBOct 23, 2020
  14. Junio C HamanoOct 23, 2020
  15. Sangeeta NBOct 23, 2020
  16. diff: do not show submodule with untracked files as "-dirty"Sangeeta Jain, Oct 23, 2020
  17. Junio C HamanoOct 23, 2020
  18. Sangeeta NBOct 23, 2020
  19. Junio C HamanoOct 23, 2020
  20. [Outreachy] [PATCH v4] diff: do not show submodule with untracked files as "-dirty"Sangeeta Jain, Oct 23, 2020
  21. Junio C HamanoOct 23, 2020
  22. Sangeeta NBOct 25, 2020
  23. Junio C HamanoOct 26, 2020
  24. [Outreachy] [PATCH v5] diff: do not show submodule with untracked files as "-dirty"Sangeeta Jain, Oct 23, 2020
  25. [Outreachy][PATCH v6] diff: do not show submodule with untracked files as "-dirty"Sangeeta Jain, Oct 26, 2020
  26. SangeetaNov 3, 2020
  27. Junio C HamanoNov 3, 2020
  28. SangeetaNov 7, 2020
  29. Junio C HamanoDec 8, 2020
  30. Đoàn Trần Công DanhNov 7, 2020
  31. SangeetaNov 9, 2020
  32. Junio C HamanoNov 9, 2020
  33. [Outreachy][PATCH v7] diff: do not show submodule with untracked files as "-dirty"Sangeeta Jain, Nov 10, 2020
  34. Đoàn Trần Công DanhNov 10, 2020
  35. SangeetaDec 8, 2020
  36. Junio C HamanoDec 8, 2020

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.