git@vger.kernel.org mailing list mirror (one of many)
 help / Atom feed
From: Stefan Beller <sbeller@google.com>
To: Brandon Williams <bmwill@google.com>
Cc: "git@vger.kernel.org" <git@vger.kernel.org>, Jonathan Nieder <jrnieder@gmail.com>
Subject: Re: [PATCH 03/15] add, reset: ensure submodules can be added or reset
Date: Tue, 25 Jul 2017 16:33:10 -0700
Message-ID: <CAGZ79kZByzPbyLUNJ8ViVa2TDk-L+TfnF+wVWRj2d92_MhXPbg@mail.gmail.com> (raw)
In-Reply-To: <20170725213928.125998-4-bmwill@google.com>

On Tue, Jul 25, 2017 at 2:39 PM, Brandon Williams <bmwill@google.com> wrote:
> Commit aee9c7d65 (Submodules: Add the new "ignore" config option for
> diff and status) ...

introduced in 2010, so quite widely spread.

> ...  introduced the ignore configuration option for
> submodules so that configured submodules could be omitted from the
> status and diff commands.  Because this flag is respected in the diff
> machinery it has the unintended consequence of potentially prohibiting
> users from adding or resetting a submodule, even when a path to the
> submodule is explicitly given.
>
> Ensure that submodules can be added or set, even if they are configured
> to be ignored, by setting the `DIFF_OPT_OVERRIDE_SUBMODULE_CONFIG` diff
> flag.
>
> Signed-off-by: Brandon Williams <bmwill@google.com>
> ---
>  builtin/add.c   | 1 +
>  builtin/reset.c | 1 +
>  2 files changed, 2 insertions(+)
>
> diff --git a/builtin/add.c b/builtin/add.c
> index e888fb8c5..6f271512f 100644
> --- a/builtin/add.c
> +++ b/builtin/add.c
> @@ -116,6 +116,7 @@ int add_files_to_cache(const char *prefix,
>         rev.diffopt.output_format = DIFF_FORMAT_CALLBACK;
>         rev.diffopt.format_callback = update_callback;
>         rev.diffopt.format_callback_data = &data;
> +       rev.diffopt.flags |= DIFF_OPT_OVERRIDE_SUBMODULE_CONFIG;


This flag occurs once in the code base, with the comment:
    /*
     * Unless the user did explicitly request a submodule
     * ignore mode by passing a command line option we do
     * not ignore any changed submodule SHA-1s when
     * comparing index and parent, no matter what is
     * configured. Otherwise we won't commit any
     * submodules which were manually staged, which would
     * be really confusing.
     */
    int diff_flags = DIFF_OPT_OVERRIDE_SUBMODULE_CONFIG;

in prepare_commit, so commit ignores the .gitmodules file.

This allows git-add to add ignored submodules, currently ignored submodules
would have to be added using the plumbing
    git update-index --add --cacheinfo 160000,$SHA1,<gitlink>

This makes sense, though a test demonstrating the change in behavior
would be nice, but git-add doesn't seem to change as it doesn't even load
the git modules config?

>         rev.max_count = 0; /* do not compare unmerged paths with stage #2 */
>         run_diff_files(&rev, DIFF_RACY_IS_MODIFIED);
>         return !!data.add_errors;
> diff --git a/builtin/reset.c b/builtin/reset.c
> index 046403ed6..772d078b8 100644
> --- a/builtin/reset.c
> +++ b/builtin/reset.c
> @@ -156,6 +156,7 @@ static int read_from_tree(const struct pathspec *pathspec,
>         opt.output_format = DIFF_FORMAT_CALLBACK;
>         opt.format_callback = update_index_from_diff;
>         opt.format_callback_data = &intent_to_add;
> +       opt.flags |= DIFF_OPT_OVERRIDE_SUBMODULE_CONFIG;

same here? Also as this is not failing any test, it may be worth adding one
to document the behavior of the "submodule.<name>.ignore" flag in tests?

>
>         if (do_diff_cache(tree_oid, &opt))
>                 return 1;
> --
> 2.14.0.rc0.400.g1c36432dff-goog
>

  reply index

Thread overview: 61+ messages in thread (expand / mbox.gz / Atom feed / [top])
2017-07-25 21:39 [PATCH 00/15] submodule-config cleanup Brandon Williams
2017-07-25 21:39 ` [PATCH 01/15] t7411: check configuration parsing errors Brandon Williams
2017-07-26 20:56   ` Junio C Hamano
2017-07-25 21:39 ` [PATCH 02/15] submodule: don't use submodule_from_name Brandon Williams
2017-07-25 23:17   ` Stefan Beller
2017-07-26 21:06     ` Junio C Hamano
2017-07-30 13:43       ` Jens Lehmann
2017-07-30 21:25         ` Junio C Hamano
2017-07-31 20:43         ` Stefan Beller
2017-08-11 16:53           ` Heiko Voigt
2017-07-25 21:39 ` [PATCH 03/15] add, reset: ensure submodules can be added or reset Brandon Williams
2017-07-25 23:33   ` Stefan Beller [this message]
2017-07-25 23:37     ` Brandon Williams
2017-07-26 21:25     ` Junio C Hamano
2017-07-31 20:50       ` Brandon Williams
2017-07-25 21:39 ` [PATCH 04/15] submodule--helper: don't overlay config in remote_submodule_branch Brandon Williams
2017-07-25 23:35   ` Stefan Beller
2017-07-25 21:39 ` [PATCH 05/15] submodule--helper: don't overlay config in update-clone Brandon Williams
2017-07-25 23:37   ` Stefan Beller
2017-07-25 23:39     ` Brandon Williams
2017-07-25 21:39 ` [PATCH 06/15] fetch: don't overlay config with submodule-config Brandon Williams
2017-07-25 23:44   ` Stefan Beller
2017-07-25 23:48     ` Brandon Williams
2017-07-25 21:39 ` [PATCH 07/15] submodule: don't rely on overlayed config when setting diffopts Brandon Williams
2017-07-25 23:46   ` Stefan Beller
2017-07-25 21:39 ` [PATCH 08/15] unpack-trees: don't rely on overlayed config Brandon Williams
2017-07-25 21:39 ` [PATCH 09/15] submodule: remove submodule_config callback routine Brandon Williams
2017-07-26 21:31   ` Junio C Hamano
2017-07-25 21:39 ` [PATCH 10/15] diff: stop allowing diff to have submodules configured in .git/config Brandon Williams
2017-07-25 21:39 ` [PATCH 11/15] submodule-config: remove support for overlaying repository config Brandon Williams
2017-07-25 21:39 ` [PATCH 12/15] submodule-config: move submodule-config functions to submodule-config.c Brandon Williams
2017-07-25 21:39 ` [PATCH 13/15] submodule-config: lazy-load a repository's .gitmodules file Brandon Williams
2017-07-25 21:39 ` [PATCH 14/15] unpack-trees: improve loading of .gitmodules Brandon Williams
2017-07-25 21:39 ` [PATCH 15/15] submodule: remove gitmodules_config Brandon Williams
2017-08-03 18:19 ` [PATCH v2 00/15] submodule-config cleanup Brandon Williams
2017-08-03 18:19   ` [PATCH v2 01/15] t7411: check configuration parsing errors Brandon Williams
2017-08-03 18:19   ` [PATCH v2 02/15] submodule: don't use submodule_from_name Brandon Williams
2017-08-03 18:57     ` Stefan Beller
2017-08-04 21:53       ` Brandon Williams
2017-08-11 16:59         ` Heiko Voigt
2017-08-03 20:17     ` Junio C Hamano
2017-08-03 18:19   ` [PATCH v2 03/15] add, reset: ensure submodules can be added or reset Brandon Williams
2017-08-03 18:19   ` [PATCH v2 04/15] submodule--helper: don't overlay config in remote_submodule_branch Brandon Williams
2017-08-03 18:19   ` [PATCH v2 05/15] submodule--helper: don't overlay config in update-clone Brandon Williams
2017-08-03 18:19   ` [PATCH v2 06/15] fetch: don't overlay config with submodule-config Brandon Williams
2017-08-03 18:19   ` [PATCH v2 07/15] submodule: don't rely on overlayed config when setting diffopts Brandon Williams
2017-08-03 18:19   ` [PATCH v2 08/15] unpack-trees: don't respect submodule.update Brandon Williams
2017-08-03 20:26     ` Stefan Beller
2017-08-03 20:37     ` Junio C Hamano
2017-08-03 20:43       ` Stefan Beller
2017-08-03 18:19   ` [PATCH v2 09/15] submodule: remove submodule_config callback routine Brandon Williams
2017-08-03 18:19   ` [PATCH v2 10/15] diff: stop allowing diff to have submodules configured in .git/config Brandon Williams
2017-08-03 20:40     ` Junio C Hamano
2017-08-04 21:59       ` Brandon Williams
2017-08-03 18:19   ` [PATCH v2 11/15] submodule-config: remove support for overlaying repository config Brandon Williams
2017-08-03 18:19   ` [PATCH v2 12/15] submodule-config: move submodule-config functions to submodule-config.c Brandon Williams
2017-08-03 18:19   ` [PATCH v2 13/15] submodule-config: lazy-load a repository's .gitmodules file Brandon Williams
2017-08-03 18:19   ` [PATCH v2 14/15] unpack-trees: improve loading of .gitmodules Brandon Williams
2017-08-11 17:18     ` Heiko Voigt
2017-08-03 18:20   ` [PATCH v2 15/15] submodule: remove gitmodules_config Brandon Williams
2017-08-03 20:09   ` [PATCH v2 00/15] submodule-config cleanup 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 to all the recipients using the --to, --cc,
  and --in-reply-to switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAGZ79kZByzPbyLUNJ8ViVa2TDk-L+TfnF+wVWRj2d92_MhXPbg@mail.gmail.com \
    --to=sbeller@google.com \
    --cc=bmwill@google.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.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