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

[PATCH/RFC] add--interactive: ignore all internal submodule changes

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
Jan 10, 2018, 11:06 UTC
Message-ID
<20180110110643.21465-1-pclouds@gmail.com>

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
Next: Stefan Beller
Message 1 of 4 in “add--interactive: ignore all internal submodule changes”
  1. add--interactive: ignore all internal submodule changesNguyễn Thái Ngọc Duy, Jan 10, 2018
  2. Stefan BellerJan 10, 2018
  3. Duy NguyenJan 11, 2018
  4. add--interactive: ignore submodule changes except HEADNguyễn Thái Ngọc Duy, Jan 13, 2018

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.