git@vger.kernel.org list mirror (unofficial, one of many)
 help / color / Atom feed
From: Antonio Ospite <ao2@ao2.it>
To: git@vger.kernel.org
Cc: Brandon Williams <bmwill@google.com>,
	Daniel Graña <dangra@gmail.com>,
	Jonathan Nieder <jrnieder@gmail.com>,
	Richard Hartmann <richih.mailinglist@gmail.com>,
	Stefan Beller <sbeller@google.com>, Antonio Ospite <ao2@ao2.it>
Subject: [PATCH v3 0/7] Make submodules work if .gitmodules is not checked out
Date: Tue, 14 Aug 2018 13:05:18 +0200
Message-ID: <20180814110525.17801-1-ao2@ao2.it> (raw)

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?

             reply index

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-14 11:05 Antonio Ospite [this message]
2018-08-14 11:05 ` [PATCH v3 1/7] submodule: add a print_config_from_gitmodules() helper Antonio Ospite
2018-08-14 11:05 ` [PATCH v3 2/7] submodule: factor out a config_set_in_gitmodules_file_gently function Antonio Ospite
2018-08-14 11:05 ` [PATCH v3 3/7] t7411: be nicer to future tests and really clean things up Antonio Ospite
2018-08-14 17:06   ` Brandon Williams
2018-08-14 20:16   ` Junio C Hamano
2018-08-20 16:46     ` Antonio Ospite
2018-08-14 11:05 ` [PATCH v3 4/7] submodule--helper: add a new 'config' subcommand Antonio Ospite
2018-08-14 17:10   ` Brandon Williams
2018-08-20 16:50     ` Antonio Ospite
2018-08-14 11:05 ` [PATCH v3 5/7] submodule: use the 'submodule--helper config' command Antonio Ospite
2018-08-14 17:12   ` Brandon Williams
2018-08-14 11:05 ` [PATCH v3 6/7] t7506: clean up .gitmodules properly before setting up new scenario Antonio Ospite
2018-08-14 11:05 ` [PATCH v3 7/7] submodule: support reading .gitmodules even when it's not checked out Antonio Ospite
2018-08-14 17:22   ` Brandon Williams
2018-08-14 20:36   ` Junio C Hamano
2018-08-20 21:37     ` Antonio Ospite
2018-08-22 11:51       ` Antonio Ospite
2018-08-22 15:29         ` Junio C Hamano
2018-08-23 11:48           ` Antonio Ospite

Reply instructions:

You may reply publically to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: http://vger.kernel.org/majordomo-info.html

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180814110525.17801-1-ao2@ao2.it \
    --to=ao2@ao2.it \
    --cc=bmwill@google.com \
    --cc=dangra@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=richih.mailinglist@gmail.com \
    --cc=sbeller@google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

git@vger.kernel.org list mirror (unofficial, one of many)

Archives are clonable:
	git clone --mirror https://public-inbox.org/git
	git clone --mirror http://ou63pmih66umazou.onion/git
	git clone --mirror http://czquwvybam4bgbro.onion/git
	git clone --mirror http://hjrcffqmbrq6wope.onion/git

Newsgroups are available over NNTP:
	nntp://news.public-inbox.org/inbox.comp.version-control.git
	nntp://ou63pmih66umazou.onion/inbox.comp.version-control.git
	nntp://czquwvybam4bgbro.onion/inbox.comp.version-control.git
	nntp://hjrcffqmbrq6wope.onion/inbox.comp.version-control.git
	nntp://news.gmane.org/gmane.comp.version-control.git

 note: .onion URLs require Tor: https://www.torproject.org/
       or Tor2web: https://www.tor2web.org/

AGPL code for this site: git clone https://public-inbox.org/ public-inbox