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

[PATCH v2] add -p: warn if only binary changes present

From
Thomas Rast <trast@student.ethz.ch>
Date
Oct 26, 2008, 19:37 UTC
Message-ID
<1225049826-14941-1-git-send-email-trast@student.ethz.ch>
In-Reply-To
<20081026104006.GA18969@neumann>

Current 'git add -p' will say "No changes." if there are no changes to text files, which can be confusing if there _are_ changes to binary files. Add some code to distinguish the two cases, and give a different message in the latter one.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
---
SZEDER Gábor wrote:
Show 5 quoted lines
> What about
> 
>    Only binary files changed.
> 
> or something of the sort?
Yes, why not.
 git-add--interactive.perl |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index da768ee..b0223c3 100755
--- a/git-add--interactive.perl
+++ b/git-add--interactive.perl
@@ -811,11 +811,16 @@ EOF
 }
 
 sub patch_update_cmd {
-	my @mods = grep { !($_->{BINARY}) } list_modified('file-only');
+	my @all_mods = list_modified('file-only');
+	my @mods = grep { !($_->{BINARY}) } @all_mods;
 	my @them;
 
 	if (!@mods) {
-		print STDERR "No changes.\n";
+		if (@all_mods) {
+			print STDERR "Only binary files changed.\n";
+		} else {
+			print STDERR "No changes.\n";
+		}
 		return 0;
 	}
 	if ($patch_mode) {
-- 
tg: (759ad19..) t/add-p-binary-warn (depends on: origin/master)
Previous: SZEDER GáborNext: Jeff King
Message 5 of 6 in “add -p: warn if only binary changes present”
  1. add -p: warn if only binary changes presentThomas Rast, Oct 24, 2008
  2. Jeff KingOct 26, 2008
  3. Thomas RastOct 26, 2008
  4. SZEDER GáborOct 26, 2008
  5. add -p: warn if only binary changes presentThomas Rast, Oct 26, 2008
  6. Jeff KingOct 26, 2008

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.