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

Re: Strange diff-index with fsmonitor, submodules

From
Junio C Hamano <gitster@pobox.com>
Date
Aug 29, 2023, 01:20 UTC
Message-ID
<xmqqcyz6fxvf.fsf@gitster.g>
In-Reply-To
<20230829005606.136615-1-jonathantanmy@google.com>
Jonathan Tan <jonathantanmy@google.com> writes:
Show 6 quoted lines
> There is a strange interaction where diff-index not only produces
> different results when run with and without fsmonitor, but produces
> different results for 2 entries that as far as I can tell, should behave
> identically (sibling files in the same directory - file_11 and file_12,
> and both of these filenames are only mentioned once each in the entire
> test).

Picking those who had non-clean-up changes to fsmonitor out of the output from

    $ git shortlog -n --since=2.year --no-merges ':(glob)**/*fsmonitor*'
and adding them to CC: for their attention.
Show 56 quoted lines
> You can see this with this patch:
>
> diff --git a/t/t7527-builtin-fsmonitor.sh b/t/t7527-builtin-fsmonitor.sh
> index 0c241d6c14..e9e5e32016 100755
> --- a/t/t7527-builtin-fsmonitor.sh
> +++ b/t/t7527-builtin-fsmonitor.sh
> @@ -809,6 +809,11 @@ my_match_and_clean () {
>                 status --porcelain=v2 >actual.without &&
>         test_cmp actual.with actual.without &&
>  
> +       git -C super --no-optional-locks diff-index --name-status HEAD >actual.with &&
> +       git -C super --no-optional-locks -c core.fsmonitor=false \
> +               diff-index --name-status HEAD >actual.without &&
> +       test_cmp actual.with actual.without &&
> +
>         git -C super/dir_1/dir_2/sub reset --hard &&
>         git -C super/dir_1/dir_2/sub clean -d -f
>  }
> @@ -837,6 +842,7 @@ test_expect_success 'submodule always visited' '
>         # some dirt in the submodule and confirm matching output.
>  
>         # Completely clean status.
> +       echo Now running for clean status &&
>         my_match_and_clean &&
>
> and this is the output:
>
> ++ echo Now running for clean status
> Now running for clean status
> ++ my_match_and_clean
> ++ git -C super --no-optional-locks status --porcelain=v2
> ++ git -C super --no-optional-locks -c core.fsmonitor=false status --porcelain=v2
> ++ test_cmp actual.with actual.without
> ++ test 2 -ne 2
> ++ eval 'diff -u' '"$@"'
> +++ diff -u actual.with actual.without
> ++ git -C super --no-optional-locks diff-index --name-status HEAD
> ++ git -C super --no-optional-locks -c core.fsmonitor=false diff-index --name-status HEAD
> ++ test_cmp actual.with actual.without
> ++ test 2 -ne 2
> ++ eval 'diff -u' '"$@"'
> +++ diff -u actual.with actual.without
> --- actual.with	2023-08-29 00:39:26
> +++ actual.without	2023-08-29 00:39:26
> @@ -1 +0,0 @@
> -D	dir_1/file_11
> error: last command exited with $?=1
> not ok 61 - submodule always visited
>
> Notice that with fsmonitor, diff-index reports a "D" line that is not
> present when fsmonitor is off. To add to that, it only reports "D" for
> file_11 when I would expect that if it reported file_11, it would report
> file_12 as well.
>
> I'll continue investigating this myself, but does anyone know what is
> going on?
Previous: Jonathan TanNext: Jeff Hostetler
Message 2 of 18 in “Strange diff-index with fsmonitor, submodules”
  1. Jonathan TanAug 29, 2023
  2. Junio C HamanoAug 29, 2023
  3. Jeff HostetlerAug 29, 2023
  4. Jeff HostetlerAug 29, 2023
  5. Jonathan TanAug 29, 2023
  6. [diff-lib] Fix check_removed when fsmonitor is onJosip Sokcevic, Sep 6, 2023
  7. Jonathan TanSep 6, 2023
  8. diff-lib: Fix check_removed when fsmonitor is onJosip Sokcevic, Sep 7, 2023
  9. Jonathan TanSep 7, 2023
  10. Junio C HamanoSep 7, 2023
  11. Josip SokcevicSep 7, 2023
  12. Junio C HamanoSep 8, 2023
  13. diff-lib: Fix check_removed when fsmonitor is onJosip Sokcevic, Sep 11, 2023
  14. Junio C HamanoSep 11, 2023
  15. Josip SokcevicSep 12, 2023
  16. Junio C HamanoSep 12, 2023
  17. Josip SokcevicSep 14, 2023
  18. Junio C HamanoSep 18, 2023

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.