From: Eric Sunshine <sunshine@sunshineco.com>
To: Sangeeta Jain <sangunb09@gmail.com>
Cc: Git List <git@vger.kernel.org>,
Phillip Wood <phillip.wood123@gmail.com>,
Kaartic Sivaraam <kaartic.sivaraam@gmail.com>,
Junio C Hamano <gitster@pobox.com>
Subject: Re: [Outreachy] [PATCH v2] diff: do not show submodule with untracked files as "-dirty"
Date: Wed, 21 Oct 2020 13:43:03 -0400 [thread overview]
Message-ID: <CAPig+cSi1SSZTS86-6_0gDCeDqPCEvT+Lh3gLXe--Y1PDJSDfw@mail.gmail.com> (raw)
In-Reply-To: <20201021131012.20703-1-sangunb09@gmail.com>
On Wed, Oct 21, 2020 at 9:10 AM Sangeeta Jain <sangunb09@gmail.com> wrote:
> [...]
> This patch makes `git diff HEAD` consistent with `git describe --dirty`
> when a submodule contains untracked files by making
> `--ignore-submodules=untracked` the default.
> [...]
> Signed-off-by: Sangeeta Jain <sangunb09@gmail.com>
> ---
> diff --git a/diff.c b/diff.c
> @@ -4585,6 +4585,9 @@ void repo_diff_setup(struct repository *r, struct diff_options *options)
> + if(!options->flags.ignore_submodule_set)
> + options->flags.ignore_untracked_in_submodules = 1;
Style nit: insert a space between 'if' and the opening parenthesis
> diff --git a/submodule.c b/submodule.c
> @@ -1678,6 +1679,8 @@ unsigned is_submodule_modified(const char *path, int ignore_untracked)
> if (ignore_untracked)
> strvec_push(&cp.args, "-uno");
> + else
> + strvec_push (&cp.args, "--ignore-submodules=none");
Style nit: use TAB for indentation, not spaces
Style nit: drop space between 'strvec_push' and open parenthesis
> diff --git a/t/t7064-wtstatus-pv2.sh b/t/t7064-wtstatus-pv2.sh
> @@ -503,6 +503,31 @@ test_expect_success 'untracked changes in added submodule (AM S..U)' '
> +test_expect_success 'untracked changes in added submodule (A. S...) (untracked ignored)' '
> + ( cd super_repo &&
> + ## create untracked file in the submodule.
> + ( cd sub1 &&
> + echo "xxxx" >file_in_sub
> + ) &&
I realize that you're following style of some, but not all tests, in
this file, but current the way we format subshells these days is:
(
cd foo &&
...
) &&
Whether you should adopt modern style or use existing style is a
judgment call. (If I was doing this, I might be inclined to follow
modern style rather than introducing even more of the unwanted old
style.)
But for really silly stuff like the 'echo', you don't need a subshell
at all, so it would be cleaner to write it like this without the
subshell:
echo "xxxx" >sub1/file_in_sub &&
(But again, I see that you're just following local style.)
> +test_expect_success 'staged and untracked changes in added submodule (AM S.M.) (untracked ignored)' '
> + ( cd super_repo &&
> + ( cd sub1 &&
> + ## stage new changes in tracked file.
> + git add file_in_sub &&
> + ## create new untracked file.
> + echo "yyyy" >>another_file_in_sub
> + ) &&
These days, `git` also understands -C, so this subshell likewise is
not necessary, and:
git -C sub1 add file_in_sub &&
echo "yyyy" >>sub1/another_file_in_sub
would be equivalent. (But perhaps that diverges too much from existing
style in the file? It's a judgment call.)
> diff --git a/t/t7506-status-submodule.sh b/t/t7506-status-submodule.sh
> @@ -94,36 +94,60 @@ test_expect_success 'status with added file in submodule (short)' '
> +test_expect_success 'status with untracked file in submodule (untracked ignored)' '
> + (cd sub && git reset --hard) &&
These one-liner subshells are super common in this particular script.
These days we'd write this as:
git -C sub reset --hard &&
Again, it's a judgment call whether to go with modern style or follow
existing style of the file.
Another option is to have a preparatory patch which first modernizes
the script, and then your new tests would follow modern style. But,
that may be outside of scope of your submission.
To summarize: The only really actionable review comments are the minor
style nits in the C code. The nits about style issues in the tests are
judgement calls, and could be handled (by someone) at a later date.
next prev parent reply other threads:[~2020-10-21 17:43 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 [this message]
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
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=CAPig+cSi1SSZTS86-6_0gDCeDqPCEvT+Lh3gLXe--Y1PDJSDfw@mail.gmail.com \
--to=sunshine@sunshineco.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=kaartic.sivaraam@gmail.com \
--cc=phillip.wood123@gmail.com \
--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).