git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Sangeeta NB <sangunb09@gmail.com>
Cc: Git List <git@vger.kernel.org>
Subject: Re: [Outreachy] [PATCH v4] diff: do not show submodule with untracked files as "-dirty"
Date: Mon, 26 Oct 2020 10:36:41 -0700	[thread overview]
Message-ID: <xmqqblgoga8m.fsf@gitster.c.googlers.com> (raw)
In-Reply-To: <CAHjREB6fC6j30MH1Lb7enE3KJaGdX--Ft8+hwVeDfwApab5FNQ@mail.gmail.com> (Sangeeta NB's message of "Sun, 25 Oct 2020 15:53:49 +0530")

Sangeeta NB <sangunb09@gmail.com> writes:

>> > -     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

  reply	other threads:[~2020-10-26 17:36 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-15 17:08 [PATCH] diff: do not show submodule with untracked files as "-dirty" Sangeeta via GitGitGadget
2020-10-20 13:38 ` [OUTREACHY][PATCH] " Phillip Wood
2020-10-20 18:10   ` Sangeeta NB
2020-10-21 11:28     ` Phillip Wood
2020-10-21 13:10 ` [Outreachy] [PATCH v2] " Sangeeta Jain
2020-10-21 17:43   ` Eric Sunshine
2020-10-21 19:40     ` Sangeeta NB
2020-10-21 23:04       ` Eric Sunshine
2020-10-22 11:22 ` [Outreachy] [PATCH v3] " Sangeeta Jain
2020-10-22 18:07   ` Junio C Hamano
2020-10-23  5:23     ` Sangeeta NB
2020-10-23 15:19       ` Junio C Hamano
2020-10-23 18:17         ` Sangeeta NB
2020-10-23 18:55           ` Junio C Hamano
2020-10-23 19:08             ` Sangeeta NB
2020-10-23 11:17 ` [PATCH v4] " Sangeeta Jain
2020-10-23 15:56   ` Junio C Hamano
2020-10-23 18:32     ` Sangeeta NB
2020-10-23 20:22       ` Junio C Hamano
2020-10-23 11:18 ` [Outreachy] " Sangeeta Jain
2020-10-23 21:28   ` Junio C Hamano
2020-10-25 10:23     ` Sangeeta NB
2020-10-26 17:36       ` Junio C Hamano [this message]
2020-10-23 19:29 ` [Outreachy] [PATCH v5] " Sangeeta Jain
2020-10-26 17:57 ` [Outreachy][PATCH v6] " Sangeeta Jain
2020-11-03 10:46   ` Sangeeta
2020-11-03 17:55     ` Junio C Hamano
2020-11-07 10:47       ` Sangeeta
2020-12-08 21:02         ` Junio C Hamano
2020-11-07 11:10   ` Đoàn Trần Công Danh
2020-11-09 15:19     ` Sangeeta
2020-11-09 17:01       ` Junio C Hamano
2020-11-10  8:39 ` [Outreachy][PATCH v7] " Sangeeta Jain
2020-11-10 17:09   ` Đoàn Trần Công Danh
2020-12-08 13:36   ` Sangeeta
2020-12-08 22:26     ` Junio C Hamano

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=xmqqblgoga8m.fsf@gitster.c.googlers.com \
    --to=gitster@pobox.com \
    --cc=git@vger.kernel.org \
    --cc=sangunb09@gmail.com \
    /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).