{"thread":{"id":"63359","subject":"Shallow checkout of submodules","startedAt":"2025-04-28T04:04:29Z","lastAt":"2025-04-28T04:04:29Z","messageCount":1,"participants":["Pavel Pavlov"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"516871","messageId":"CAG_s-qqdzzB=ft4ibymVNfx8o0puFDTOnuwtHrvwgEyUP8Mfig@mail.gmail.com","threadId":"63359","inReplyTo":null,"subject":"Shallow checkout of submodules","fromName":"Pavel Pavlov","fromEmail":"pavlov.pavel@gmail.com","sentAt":"2025-04-28T04:04:14Z","receivedAt":"2025-04-28T04:04:29Z","isPatch":false,"sender":{"key":"pavlov.pavel@gmail.com","avatar":null},"body":"Hi,\n\nI've noticed that in some cases shallow checkout of submodules checks\nout the entire history (and takes longer to fetch and make much larger\nsize repo).\n\nI created two repos to show the issue.\nhttps://github.com/pps83/submodule-test-ok\nhttps://github.com/pps83/submodule-test-bad\n\nBoth are effectively identical: a readme file with a shallow submodule.\nsubmodule-test-ok links to\nhttps://github.com/pps83/brotli-master-min/tree/1e6f9b4b4c98f6f99ba9a860cbb982346631df80\nsubmodule-test-bad links to\nhttps://github.com/pps83/brotli-master/tree/1e6f9b4b4c98f6f99ba9a860cbb982346631df80\n\nNote, the hashes are identical (repos are different\n`brotli-master-min` vs `brotli-master`).\n\nIf you checkout submodule-test-bad\n```\ngit clone https://github.com/pps83/submodule-test-bad.git\ncd submodule-test-bad\ntime git submodule update --progress --init --force\ncd ..\n```\nentire `submodule-test-bad` is 34MB and takes a long time to fetch (if\nyou are in some remote location with slow internet).\n\nIf you checkout submodule-test-ok\n```\ngit clone https://github.com/pps83/submodule-test-ok.git\ncd submodule-test-ok\ntime git submodule update --progress --init --force\ncd ..\n```\nentire `submodule-test-ok` is only 2.9MB and takes a second to fetch.\nAt the end the only difference is in the `.git` folders, while\ncontents of these two repos are identical.\n\nNot sure if that's a git issue, or github. But the issue happens\nbecause of the default branch settings in the repo. In short, shallow\ncheckout of a submodule from a non-default branch on github results in\na full checkout.\n\nThanks,\nPavel\n"}]}