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

[PATCH v5 0/9] Make submodules work if .gitmodules is not checked out

From
Antonio Ospite <ao2@ao2.it>
Date
Sep 17, 2018, 14:09 UTC
Message-ID
<20180917140940.3839-1-ao2@ao2.it>
Hi,

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

This can be used, together 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

v4 of the series is here: https://public-inbox.org/git/20180824132951.8000-1-ao2@ao2.it/

v3 of the series is here: https://public-inbox.org/git/20180814110525.17801-1-ao2@ao2.it/

v2 of the series is here: https://public-inbox.org/git/20180802134634.10300-1-ao2@ao2.it/

v1 of the series, with some background info, is here: https://public-inbox.org/git/20180514105823.8378-1-ao2@ao2.it/

v5 only contains some small cosmetic fixes suggested by Ævar Arnfjörð Bjarmason, I ignored the comment about the memory leak in patch 1 because I think there is no leak in how git_config_parse_key is used: https://public-inbox.org/git/87wosfesxl.fsf@evledraar.gmail.com/

Changes since v4:
  * Improve names of local variables in patch 1.
  * Move new functions definitions in patches 1 and 2 before
    a pre-existing comment instead of after it, as the comment does not
    apply to the new functions.

I am repeating the previous changelog below for your convenience, as v3 is what is currently in pu/ao/submodule-wo-gitmodules-checked-out.

Changes between v3 and v4:
  * Improve robustness of current tests in t7411-submodule-config.sh:
      - merge two tests that check for effects of the same commit.
      - reset to a well defined point in history when exiting the tests.
  * Fix style issues in new tests added to t7411-submodule-config.sh:
      - use test_when_finished in new tests.
      - name the output file 'expect' instead of 'expected'.
  * Add a new "submodule--helper config --check-writeable" command.
  * Use "s--h config --check-wrteable" in git-submodule.sh to share the
    code with the C implementation instead of duplicating the safety
    check in shell script.
  * Add the ability to read .gitmodules from the index and then
    fall-back to the current branch if the file is not in the index.
    Add also more tests to validate all the possible scenarios.
  * Fix style issues in t7416-submodule-sparse-gitmodules.sh:
      - name the output file 'expect' instead of 'expected'.
      - remove white space after the redirection operator.
      - indent the HEREDOC block.
      - use "git -C super" instead of a subshell when there is only one
        command in the test.
  * Remove a stale file named 'new' which erroneously slipped in
    a commit.
  * Update some comments and commit messages.
Thank you,
   Antonio
Antonio Ospite (9):
  submodule: add a print_config_from_gitmodules() helper
  submodule: factor out a config_set_in_gitmodules_file_gently function
  t7411: merge tests 5 and 6
  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: add a helper to check if it is safe to write to .gitmodules
  submodule: support reading .gitmodules when it's not in the working
    tree
 builtin/submodule--helper.c            |  40 +++++++++
 cache.h                                |   2 +
 git-submodule.sh                       |  13 ++-
 submodule-config.c                     |  55 ++++++++++++-
 submodule-config.h                     |   2 +
 submodule.c                            |  28 +++++--
 submodule.h                            |   1 +
 t/t7411-submodule-config.sh            | 107 +++++++++++++++++++++----
 t/t7416-submodule-sparse-gitmodules.sh |  78 ++++++++++++++++++
 t/t7506-status-submodule.sh            |   3 +-
 10 files changed, 300 insertions(+), 29 deletions(-)
 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 23 in “Make submodules work if .gitmodules is not checked out”
  1. 0/9 Make submodules work if .gitmodules is not checked outAntonio Ospite, Sep 17, 2018
  2. 9/9 submodule: support reading .gitmodules when it's not in the working treeAntonio Ospite, Sep 17, 2018
  3. SZEDER GáborSep 18, 2018
  4. Junio C HamanoSep 19, 2018
  5. Antonio OspiteSep 20, 2018
  6. Junio C HamanoSep 21, 2018
  7. Antonio OspiteSep 27, 2018
  8. Antonio OspiteSep 24, 2018
  9. Stefan BellerSep 24, 2018
  10. Antonio OspiteSep 27, 2018
  11. Stefan BellerSep 27, 2018
  12. Antonio OspiteOct 1, 2018
  13. Stefan BellerOct 1, 2018
  14. 6/9 submodule: use the 'submodule--helper config' commandAntonio Ospite, Sep 17, 2018
  15. 3/9 t7411: merge tests 5 and 6Antonio Ospite, Sep 17, 2018
  16. 5/9 submodule--helper: add a new 'config' subcommandAntonio Ospite, Sep 17, 2018
  17. 7/9 t7506: clean up .gitmodules properly before setting up new scenarioAntonio Ospite, Sep 17, 2018
  18. 2/9 submodule: factor out a config_set_in_gitmodules_file_gently functionAntonio Ospite, Sep 17, 2018
  19. 4/9 t7411: be nicer to future tests and really clean things upAntonio Ospite, Sep 17, 2018
  20. 8/9 submodule: add a helper to check if it is safe to write to .gitmodulesAntonio Ospite, Sep 17, 2018
  21. 1/9 submodule: add a print_config_from_gitmodules() helperAntonio Ospite, Sep 17, 2018
  22. Antonio OspiteSep 24, 2018
  23. Stefan BellerSep 24, 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.