git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Antonio Ospite <ao2@ao2.it>
To: git@vger.kernel.org
Cc: 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 0/7] Restrict the usage of config_from_gitmodules()
Date: Fri, 22 Jun 2018 18:26:49 +0200	[thread overview]
Message-ID: <20180622162656.19338-1-ao2@ao2.it> (raw)

Hi,

when I tried to reuse and extend 'config_from_gitmodules' in
https://public-inbox.org/git/20180514105823.8378-2-ao2@ao2.it/ it was
pointed out to me that special care is needed to make sure that this
function does not get abused to bring in arbitrary configuration stored
in the .gitmodules file, as the latter is meant only for submodule
specific configuration.

So I thought that the function could be made private to better
communicate that.

This is what this series is about.

Patch 1 moves 'config_from_gitmodules' to submodule-config.c

Patches 2 and 3 add helpers to handle special cases and avoid calling
'config_from_gitmodules' directly, which might set a bad example for
future code.

Patch 4 makes the symbol private to discourage its use in code not
related to submodules.

Patches 5 and 6 enable reusing 'config_from_gitmodules' when it's safe
to do so.

Patches 7 is just a cleanup and I am not even sure it is worth it, so we
might as well just drop it.

The series can be seen as a continuation of the changes from
https://public-inbox.org/git/20170802194923.88239-1-bmwill@google.com/

Even though the helper functions may be less elegant than what was done
back then, they should better protect from misuse of
config_from_gitmodules.

A further change could be to print warning messages when the backward
compatibility helpers find configuration in .gitmodules that should not
belong there, but I'll leave that to someone else.

Thanks,
   Antonio

P.S. I added Jeff King to CC as he has done some work related to
.gitmodules recently, and I removed the vcsh poeple on this one.

Antonio Ospite (7):
  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
  submodule-config: cleanup backward compatibility helpers

 builtin/fetch.c             | 15 +--------
 builtin/submodule--helper.c |  8 ++---
 config.c                    | 17 ----------
 config.h                    | 10 ------
 submodule-config.c          | 66 ++++++++++++++++++++++++++++++-------
 submodule-config.h          | 12 +++++++
 6 files changed, 71 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	other threads:[~2018-06-22 16:27 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-22 16:26 Antonio Ospite [this message]
2018-06-22 16:26 ` [PATCH 1/7] config: move config_from_gitmodules to submodule-config.c Antonio Ospite
2018-06-22 16:26 ` [PATCH 2/7] submodule-config: add helper function to get 'fetch' config from .gitmodules Antonio Ospite
2018-06-22 16:50   ` Brandon Williams
2018-06-22 16:26 ` [PATCH 3/7] submodule-config: add helper to get 'update-clone' " Antonio Ospite
2018-06-22 16:51   ` Brandon Williams
2018-06-22 16:26 ` [PATCH 4/7] submodule-config: make 'config_from_gitmodules' private Antonio Ospite
2018-06-22 16:26 ` [PATCH 5/7] submodule-config: pass repository as argument to config_from_gitmodules Antonio Ospite
2018-06-22 16:26 ` [PATCH 6/7] submodule-config: reuse config_from_gitmodules in repo_read_gitmodules Antonio Ospite
2018-06-22 16:55   ` Brandon Williams
2018-06-22 16:26 ` [PATCH 7/7] submodule-config: cleanup backward compatibility helpers Antonio Ospite
2018-06-22 17:09   ` Brandon Williams
2018-06-22 17:13 ` [PATCH 0/7] Restrict the usage of config_from_gitmodules() Brandon Williams
2018-06-22 20:31   ` Antonio Ospite
2018-06-22 21:13     ` Brandon Williams

Reply instructions:

You may reply publicly 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=20180622162656.19338-1-ao2@ao2.it \
    --to=ao2@ao2.it \
    --cc=bmwill@google.com \
    --cc=git@vger.kernel.org \
    --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
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://80x24.org/mirrors/git.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).