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

Re: Git 2.36, ls-tree submodule regression?

From
Bryan Turner <bturner@atlassian.com>
Date
Apr 7, 2022, 01:29 UTC
Message-ID
<CAGyf7-FiAjQGh8vo-oA6j8SH4se2rpU4_09dzUgxmE7Ohy72Kw@mail.gmail.com>
In-Reply-To
<CAGyf7-FjqrGYTUwdS=a6nsUnbn0qD9=Pf2Nx=gy6g8KGVRJivw@mail.gmail.com>
On Wed, Apr 6, 2022 at 5:34 PM Bryan Turner <bturner@atlassian.com> wrote:
Show 86 quoted lines
>
> In the test suite for Bitbucket Server, we have a test repository[1]
> which has a commit that has a .gitmodules file that lists 3
> submodules, each of which has an entry in the tree with "Subproject
> commit <SHA>".
>
> The submodules aren't fetched (at least one of them doesn't actually
> exist anywhere to fetch), but running git ls-tree in Git 2.35.1 and
> prior shows the expected tree data:
>
> $ git ls-tree -r -l ecf42d8adc4d7eb4386e37882d053704067712d4: --
> 100644 blob c0de405f50ea72f9d2b973dd504671ba63ea7189     346 .gitmodules
> 100644 blob 493021b1c9e0ecfebcd5ebce646a44138bc60b39      20
> add_file/add_file.txt
> 100644 blob d8c00a7fe6eb6a00378e103a46e3c472c084a949      25
> basic_branching/file.txt
> 100644 blob 927b01c060cf0dc5036e19abeab8e332d9075ea0     167 binary/B.zip
> 100644 blob 72555d02a139700be930a6734b57c5fab84512b9     167 binary/C.zip
> 100644 blob 72555d02a139700be930a6734b57c5fab84512b9     167 binary/D.zip
> 100644 blob 668076c308990933c2df66efb87b946704252486      46
> branch_mod_merge/file.txt
> 100644 blob b1d99e581f0bb8138b8997f9268294e41faee05b      33
> modification/mod_file.txt
> 100644 blob 46fa903c8af8a92c2714a47ae5a341a99c2ee3b2      18 moved_dir/file.txt
> 100644 blob f49abb7d6c366e6f83470e36439bc162234d7963      24
> mv_file/moved_file.txt
> 100644 blob 2e6b03cbbe90d3c9afcfc98967a5a71b4c9cff1a      66
> out_of_order/file.txt
> 160000 commit 0ac826865ce7e8bc76022d49424f52e09b16dc87       -
> submodule/atlassian-refapp
> 160000 commit 92b18c97d9d92d2bd02cfd1d268f22fddddafb67       -
> submodule/bamboo-git-plugin
> 160000 commit 996b4f5a7e242a29fe573582d98f5174142bb97c       - submodule/stash
> 120000 blob 4cbb553f3f4ac2ee7b01ff6c951d6bf583c39c15      10 symlink/link.txt
> 100644 blob 57a3592bb2cf8e76e2faef7660945a2fe0e24360      27 symlink/target.txt
>
> The same ls-tree command in 2.36.0-rc0 fails:
>
> $ /opt/git/2.36.0-rc0/bin/git ls-tree -r -l
> ecf42d8adc4d7eb4386e37882d053704067712d4: --
> 100644 blob c0de405f50ea72f9d2b973dd504671ba63ea7189     346 .gitmodules
> 100644 blob 493021b1c9e0ecfebcd5ebce646a44138bc60b39      20
> add_file/add_file.txt
> 100644 blob d8c00a7fe6eb6a00378e103a46e3c472c084a949      25
> basic_branching/file.txt
> 100644 blob 927b01c060cf0dc5036e19abeab8e332d9075ea0     167 binary/B.zip
> 100644 blob 72555d02a139700be930a6734b57c5fab84512b9     167 binary/C.zip
> 100644 blob 72555d02a139700be930a6734b57c5fab84512b9     167 binary/D.zip
> 100644 blob 668076c308990933c2df66efb87b946704252486      46
> branch_mod_merge/file.txt
> 100644 blob b1d99e581f0bb8138b8997f9268294e41faee05b      33
> modification/mod_file.txt
> 100644 blob 46fa903c8af8a92c2714a47ae5a341a99c2ee3b2      18 moved_dir/file.txt
> 100644 blob f49abb7d6c366e6f83470e36439bc162234d7963      24
> mv_file/moved_file.txt
> 100644 blob 2e6b03cbbe90d3c9afcfc98967a5a71b4c9cff1a      66
> out_of_order/file.txt
> 160000 commit 0ac826865ce7e8bc76022d49424f52e09b16dc87       -
> submodule/atlassian-refapp
> error: Could not read 0ac826865ce7e8bc76022d49424f52e09b16dc87
> fatal: Invalid commit 0ac826865ce7e8bc76022d49424f52e09b16dc87 in
> submodule path submodule/atlassian-refapp
>
> Bisecting the error selects:
>
> $ git bisect good
> 9c4d58ff2c385f49585197c8650356955e1fa02e is the first bad commit
> commit 9c4d58ff2c385f49585197c8650356955e1fa02e
> Author: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
> Date:   Wed Mar 23 17:13:15 2022 +0800
>
>     ls-tree: split up "fast path" callbacks
>
>     Make the various if/else in the callbacks for the "fast path" a lot
>     easier to read by just using common functions for the parts that are
>     common, and have per-format callbacks for those parts that are
>     different.
>
>     Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
>     Signed-off-by: Teng Long <dyroneteng@gmail.com>
>     Signed-off-by: Junio C Hamano <gitster@pobox.com>
>
>  builtin/ls-tree.c | 199 ++++++++++++++++++++++++++++++++++--------------------
>  1 file changed, 125 insertions(+), 74 deletions(-)
>
> (I've CC'd Ævar and Teng on this message.)

Actually, it looks like Ævar might already have a fix up for it in [2]. I'll see if I can apply that patch locally and verify it.

Best regards, Bryan Turner

[2] https://lore.kernel.org/git/patch-v2-1.1-ed83b3b74ab-20220404T234507Z-avarab@gmail.com/
Previous: Bryan TurnerNext: Bryan Turner
Message 2 of 6 in “Git 2.36, ls-tree submodule regression?”
  1. Bryan TurnerApr 7, 2022
  2. Bryan TurnerApr 7, 2022
  3. Bryan TurnerApr 7, 2022
  4. Teng LongApr 7, 2022
  5. Johannes SchindelinApr 7, 2022
  6. Junio C HamanoApr 7, 2022

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.