@matheusbsbs / matheus-bagliano / commits / 9fe7a643fc
Fork 0

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 <trast@student.ethz.ch> Signed-off-by: Junio C Hamano <gitster@pobox.com>

Thomas Rast committed Oct 26, 2008 at 20:37 UTC 9fe7a643fcc56ca1c17afec5d5f8adca10cabdd1
1 file changed +7 -2
git-add--interactive.perl
+7 -2
@@ -811,11 +811,16 @@ EOF
811 }
812
813 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;
816 my @them;
817
818 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 + }
824 return 0;
825 }
826 if ($patch_mode) {