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

Re: [PATCH] pathspec: die on empty strings as pathspec

From
Emily Xie <emilyxxie@gmail.com>
Date
Jun 23, 2017, 02:34 UTC
Message-ID
<CAAin2ARfUCYM95L_k3fSQ--reQD3uMG72ah=Xg1xvvgKcU+QkQ@mail.gmail.com>
In-Reply-To
<xmqqfuf82xr5.fsf@gitster.mtv.corp.google.com>

I ran the tests and none of them failed. Technically, the state of the index would indeed be different with these new changes, but this shouldn't be an issue. In the current version, there's one only item added to the index that ends up getting used in subsequent tests. That is, foo1, which is tested in: 'git add --chmod=[+-]x stages correctly'.

With the current code, foo1 gets added to the index with a mode of
100644. When the 'git add --chmod=[+-]x stages correctly' test
executes, it removes foo1 from the working directory, creates a new
foo1, and runs 'git add --chmod=+x'. It then checks if foo1 is in the
index with a file mode of 100755.

Given how things are set up, the tests pass either way. But I think it'd actually be nicer with the new changes in this patch, as foo1 would not already be in the index by the time 'git add --chmod=[+-]x stages correctly' executes.

On Sat, Jun 10, 2017 at 1:54 AM, Junio C Hamano <gitster@pobox.com> wrote:
Show 24 quoted lines
>
> Emily Xie <emilyxxie@gmail.com> writes:
>
> > diff --git a/t/t3700-add.sh b/t/t3700-add.sh
> > index f3a4b4a..40a0d2b 100755
> > --- a/t/t3700-add.sh
> > +++ b/t/t3700-add.sh
> > @@ -331,9 +331,8 @@ test_expect_success 'git add --dry-run --ignore-missing of non-existing file out
> >       test_i18ncmp expect.err actual.err
> >  '
> >
> > -test_expect_success 'git add empty string should invoke warning' '
> > -     git add "" 2>output &&
> > -     test_i18ngrep "warning: empty strings" output
> > +test_expect_success 'git add empty string should fail' '
> > +     test_must_fail git add ""
> >  '
>
> Doesn't this affect the tests that follow this step?  We used to
> warn but went ahead and added all of them anyway, but now we fail
> without adding anything, which means that the state of the index
> before and after this patch would be different.
>
> >  test_expect_success 'git add --chmod=[+-]x stages correctly' '
Previous: Junio C HamanoNext: Junio C Hamano
Message 7 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.