summaryrefslogtreecommitdiff
path: root/Debian/Dgit.pm
diff options
context:
space:
mode:
Diffstat (limited to 'Debian/Dgit.pm')
-rw-r--r--Debian/Dgit.pm23
1 files changed, 15 insertions, 8 deletions
diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm
index 7da60f6..3657aa1 100644
--- a/Debian/Dgit.pm
+++ b/Debian/Dgit.pm
@@ -445,14 +445,21 @@ sub git_for_each_tag_referring ($$) {
}
sub git_check_unmodified () {
- my @cmd = qw(git diff --quiet HEAD);
- debugcmd "+",@cmd;
- $!=0; $?=-1; system @cmd;
- return if !$?;
- if ($?==256) {
- fail "working tree is dirty (does not match HEAD)";
- } else {
- failedcmd @cmd;
+ foreach my $cached (qw(0 1)) {
+ my @cmd = qw(git diff --quiet);
+ push @cmd, qw(--cached) if $cached;
+ push @cmd, qw(HEAD);
+ debugcmd "+",@cmd;
+ $!=0; $?=-1; system @cmd;
+ return if !$?;
+ if ($?==256) {
+ fail
+ $cached
+ ? "git index contains changes (does not match HEAD)"
+ : "working tree is dirty (does not match HEAD)";
+ } else {
+ failedcmd @cmd;
+ }
}
}