]> git.ipfire.org Git - thirdparty/git.git/commitdiff
add -p: warn if only binary changes present
authorThomas Rast <trast@student.ethz.ch>
Sun, 26 Oct 2008 19:37:06 +0000 (20:37 +0100)
committerJunio C Hamano <gitster@pobox.com>
Sun, 26 Oct 2008 23:20:24 +0000 (16:20 -0700)
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>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
git-add--interactive.perl

index da768ee7acc22e6480f0a067e109239561d43927..b0223c3419301132032fb67519a275e57707df22 100755 (executable)
@@ -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) {