"Derrick Stolee via GitGitGadget" <gitgitgadget@xxxxxxxxx> writes: > From: Derrick Stolee <dstolee@xxxxxxxxxxxxx> > > Add some tests to demonstrate the current behavior around adding files > outside of the sparse-checkout cone. Currently, untracked files are > handled differently from tracked files. A future change will make these > cases be handled the same way. > > Further expand checking that a failed 'git add' does not stage changes > to the index. > > Signed-off-by: Derrick Stolee <dstolee@xxxxxxxxxxxxx> > --- > t/t1092-sparse-checkout-compatibility.sh | 28 ++++++++++++++++++++++++ > 1 file changed, 28 insertions(+) > > diff --git a/t/t1092-sparse-checkout-compatibility.sh b/t/t1092-sparse-checkout-compatibility.sh > index 886e78715fe..3fb764f5eb9 100755 > --- a/t/t1092-sparse-checkout-compatibility.sh > +++ b/t/t1092-sparse-checkout-compatibility.sh > @@ -187,6 +187,16 @@ test_sparse_match () { > test_cmp sparse-checkout-err sparse-index-err > } > > +test_sparse_unstaged () { > + file=$1 && > + for repo in sparse-checkout sparse-index > + do > + git -C $repo status --porcelain >$repo-out && > + ! grep "^A $file\$" $repo-out && > + ! grep "^M $file\$" $repo-out || return 1 Is addition and modification very special, as opposed to other kinds of changes? Is the reason why we say "we do not want to see addition nor modification" here because there is no concrete X that we can say "we do want to see X" in various callers of this helper? I am also wondering, if this is asserting that $file is not added to the index, why we are using "git status" and not "ls-files", for example. Wouldn't test_must_fail git ls-files --error-unmatch "$file" be a more direct way to do so?