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

Re: [PATCH v2 9/9] t7061: expect ignored files in untracked dirs

From
Junio C Hamano <gitster@pobox.com>
Date
May 8, 2017, 06:35 UTC
Message-ID
<xmqqy3u77t5c.fsf@gitster.mtv.corp.google.com>
In-Reply-To
<20170505104611.17845-10-sxlijin@gmail.com>
Samuel Lijin <sxlijin@gmail.com> writes:
Show 18 quoted lines
> We now expect `status --ignored` to list ignored files even if they are
> in an untracked directory.
>
> Signed-off-by: Samuel Lijin <sxlijin@gmail.com>
> ---
>  t/t7061-wtstatus-ignore.sh | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/t/t7061-wtstatus-ignore.sh b/t/t7061-wtstatus-ignore.sh
> index dc3be92a2..fc6013ba3 100755
> --- a/t/t7061-wtstatus-ignore.sh
> +++ b/t/t7061-wtstatus-ignore.sh
> @@ -9,9 +9,10 @@ cat >expected <<\EOF
>  ?? actual
>  ?? expected
>  ?? untracked/
> +!! untracked/ignored
>  EOF

In my comment on an earlier step (2/9, I think), I said it is unclear if the change in behaviour to "status --ignored" is a new bug you are introducing, or is a fix that happens as a side-effect.

I may be misunderstanding what the test that uses this expected output is trying to see, but to me, it seems that:

        --ignored::
                Show ignored files as well.

is clear enough that "status --ignored", regardless of the "--unracked" settings, should show the ignored file even when the directory it happens to be in does not have any file that is registerd in the index, and the expected output updated by this patch looks to me the one that we _should_ be expecting. IOW, the change in behaviour looks like a bugfix to me. And if that is indeed the case, the above change should be in the earlier patch that flips "expect_success" to "expect_failure". The "expected" file is prepared to expect the "correct" output before the code is updated to produce one (i.e. the test update declares that the current behaviour is broken), and then with changes in a later step (i.e. somewhere before 7/9) the code starts to produce the "correct" output at which point in that same patch you flip expect_failure into expect_success.

The log message of eb8c5b87 ("git-status: Test --ignored behavior", 2012-12-30) says otherwise, though. I am undecided, if I agree with the design decision described by the first two bullet points:

    commit eb8c5b872ef144add4ac89f85bcddc974ac7114d
    Author: Antoine Pelisse <apelisse@gmail.com>
    Date:   Sun Dec 30 15:39:01 2012 +0100
        git-status: Test --ignored behavior
        Test all possible use-cases of git-status "--ignored" with the
        "--untracked-files" option with values "normal" and "all":
         - An untracked directory is listed as untracked if it has a mix of
           untracked and ignored files in it.  With -uall, ignored/untracked
           files are listed as ignored/untracked.
         - An untracked directory with only ignored files is listed as
           ignored.  With -uall, all files in the directory are listed.
         - An ignored directory is listed as ignored. With -uall, all files
           in the directory are listed as ignored.
         - An ignored and committed directory is listed as ignored if it has
           untracked files.  With -uall, all untracked files in the
           directory are listed as ignored.
        Signed-off-by: Antoine Pelisse <apelisse@gmail.com>
        Signed-off-by: Junio C Hamano <gitster@pobox.com>
     t/t7061-wtstatus-ignore.sh | 146 +++++++++++++++++++++++++++++++++++++++++++++
     1 file changed, 146 insertions(+)
What do others think?

By the way, I wonder what the performance impact of this change would be. Do we end up needing to scan more parts of the filesystem, when we already know that a directory does not have any tracked paths?

Show 14 quoted lines
> -test_expect_failure 'status untracked directory with --ignored' '
> +test_expect_success 'status untracked directory with --ignored' '
>  	echo "ignored" >.gitignore &&
>  	mkdir untracked &&
>  	: >untracked/ignored &&
> @@ -20,7 +21,7 @@ test_expect_failure 'status untracked directory with --ignored' '
>  	test_cmp expected actual
>  '
>  
> -test_expect_failure 'same with gitignore starting with BOM' '
> +test_expect_success 'same with gitignore starting with BOM' '
>  	printf "\357\273\277ignored\n" >.gitignore &&
>  	mkdir -p untracked &&
>  	: >untracked/ignored &&
Previous: Samuel LijinNext: Junio C Hamano
Message 34 of 89 in “Bug Report: .gitignore behavior is not matching in git clean and git status”
  1. Chris JohnsonApr 28, 2017
  2. Junio C HamanoMay 1, 2017
  3. Chris JohnsonMay 1, 2017
  4. Junio C HamanoMay 1, 2017
  5. Samuel LijinMay 1, 2017
  6. Samuel LijinMay 1, 2017
  7. Junio C HamanoMay 2, 2017
  8. 0/7 Keep git clean -d from inadvertently removing ignored filesSamuel Lijin, May 3, 2017
  9. 1/7 t7300: skip untracked dirs containing ignored filesSamuel Lijin, May 3, 2017
  10. Stefan BellerMay 3, 2017
  11. Samuel LijinMay 3, 2017
  12. Stefan BellerMay 3, 2017
  13. 7/7 t7061: check for ignored file in untracked dirSamuel Lijin, May 3, 2017
  14. 5/7 dir: change linkage of cmp_name() and check_contains()Samuel Lijin, May 3, 2017
  15. 3/7 dir: add method to check if a dir_entry lexically contains anotherSamuel Lijin, May 3, 2017
  16. Stefan BellerMay 3, 2017
  17. 6/7 builtin/clean: teach clean -d to skip dirs containing ignored filesSamuel Lijin, May 3, 2017
  18. 2/7 dir: recurse into untracked dirs for ignored filesSamuel Lijin, May 3, 2017
  19. 4/7 dir: hide untracked contents of untracked dirsSamuel Lijin, May 3, 2017
  20. 0/9 Keep git clean -d from inadvertently removing ignored filesSamuel Lijin, May 5, 2017
  21. 1/9 t7300: skip untracked dirs containing ignored filesSamuel Lijin, May 5, 2017
  22. Torsten BögershausenMay 7, 2017
  23. Samuel LijinMay 8, 2017
  24. 2/9 t7061: expect failure where expected behavior will changeSamuel Lijin, May 5, 2017
  25. Junio C HamanoMay 8, 2017
  26. 4/9 dir: add method to check if a dir_entry lexically contains anotherSamuel Lijin, May 5, 2017
  27. 6/9 dir: change linkage of cmp_name() and check_contains()Samuel Lijin, May 5, 2017
  28. Junio C HamanoMay 8, 2017
  29. 3/9 dir: recurse into untracked dirs for ignored filesSamuel Lijin, May 5, 2017
  30. 7/9 builtin/clean: teach clean -d to skip dirs containing ignored filesSamuel Lijin, May 5, 2017
  31. 8/9 t7300: clean -d now skips untracked dirs containing ignored filesSamuel Lijin, May 5, 2017
  32. 5/9 dir: hide untracked contents of untracked dirsSamuel Lijin, May 5, 2017
  33. 9/9 t7061: expect ignored files in untracked dirsSamuel Lijin, May 5, 2017
  34. Junio C HamanoMay 8, 2017
  35. Junio C HamanoMay 8, 2017
  36. Samuel LijinMay 8, 2017
  37. Junio C HamanoMay 9, 2017
  38. 0/8 Fix clean -d and status --ignoredSamuel Lijin, May 16, 2017
  39. 1/8 t7300: clean -d should skip dirs with ignored filesSamuel Lijin, May 16, 2017
  40. 3/8 dir: recurse into untracked dirs for ignored filesSamuel Lijin, May 16, 2017
  41. Junio C HamanoMay 17, 2017
  42. Samuel LijinMay 17, 2017
  43. 2/8 t7061: status --ignored should search untracked dirsSamuel Lijin, May 16, 2017
  44. 4/8 dir: hide untracked contents of untracked dirsSamuel Lijin, May 16, 2017
  45. Junio C HamanoMay 17, 2017
  46. Samuel LijinMay 17, 2017
  47. Junio C HamanoMay 17, 2017
  48. 5/8 dir: expose cmp_name() and check_contains()Samuel Lijin, May 16, 2017
  49. 6/8 clean: teach clean -d to skip dirs containing ignored filesSamuel Lijin, May 16, 2017
  50. Junio C HamanoMay 18, 2017
  51. Samuel LijinMay 18, 2017
  52. 7/8 t7300: clean -d now skips untracked dirs containing ignored filesSamuel Lijin, May 16, 2017
  53. Junio C HamanoMay 18, 2017
  54. 8/8 t7061: status --ignored now searches untracked dirsSamuel Lijin, May 16, 2017
  55. Junio C HamanoMay 18, 2017
  56. 0/6 Fix clean -d and status --ignoredSamuel Lijin, May 18, 2017
  57. 1/6 t7300: clean -d should skip dirs with ignored filesSamuel Lijin, May 18, 2017
  58. 5/6 dir: expose cmp_name() and check_contains()Samuel Lijin, May 18, 2017
  59. Junio C HamanoMay 22, 2017
  60. 6/6 clean: teach clean -d to skip dirs containing ignored filesSamuel Lijin, May 18, 2017
  61. Junio C HamanoMay 22, 2017
  62. Samuel LijinMay 22, 2017
  63. Junio C HamanoMay 22, 2017
  64. Samuel LijinMay 23, 2017
  65. Junio C HamanoMay 23, 2017
  66. 3/6 dir: recurse into untracked dirs for ignored filesSamuel Lijin, May 18, 2017
  67. 2/6 t7061: status --ignored should search untracked dirsSamuel Lijin, May 18, 2017
  68. 4/6 dir: hide untracked contents of untracked dirsSamuel Lijin, May 18, 2017
  69. Junio C HamanoMay 22, 2017
  70. 0/6 Fix clean -d and status --ignoredSamuel Lijin, May 23, 2017
  71. 1/6 t7300: clean -d should skip dirs with ignored filesSamuel Lijin, May 23, 2017
  72. 2/6 t7061: status --ignored should search untracked dirsSamuel Lijin, May 23, 2017
  73. 3/6 dir: recurse into untracked dirs for ignored filesSamuel Lijin, May 23, 2017
  74. 5/6 dir: expose cmp_name() and check_contains()Samuel Lijin, May 23, 2017
  75. 4/6 dir: hide untracked contents of untracked dirsSamuel Lijin, May 23, 2017
  76. 6/6 clean: teach clean -d to preserve ignored pathsSamuel Lijin, May 23, 2017
  77. Junio C HamanoMay 23, 2017
  78. Samuel LijinMay 23, 2017
  79. 0/6 Fix clean -d and status --ignoredSamuel Lijin, May 23, 2017
  80. 1/6 t7300: clean -d should skip dirs with ignored filesSamuel Lijin, May 23, 2017
  81. 2/6 t7061: status --ignored should search untracked dirsSamuel Lijin, May 23, 2017
  82. 3/6 dir: recurse into untracked dirs for ignored filesSamuel Lijin, May 23, 2017
  83. 5/6 dir: expose cmp_name() and check_contains()Samuel Lijin, May 23, 2017
  84. 4/6 dir: hide untracked contents of untracked dirsSamuel Lijin, May 23, 2017
  85. 6/6 clean: teach clean -d to preserve ignored pathsSamuel Lijin, May 23, 2017
  86. Junio C HamanoMay 23, 2017
  87. Torsten BögershausenMay 24, 2017
  88. Samuel LijinMay 25, 2017
  89. Junio C HamanoMay 26, 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.