git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Alexey Izbyshev <izbyshev@ispras.ru>
To: git@vger.kernel.org
Subject: [BUG] git commit -a doesn't ignore inactive/ignore-all submodules
Date: Fri, 20 Aug 2021 20:02:25 +0300	[thread overview]
Message-ID: <1be1e064559578a190f32dddb8ad39a0@ispras.ru> (raw)

Hi,

I've been surprised to discover that "git commit -a" stages submodules 
that have been explicitly made inactive via 
"submodule.NAME.active=false" and/or hidden from status/diff via 
"submodule.NAME.ignore=all":

git init repo
git -C repo commit --allow-empty -m "initial"
git -C repo submodule add "$PWD"/repo
git -C repo commit -m "add sm"
git -C repo config submodule.repo.ignore all
git -C repo config submodule.repo.active false
git -C repo/repo pull

After executing the above commands, "git -C repo commit -a" will show 
"repo" in "Changes to be committed" list. I think this behavior is 
dangerous because it makes it easy to accidentally "update" the 
submodule commit in the main repo while committing other changes. Does 
this qualify as a bug?

Reproduced on 2.33 and 2.17.1. Does not reproduce on 2.7.4 (Ubuntu 
16.04). This discussion[1] and this question[2] also indicate that "git 
commit -a" honored at least "ignore all" setting in older git.

Alexey

[1] 
https://public-inbox.org/git/CABxC_L92v=cV=+e_DNa0L6f21LB0BRP5duai2h_heGJN_PRoUQ@mail.gmail.com/#t
[2] 
https://superuser.com/questions/1301581/get-git-commit-a-to-ignore-submodules


             reply	other threads:[~2021-08-20 17:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-20 17:02 Alexey Izbyshev [this message]
2021-08-24 15:49 ` [BUG] git commit -a doesn't ignore inactive/ignore-all submodules Alexey Izbyshev

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=1be1e064559578a190f32dddb8ad39a0@ispras.ru \
    --to=izbyshev@ispras.ru \
    --cc=git@vger.kernel.org \
    /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).