Re: [PATCH v1] name-hash: properly fold directory names in adjust_dirname_case()
- From
Torsten Bögershausen <tboegi@web.de>
- Date
- Feb 8, 2018, 17:21 UTC
- Message-ID
- <20180208172153.GA30760@tor.lan>
- In-Reply-To
- <20180208004156.36224-1-benpeart@microsoft.com>
On Wed, Feb 07, 2018 at 07:41:56PM -0500, Ben Peart wrote: []
Show 21 quoted lines
> diff --git a/t/t0050-filesystem.sh b/t/t0050-filesystem.sh > index b29d749bb7..219c96594c 100755 > --- a/t/t0050-filesystem.sh > +++ b/t/t0050-filesystem.sh > @@ -80,7 +80,17 @@ test_expect_success 'merge (case change)' ' > git merge topic > ' > > - > +test_expect_success CASE_INSENSITIVE_FS 'add directory (with different case)' ' > + git reset --hard initial && > + mkdir -p dir1 && > + mkdir -p dir1/dir2 && > + touch dir1/dir2/a && > + touch dir1/dir2/b && > + git add dir1/dir2/a && > + git add dir1/DIR2/b && > + camel=$(git ls-files | grep dir2) && > + test $(echo "$camel" | wc -l) = 2 > +' >
There is nothing wrong with with "wc -l", but: a more new-style would probably use test_line_count() here.
My personal favorite would be to spell out what we expect and run a diff. When it fails, we can see what fails, and the function would look like this:
test_expect_success CASE_INSENSITIVE_FS 'add directory (with different case)' ' git reset --hard initial && mkdir -p dir1 && mkdir -p dir1/dir2 && touch dir1/dir2/a && touch dir1/dir2/b && git add dir1/dir2/a && git add dir1/DIR2/b && git ls-files | grep dir2 | sort >actual && cat >expected <<-\EOF && dir1/dir2/a dir1/dir2/b EOF test_cmp expected actual '