git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH/RFC] add--interactive: ignore all internal submodule changes
Date: Wed, 10 Jan 2018 18:06:43 +0700	[thread overview]
Message-ID: <20180110110643.21465-1-pclouds@gmail.com> (raw)

For 'add -i' and 'add -p' the only action we can take on a dirty
submodule entry (from the superproject perspective) is its SHA-1. The
content changes inside do not matter, at least until interactive add has
--recurse-submodules or something.

Ignore all dirty changes to reduce the questions 'add -i' and 'add -p'
throw at the user when submodules are dirty.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
 $DAYJOB started to use submodules and this annoys me so much when I
 use 'git add -p'. I'm neither very familiar with add--interactive nor
 submodules code but this seems to work. Hopefully it's a correct
 change.

 git-add--interactive.perl | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index 28b325d754..964c3a7542 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -262,7 +262,7 @@ sub list_modified {
 		}
 	}
 
-	for (run_cmd_pipe(qw(git diff-files --numstat --summary --raw --), @ARGV)) {
+	for (run_cmd_pipe(qw(git diff-files --ignore-submodules=dirty --numstat --summary --raw --), @ARGV)) {
 		if (($add, $del, $file) =
 		    /^([-\d]+)	([-\d]+)	(.*)/) {
 			$file = unquote_path($file);
-- 
2.15.1.600.g899a5f85c6


             reply	other threads:[~2018-01-10 11:07 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-10 11:06 Nguyễn Thái Ngọc Duy [this message]
2018-01-10 19:47 ` [PATCH/RFC] add--interactive: ignore all internal submodule changes Stefan Beller
2018-01-11 11:06   ` Duy Nguyen
2018-01-13 12:10 ` [PATCH v2] add--interactive: ignore submodule changes except HEAD Nguyễn Thái Ngọc Duy

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=20180110110643.21465-1-pclouds@gmail.com \
    --to=pclouds@gmail.com \
    --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).