Re: [RFC PATCH v2 4/4] config: add setting to ignore sparsity patterns in some cmds
From: Matheus Tavares Bernardino <hidden>
Date: 2020-05-10 04:23:51
On Sat, May 9, 2020 at 9:42 PM Matheus Tavares [off-list ref] wrote:
quoted hunk ↗ jump to hunk
diff --git a/t/t7817-grep-sparse-checkout.sh b/t/t7817-grep-sparse-checkout.sh index 3bd67082eb..8509694bf1 100755 --- a/t/t7817-grep-sparse-checkout.sh +++ b/t/t7817-grep-sparse-checkout.sh@@ -63,12 +63,28 @@ test_expect_success 'setup' ' test_path_is_file sub/B/b ' +# The two tests bellow check a special case: the sparsity patterns exclude '/b' +# and sparse checkout is enable, but the path exists on the working tree (e.g. +# manually created after `git sparse-checkout init`). In this case, grep should +# honor --restrict-to-sparse-paths.
I just want to highlight a small thing that I forgot to comment on: Elijah and I had already discussed about --restrict-to-sparse-paths being relevant in grep only with --cached or when a commit-ish is given. But it had not occurred to me, before, the possibility of the special case mentioned above. I.e. when searching in the working tree and a path that should be excluded by the sparsity patterns is present. In this patch, I let --restrict-to-sparse-paths control the desired behavior for grep in this case too. But please, let me know if that doesn't seem like a good idea.