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

[PATCH v2 0/8] Improvements for ref storage formats with submodules

From
Patrick Steinhardt <ps@pks.im>
Date
Aug 8, 2024, 07:35 UTC
Message-ID
<cover.1723102259.git.ps@pks.im>
In-Reply-To
<CA+osTZVApTAMogBDMaPDEVViJHrFT=BOer=Py4fjTvpsifzfKA@mail.gmail.com>
Hi,

this is the second version of my patch series that aims to improve interaction of ref storage formats with submodules.

Changes compared to v1:
  - I noticed that `git submodule add` also used to fail when used with
    a preexisting repository that uses a different ref format.
  - Add a preparatory refactoring that wraps overly long command lines
    in "git-submodule.sh".
  - Wire up support for `--ref-format=` in `git submodule add`.

Notably not included is a change to make `git submodule add/clone` honor the ref storage format of the parent repository. I think it is somewhat orthogonal to the changes I do in this series, and it is not entirely obvious whether it is a good idea or not. We can still do this in a future patch series, if we ever hear good arguments for it.

Thanks!
Patrick Steinhardt (8):
  git-submodule.sh: break overly long command lines
  builtin/submodule: allow cloning with different ref storage format
  builtin/clone: propagate ref storage format to submodules
  refs: fix ref storage format for submodule ref stores
  builtin/submodule: allow "add" to use different ref storage format
  submodule: fix leaking fetch tasks
  submodule: fix leaking seen submodule names
  object: fix leaking packfiles when closing object store
 Documentation/git-submodule.txt        |  10 +-
 builtin/clone.c                        |  10 +-
 builtin/submodule--helper.c            |  46 +++++++-
 git-submodule.sh                       |  82 ++++++++++++--
 object.c                               |   9 ++
 refs.c                                 |   2 +-
 submodule.c                            |  18 ++--
 t/t5572-pull-submodule.sh              |   1 +
 t/t7418-submodule-sparse-gitmodules.sh |   1 +
 t/t7424-submodule-mixed-ref-formats.sh | 144 +++++++++++++++++++++++++
 10 files changed, 298 insertions(+), 25 deletions(-)
 create mode 100755 t/t7424-submodule-mixed-ref-formats.sh
Range-diff against v1:
-:  ---------- > 1:  6513c6b17d git-submodule.sh: break overly long command lines
1:  a450759bd1 = 2:  e6cda43878 builtin/submodule: allow cloning with different ref storage format
2:  e5923c0b33 = 3:  ed314f5333 builtin/clone: propagate ref storage format to submodules
3:  aaff9134ed ! 4:  f13356581e refs: fix ref storage format for submodule ref stores
    @@ Commit message
             $ git pull --recursive
             fatal: Unable to find current revision in submodule path 'path/to/sub'
     
    -    Fix the bug by using the submodule repository's ref storage format
    -    instead.
    +    The same issue occurs when adding a repository contained in the working
    +    tree with a different ref storage format via `git submodule add`.
     
    -    Note that only the second added test fails without this fix. The other
    -    one is included regardless as it exercises other parts where we might
    -    end up accessing submodule ref stores.
    +    Fix the bug by using the submodule repository's ref storage format
    +    instead and add some tests. Note that the test for `git submodule
    +    status` was included as a precaution, only. The command worked alright
    +    even without the bugfix.
     
         Reported-by: Jeppe Øland <joland@gmail.com>
         Signed-off-by: Patrick Steinhardt <ps@pks.im>
    @@ t/t7424-submodule-mixed-ref-formats.sh: do
     +	# Some tests migrate the ref storage format, which does not work with
     +	# reflogs at the time of writing these tests.
     +	git config set --global core.logAllRefUpdates false
    ++'
    ++
    ++test_expect_success 'add existing repository with different ref storage format' '
    ++	test_when_finished "rm -rf parent" &&
    ++
    ++	git init parent &&
    ++	(
    ++		cd parent &&
    ++		test_commit parent &&
    ++		git init --ref-format=$OTHER_FORMAT submodule &&
    ++		test_commit -C submodule submodule &&
    ++		git submodule add ./submodule
    ++	)
      '
      
      test_expect_success 'recursive clone propagates ref storage format' '
-:  ---------- > 5:  4ce17e44a1 builtin/submodule: allow "add" to use different ref storage format
4:  8f8371c18a = 6:  d92770290f submodule: fix leaking fetch tasks
5:  732142aaa6 = 7:  e9421189ca submodule: fix leaking seen submodule names
6:  8dc7cc76d5 = 8:  d05737c75f object: fix leaking packfiles when closing object store
-- 
2.46.0.46.g406f326d27.dirty
Previous: Patrick SteinhardtNext: Patrick Steinhardt
Message 24 of 35 in “2.46 submodule breakage”
  1. Jeppe ØlandAug 5, 2024
  2. Jeppe ØlandAug 6, 2024
  3. Eric SunshineAug 6, 2024
  4. Patrick SteinhardtAug 7, 2024
  5. Patrick SteinhardtAug 7, 2024
  6. Junio C HamanoAug 7, 2024
  7. 0/6 Improvements for ref storage formats with submodulesPatrick Steinhardt, Aug 7, 2024
  8. 1/6 builtin/submodule: allow cloning with different ref storage formatPatrick Steinhardt, Aug 7, 2024
  9. Jeppe ØlandAug 7, 2024
  10. Junio C HamanoAug 7, 2024
  11. Patrick SteinhardtAug 8, 2024
  12. Junio C HamanoAug 8, 2024
  13. Patrick SteinhardtAug 8, 2024
  14. Junio C HamanoAug 8, 2024
  15. 2/6 builtin/clone: propagate ref storage format to submodulesPatrick Steinhardt, Aug 7, 2024
  16. Junio C HamanoAug 7, 2024
  17. 3/6 refs: fix ref storage format for submodule ref storesPatrick Steinhardt, Aug 7, 2024
  18. 4/6 submodule: fix leaking fetch tasksPatrick Steinhardt, Aug 7, 2024
  19. 5/6 submodule: fix leaking seen submodule namesPatrick Steinhardt, Aug 7, 2024
  20. 6/6 object: fix leaking packfiles when closing object storePatrick Steinhardt, Aug 7, 2024
  21. Patrick SteinhardtAug 7, 2024
  22. Junio C HamanoAug 8, 2024
  23. Patrick SteinhardtAug 8, 2024
  24. 0/8 Improvements for ref storage formats with submodulesPatrick Steinhardt, Aug 8, 2024
  25. 1/8 git-submodule.sh: break overly long command linesPatrick Steinhardt, Aug 8, 2024
  26. 2/8 builtin/submodule: allow cloning with different ref storage formatPatrick Steinhardt, Aug 8, 2024
  27. 3/8 builtin/clone: propagate ref storage format to submodulesPatrick Steinhardt, Aug 8, 2024
  28. Kristoffer HaugsbakkAug 8, 2024
  29. Patrick SteinhardtAug 8, 2024
  30. 4/8 refs: fix ref storage format for submodule ref storesPatrick Steinhardt, Aug 8, 2024
  31. 5/8 builtin/submodule: allow "add" to use different ref storage formatPatrick Steinhardt, Aug 8, 2024
  32. 6/8 submodule: fix leaking fetch tasksPatrick Steinhardt, Aug 8, 2024
  33. 7/8 submodule: fix leaking seen submodule namesPatrick Steinhardt, Aug 8, 2024
  34. 8/8 object: fix leaking packfiles when closing object storePatrick Steinhardt, Aug 8, 2024
  35. Junio C HamanoAug 8, 2024

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.