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

[PATCH v3 0/7] Make submodules work if .gitmodules is not checked out

From
Antonio Ospite <ao2@ao2.it>
Date
Aug 14, 2018, 11:05 UTC
Message-ID
<20180814110525.17801-1-ao2@ao2.it>
Hi,

this series teaches git to try and read the .gitmodules file from the current branch (HEAD:.gitmodules) when it's not readily available in the working tree.

This can be used, along with sparse checkouts, to enable submodule usage with programs like vcsh[1] which manage multiple repositories with their working trees sharing the same path.

[1] https://github.com/RichiH/vcsh

This is v3 of the series from: https://public-inbox.org/git/20180802134634.10300-1-ao2@ao2.it/

The cover letter of the first proposal contains more background: https://public-inbox.org/git/20180514105823.8378-1-ao2@ao2.it/

Changes since v2:
  * Removed the extern keyword from the public declaration of
    print_config_from_gitmodules() and
    config_set_in_gitmodules_file_gently()
  * Used test_when_finished in t/t7411-submodule-config.sh and remove
    the problematic commits as soon as they are not needed anymore.
  * Restructured the code in module_config to avoid an unreachable
    section, the code now dies as a fallback if the arguments are not
    supported, as suggested by Jeff.
  * Dropped patches and tests about "submodule--helper config --stage"
    as they are not strictly needed for now and there is no immediate
    benefit from them.
  * Added a check to git-submodule.sh::cdm_add to make it fail earlier
    if the .gitmodules file is not "safely writeable". This also fixes
    one of the new tests which was previously marked as
    "test_expect_failure".
  * Fixed a broken &&-chain in a subshell in one of the new tests, the
    issue was exposed by a recent change in master.
  * Dropped a note about "git rm" and "git mv", it was intended as
    a personal reminder and not for the general public.
  * Squashed t7416-submodule-sparse-gitmodules.sh in the same commit of
    the code it exercises.
  * Dropped the two unrelated patches from v2:
    
      - dir: move is_empty_file() from builtin/am.c to dir.c and make it
        public
      - submodule: remove the .gitmodules file when it is empty
    as they are orthogonal to this series. I will send them as
    a standalone series.
  * Minor wording fixes here and there.

The series looks a lot cleaner and more to the point, thanks for the review.

Ciao,
   Antonio
Antonio Ospite (7):
  submodule: add a print_config_from_gitmodules() helper
  submodule: factor out a config_set_in_gitmodules_file_gently function
  t7411: be nicer to future tests and really clean things up
  submodule--helper: add a new 'config' subcommand
  submodule: use the 'submodule--helper config' command
  t7506: clean up .gitmodules properly before setting up new scenario
  submodule: support reading .gitmodules even when it's not checked out
 builtin/submodule--helper.c            | 29 +++++++++
 cache.h                                |  1 +
 git-submodule.sh                       | 15 +++--
 new                                    |  0
 submodule-config.c                     | 53 ++++++++++++++-
 submodule-config.h                     |  3 +
 submodule.c                            | 10 +--
 t/t7411-submodule-config.sh            | 33 +++++++++-
 t/t7416-submodule-sparse-gitmodules.sh | 90 ++++++++++++++++++++++++++
 t/t7506-status-submodule.sh            |  3 +-
 10 files changed, 221 insertions(+), 16 deletions(-)
 create mode 100644 new
 create mode 100755 t/t7416-submodule-sparse-gitmodules.sh
-- 
Antonio Ospite
https://ao2.it
https://twitter.com/ao2it

A: Because it messes up the order in which people normally read text.
   See http://en.wikipedia.org/wiki/Posting_style
Q: Why is top-posting such a bad thing?
Next: Antonio Ospite
Message 1 of 20 in “Make submodules work if .gitmodules is not checked out”
  1. 0/7 Make submodules work if .gitmodules is not checked outAntonio Ospite, Aug 14, 2018
  2. 6/7 t7506: clean up .gitmodules properly before setting up new scenarioAntonio Ospite, Aug 14, 2018
  3. 5/7 submodule: use the 'submodule--helper config' commandAntonio Ospite, Aug 14, 2018
  4. Brandon WilliamsAug 14, 2018
  5. 7/7 submodule: support reading .gitmodules even when it's not checked outAntonio Ospite, Aug 14, 2018
  6. Brandon WilliamsAug 14, 2018
  7. Junio C HamanoAug 14, 2018
  8. Antonio OspiteAug 20, 2018
  9. Antonio OspiteAug 22, 2018
  10. Junio C HamanoAug 22, 2018
  11. Antonio OspiteAug 23, 2018
  12. 3/7 t7411: be nicer to future tests and really clean things upAntonio Ospite, Aug 14, 2018
  13. Brandon WilliamsAug 14, 2018
  14. Junio C HamanoAug 14, 2018
  15. Antonio OspiteAug 20, 2018
  16. 1/7 submodule: add a print_config_from_gitmodules() helperAntonio Ospite, Aug 14, 2018
  17. 2/7 submodule: factor out a config_set_in_gitmodules_file_gently functionAntonio Ospite, Aug 14, 2018
  18. 4/7 submodule--helper: add a new 'config' subcommandAntonio Ospite, Aug 14, 2018
  19. Brandon WilliamsAug 14, 2018
  20. Antonio OspiteAug 20, 2018

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.