diff options
author | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2018-02-15 18:49:17 +0000 |
---|---|---|
committer | Ian Jackson <ijackson@chiark.greenend.org.uk> | 2018-06-16 12:25:49 +0100 |
commit | d371437104d5a7a4ec623a2e0be716063c7dde92 (patch) | |
tree | eaf87fe101abfc267599813d658cc28218f970d0 /Debian | |
parent | f90d29c48dd4183174dd08f36d03e9db81636eb0 (diff) |
Dgit.pm: When checking that the tree is clean, check the git index too.
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'Debian')
-rw-r--r-- | Debian/Dgit.pm | 23 |
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; + } } } |