Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
}
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;
+ }
}
}
dgit (4.5~) unstable; urgency=medium
+ Bugfixes:
+ * When checking that the tree is clean, check the git index too.
+
Minor fixes:
* "confess" when we die due to a warning, rather than symply dieing.