summaryrefslogtreecommitdiff
path: root/git-add--interactive.perl
diff options
context:
space:
mode:
authorThomas Rast <trast@student.ethz.ch>2008-10-26 20:37:06 +0100
committerJunio C Hamano <gitster@pobox.com>2008-10-26 16:20:24 -0700
commit9fe7a643fcc56ca1c17afec5d5f8adca10cabdd1 (patch)
tree1a72b3688ddd7ad12664b26c9507cec1d16c37cf /git-add--interactive.perl
parentddff8563510a2c5c675d488a02e2642306430fc1 (diff)
downloadgit-9fe7a643fcc56ca1c17afec5d5f8adca10cabdd1.tar.gz
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>
Diffstat (limited to 'git-add--interactive.perl')
-rwxr-xr-xgit-add--interactive.perl9
1 files changed, 7 insertions, 2 deletions
diff --git a/git-add--interactive.perl b/git-add--interactive.perl
index da768ee7ac..b0223c3419 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) {