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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxx/

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

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?



[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux