git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Victoria Dye <vdye@github.com>
To: Raghul Nanth A <nanth.raghul@gmail.com>, git@vger.kernel.org
Cc: derrickstolee@github.com
Subject: Re: [GSOC][PATCH v1] diff-index: enable diff-index
Date: Wed, 5 Apr 2023 10:53:20 -0700	[thread overview]
Message-ID: <91d3fd23-8120-db65-481a-e9f56017bb04@github.com> (raw)
In-Reply-To: <20230403190538.361840-1-nanth.raghul@gmail.com>

Raghul Nanth A wrote:
> diff --git a/t/perf/p2000-sparse-operations.sh b/t/perf/p2000-sparse-operations.sh
> index 3242cfe91a..9e74cb22b9 100755
> --- a/t/perf/p2000-sparse-operations.sh
> +++ b/t/perf/p2000-sparse-operations.sh
> @@ -125,5 +125,7 @@ test_perf_on_all git checkout-index -f --all
>  test_perf_on_all git update-index --add --remove $SPARSE_CONE/a
>  test_perf_on_all "git rm -f $SPARSE_CONE/a && git checkout HEAD -- $SPARSE_CONE/a"
>  test_perf_on_all git grep --cached --sparse bogus -- "f2/f1/f1/*"
> +test_perf_on_all git diff-index HEAD
> +test_perf_on_all git diff-index HEAD~1

What is the benefit of testing 'diff-index' with 'HEAD' *and* 'HEAD~1'? I
wouldn't expect internal behavior in the command to change based on the
revision, so the performance should be nearly identical. I'd much rather see
'diff-index --cached' and/or other options & pathspecs exercised.

>  
>  test_done
> diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh
> index 801919009e..13801f327d 100755
> --- a/t/t1092-sparse-checkout-compatibility.sh
> +++ b/t/t1092-sparse-checkout-compatibility.sh
> @@ -1996,6 +1996,24 @@ test_expect_success 'sparse index is not expanded: rm' '
>  	ensure_not_expanded rm -r deep
>  '
>  
> +test_expect_success 'sparse index is not expanded: diff-index' '
> +	init_repos &&
> +
> +	echo "new" >>sparse-index/g &&
> +	git -C sparse-index add g &&
> +	git -C sparse-index commit -m "dummy" &&
> +	ensure_not_expanded diff-index HEAD~1

As with the other tests, please exercise different options and pathspecs
with 'diff-index' to improve coverage.

> +'
> +
> +test_expect_success 'match all: diff-index' '
> +	init_repos &&
> +
> +	test_all_match git diff-index HEAD &&
> +	run_on_all rm g &&
> +	test_all_match git diff-index HEAD &&
> +	test_all_match git diff-index HEAD --cached
> +'

In addition to the '--cached' option, please test different pathspecs
(especially different wildcard variations; see the 'git grep' [1] and 'git
diff-files' [2] integrations for examples you could build off of).

Seeing that 'diff-files' needed 'pathspec_needs_expanded_index', it's
possible that this command needs similar treatment. I'm curious as to
whether 'diff' needs it as well - the tests in 't1092' don't cover 'diff'
with pathspecs, so it might be behaving incorrectly. If that's the case, it
would be nice to see pathspecs handled all in one place
('run_diff_index()'?), if possible.

[1] https://lore.kernel.org/git/20220923041842.27817-1-shaoxuan.yuan02@gmail.com/
[2] https://lore.kernel.org/git/20230322161820.3609-1-cheskaqiqi@gmail.com/

> +
>  test_expect_success 'grep with and --cached' '
>  	init_repos &&
>  


  parent reply	other threads:[~2023-04-05 17:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-03 19:05 [GSOC][PATCH v1] diff-index: enable diff-index Raghul Nanth A
2023-04-04  0:16 ` Junio C Hamano
2023-04-05 17:53 ` Victoria Dye [this message]
2023-04-05 19:28   ` Junio C Hamano
2023-04-08 11:23 ` [GSOC][PATCH v2] diff-index: enable sparse index Raghul Nanth A
2023-04-13 21:14   ` Victoria Dye
2023-04-19 15:15     ` RAGHUL NANTH
2023-04-22 21:25       ` Shuqi Liang
2023-05-02  9:46         ` [GSOC] " Raghul Nanth A
2023-05-02 17:35           ` Victoria Dye

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=91d3fd23-8120-db65-481a-e9f56017bb04@github.com \
    --to=vdye@github.com \
    --cc=derrickstolee@github.com \
    --cc=git@vger.kernel.org \
    --cc=nanth.raghul@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.
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 NNTP newsgroup(s).