git@vger.kernel.org mailing list mirror (one of many)
 help / Atom feed
From: Antonio Ospite <ao2@ao2.it>
To: gitster@pobox.com
Cc: git@vger.kernel.org, Brandon Williams <bmwill@google.com>,
	Jonathan Nieder <jrnieder@gmail.com>,
	Stefan Beller <sbeller@google.com>, Jeff King <peff@peff.net>,
	Antonio Ospite <ao2@ao2.it>
Subject: [PATCH v2 0/6] Restrict the usage of config_from_gitmodules to submodule-config
Date: Tue, 26 Jun 2018 12:47:04 +0200
Message-ID: <20180626104710.9859-1-ao2@ao2.it> (raw)

Hi,

this is version 2 of the series from
https://public-inbox.org/git/20180622162656.19338-1-ao2@ao2.it/

The .gitmodules file is not meant for arbitrary configuration, it should
be used only for submodules properties.

Plus, arbitrary git configuration should not be distributed with the
repository, and .gitmodules might be a possible "vector" for that.

The series tries to alleviate both these issues by moving the
'config_from_gitmodules' function from config.[ch] to submodule-config.c
and making it private.

This should discourage future code from using the function with
arbitrary config callbacks which might turn .gitmodules into a mechanism
to load arbitrary configuration stored in the repository.

Backward compatibility exceptions to the rules above are handled by
ad-hoc helpers.

Finally (in patch 6) some duplication is removed by using
'config_from_gitmodules' to load the submodules configuration in
'repo_read_gitmodules'.

Changes since v1:
  * Remove an extra space before an arrow operator in patch 2
  * Fix a typo in the commit message of patch 3: s/fetchobjs/fetchjobs
  * Add a note in the commit message of patch 6 about checking the
    worktree before loading .gitmodules
  * Drop patch 7, it was meant as a cleanup but resulted in parsing the
    .gitmodules file twice

The series has been rebased on commit ed843436d ("First batch for 2.19
cycle", 2018-06-25) , and the test suite passes after each commit.

Thanks to Brandon Williams and Stefan Beller for the input.

Ciao,
   Antonio

Antonio Ospite (6):
  config: move config_from_gitmodules to submodule-config.c
  submodule-config: add helper function to get 'fetch' config from
    .gitmodules
  submodule-config: add helper to get 'update-clone' config from
    .gitmodules
  submodule-config: make 'config_from_gitmodules' private
  submodule-config: pass repository as argument to
    config_from_gitmodules
  submodule-config: reuse config_from_gitmodules in repo_read_gitmodules

 builtin/fetch.c             | 15 +-------
 builtin/submodule--helper.c |  8 ++--
 config.c                    | 17 ---------
 config.h                    | 10 -----
 submodule-config.c          | 75 +++++++++++++++++++++++++++++++------
 submodule-config.h          | 12 ++++++
 6 files changed, 80 insertions(+), 57 deletions(-)

-- 
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: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-26 10:47 Antonio Ospite [this message]
2018-06-26 10:47 ` [PATCH v2 1/6] config: move config_from_gitmodules to submodule-config.c Antonio Ospite
2018-06-26 10:47 ` [PATCH v2 2/6] submodule-config: add helper function to get 'fetch' config from .gitmodules Antonio Ospite
2018-06-26 20:11   ` Junio C Hamano
2018-06-26 20:55     ` Antonio Ospite
2018-06-26 10:47 ` [PATCH v2 3/6] submodule-config: add helper to get 'update-clone' " Antonio Ospite
2018-06-26 10:47 ` [PATCH v2 4/6] submodule-config: make 'config_from_gitmodules' private Antonio Ospite
2018-06-26 20:15   ` Junio C Hamano
2018-06-26 10:47 ` [PATCH v2 5/6] submodule-config: pass repository as argument to config_from_gitmodules Antonio Ospite
2018-06-26 20:15   ` Junio C Hamano
2018-06-26 20:57     ` Antonio Ospite
2018-06-26 10:47 ` [PATCH v2 6/6] submodule-config: reuse config_from_gitmodules in repo_read_gitmodules Antonio Ospite
2018-06-26 17:05 ` [PATCH v2 0/6] Restrict the usage of config_from_gitmodules to submodule-config Brandon Williams
2018-06-26 20:24   ` Junio C Hamano

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=20180626104710.9859-1-ao2@ao2.it \
    --to=ao2@ao2.it \
    --cc=bmwill@google.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=jrnieder@gmail.com \
    --cc=peff@peff.net \
    --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 mailing list mirror (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