Re: [PATCH] pathspec: die on empty strings as pathspec
- From
Torsten Bögershausen <tboegi@web.de>
- Date
- Jun 23, 2017, 20:52 UTC
- Message-ID
- <802ccd37-c09a-8343-63fe-a42c682a8311@web.de>
- In-Reply-To
- <xmqqzicyeg2p.fsf@gitster.mtv.corp.google.com>
On 23/06/17 20:04, Junio C Hamano wrote:
> Junio C Hamano <gitster@pobox.com> writes:
Sorry for my mess, see below
Show 64 quoted lines
> >> I am not sure if we even want the dot there, but at least that is >> what the original author of the test intended to do when s/he >> decided to pass an empty string as the pathspec. >> >> t/t0027-auto-crlf.sh | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) > > I'll queue the following _before_ your "final step", so that the > whole thing can be advanced to 'next' and hopefully to 'master' in > some future releases. > > Given that we ourselves did not even notice until now that one of > our scripts get broken by this "final step", even though we kept > issuing the warning message, we may want to re-think our overall > strategy for deprecation. We've assumed that "keep behaving as > before but warn for a few years and then finally give a hard > failure" would be sufficient, but depending on how the script that > employ our programs hide the warnings from the end users, that may > not be a good enough transition strategy. > > At the same time we re-think the deprecation strategy, we also need > to see if we can update our test framework to help us better. > Ideally, we could have caught this existing breakage of passing "" > as pathspec in the test soon after we went into "keep behaving as > before but warn" stage. We didn't and found it out only when we > switched to "finally give a hard failure" stage. That is very > unsatisfactory. > > Needless to say, neither of the above two comes from _your_ change. > It's just something we need to improve in a larger scope of the > whole project I realized. > > Thanks. > > -- >8 -- > Subject: [PATCH] t0027: do not use an empty string as a pathspec element > > In an upcoming update, we will finally make an empty string illegal > as an element in a pathspec; it traditionally meant the same as ".", > i.e. include everything, so update this test that passes "" to pass > a dot instead. > > At this point in the test sequence, there is no modified path that > need to be further added before committing; the working tree is > empty except for .gitattributes which was just added to the index. > So we could instead pass no pathspec, but this is a conversion more > faithful to the original. > > Signed-off-by: Junio C Hamano <gitster@pobox.com> > --- > t/t0027-auto-crlf.sh | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/t/t0027-auto-crlf.sh b/t/t0027-auto-crlf.sh > index 93725895a4..e41c9b3bb2 100755 > --- a/t/t0027-auto-crlf.sh > +++ b/t/t0027-auto-crlf.sh > @@ -322,7 +322,7 @@ test_expect_success 'setup master' ' > echo >.gitattributes && > git checkout -b master && > git add .gitattributes && > - git commit -m "add .gitattributes" "" && > + git commit -m "add .gitattributes" . &&
Reading the context here, there shouldn't be a "pathspec" at all, as .gitattributes had been added just one line above.
The line should have been from the very beginning: git commit -m "add .gitattributes" &&
# What do you think ?
> printf "\$Id: 0000000000000000000000000000000000000000 \$\nLINEONE\nLINETWO\nLINETHREE" >LF && > printf "\$Id: 0000000000000000000000000000000000000000 \$\r\nLINEONE\r\nLINETWO\r\nLINETHREE" >CRLF && > printf "\$Id: 0000000000000000000000000000000000000000 \$\nLINEONE\r\nLINETWO\nLINETHREE" >CRLF_mix_LF && >