Skip to content

Commit 9fe7a64

Browse files
trastgitster
authored andcommitted
add -p: warn if only binary changes present
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent ddff856 commit 9fe7a64

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

git-add--interactive.perl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -811,11 +811,16 @@ sub help_patch_cmd {
811811
}
812812

813813
sub patch_update_cmd {
814-
my @mods = grep { !($_->{BINARY}) } list_modified('file-only');
814+
my @all_mods = list_modified('file-only');
815+
my @mods = grep { !($_->{BINARY}) } @all_mods;
815816
my @them;
816817

817818
if (!@mods) {
818-
print STDERR "No changes.\n";
819+
if (@all_mods) {
820+
print STDERR "Only binary files changed.\n";
821+
} else {
822+
print STDERR "No changes.\n";
823+
}
819824
return 0;
820825
}
821826
if ($patch_mode) {

0 commit comments

Comments
 (0)