From: Ian Jackson Date: Thu, 15 Feb 2018 18:49:17 +0000 (+0000) Subject: Dgit.pm: When checking that the tree is clean, check the git index too. X-Git-Tag: archive/debian/5.0~395 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=commitdiff_plain;h=d371437104d5a7a4ec623a2e0be716063c7dde92 Dgit.pm: When checking that the tree is clean, check the git index too. Signed-off-by: Ian Jackson --- diff --git a/Debian/Dgit.pm b/Debian/Dgit.pm index 7da60f66..3657aa13 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; + } } } diff --git a/debian/changelog b/debian/changelog index e4134540..91dd7c49 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,5 +1,8 @@ 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.