Skip to content

Commit

Permalink
add -p: warn if only binary changes present
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Thomas Rast authored and Junio C Hamano committed Oct 26, 2008
1 parent ddff856 commit 9fe7a64
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions git-add--interactive.perl
Original file line number Diff line number Diff line change
Expand Up @@ -811,11 +811,16 @@ sub help_patch_cmd {
}

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) {
Expand Down

0 comments on commit 9fe7a64

Please sign in to comment.