git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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 &&
> 
Previous: Junio C HamanoNext: Junio C Hamano
Message 11 of 12 in “pathspec: die on empty strings as pathspec”
  1. pathspec: die on empty strings as pathspecEmily Xie, Jun 7, 2017
  2. Junio C HamanoJun 9, 2017
  3. Jeff KingJun 10, 2017
  4. Junio C HamanoJun 10, 2017
  5. Brandon WilliamsJun 9, 2017
  6. Junio C HamanoJun 10, 2017
  7. Emily XieJun 23, 2017
  8. Junio C HamanoJun 23, 2017
  9. Junio C HamanoJun 23, 2017
  10. Junio C HamanoJun 23, 2017
  11. Torsten BögershausenJun 23, 2017
  12. Junio C HamanoJun 23, 2017

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.