git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH] RFC: commit: add a commit.all-ignore-submodules config option

From
MLMarc-André Lureau <marcandre.lureau@redhat.com>
Date
Jan 4, 2020, 17:24 UTC
Message-ID
<CAMxuvayT8FtovVnWU4bjQCP26drN37yuPG2+G2jAUsm0Ns_AYA@mail.gmail.com>
In-Reply-To
<20200104004516.GB130883@google.com>
Hi
On Sat, Jan 4, 2020 at 4:45 AM Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 12 quoted lines
>
> Hi,
>
> Marc-André Lureau wrote:
>
> > One of my most frequent mistake is to commit undesired submodules
> > changes when doing "commit -a", and I have seen a number of people doing
> > the same mistake in various projects. I wish there would be a config to
> > change this default behaviour.
>
> Can you say more about the overall workflow this is part of?  What
> causes the submodules to change state in the first place here?

The most common case is, I guess, when you work on different branches that have different (compatible) versions of the submodules. It is easy to go unnoticed then, although I am usually quite careful what I include in my commit, and will usually add changes interactively with add -i instead.

I often rely on git commit -a during an interactive rebase. I check the project at various points in history, find a small fix, and git commit -a. At this point, I may have included a submodule change inadvertently that may happen later in the series for example.

Show 17 quoted lines
>
> [...]
> > --- a/builtin/commit.c
> > +++ b/builtin/commit.c
> [...]
> > @@ -1475,6 +1478,11 @@ static int git_commit_config(const char *k, const char *v, void *cb)
> >               return 0;
> >       }
> >
> > +     if (!strcmp(k, "commit.all-ignore-submodules")) {
> > +             commit_all_ignore_submodules = git_config_bool(k, v);
> > +             return 0;
> > +     }
>
> nit, less important than the comment above: no other config items use
> this naming scheme.  We'd have to come up with a different name if we
> want to pursue this.
Sure, I am open to suggestions.
Show 5 quoted lines
>
> If I want to disable this setting for a particular "git commit"
> invocation, how do I do that?  Typically when adding new settings, we
> add them first as command-line options and then as a separate followup
> can introduce configuration to change the defaults.
--all=no-ignore ?
Show 8 quoted lines
>
> To summarize: I'm interested in hearing more about the overall
> workflow so we can make the standard behavior without any special
> configuration work better for it, too.
>
> Thanks and hope that helps,
> Jonathan
>
thanks for the feeback
Previous: Jonathan NiederNext: Jonathan Nieder
Message 3 of 5 in “RFC: commit: add a commit.all-ignore-submodules config option”
  1. RFC: commit: add a commit.all-ignore-submodules config optionmarcandre.lureau@redhat.com, Jan 3, 2020
  2. Jonathan NiederJan 4, 2020
  3. Marc-André LureauJan 4, 2020
  4. Jonathan NiederJan 7, 2020
  5. Marc-André LureauJan 7, 2020

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.