From 204dfaf210b11dd980970166ef7fc2c2456d245c Mon Sep 17 00:00:00 2001 From: Ian Jackson Date: Sat, 17 Aug 2013 16:54:16 +0100 Subject: [PATCH] improve dirty checks --- dgit | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/dgit b/dgit index f65b51a7..da4e57c3 100755 --- a/dgit +++ b/dgit @@ -551,6 +551,18 @@ sub pull () { printdone "fetched to ".lrref()." and merged into HEAD"; } +sub check_not_dirty () { + my $output = cmdoutput @git, qw(status --porcelain); + if (length $output) { + my $m = "tree dirty:\n$output\n"; + if (!$dryrun) { + die $m; + } else { + warn $m; + } + } +} + sub dopush () { runcmd @git, qw(diff --quiet HEAD); my $clogp = parsechangelog(); @@ -558,6 +570,7 @@ sub dopush () { my $dscfn = "${package}_$clogp->{Version}.dsc"; stat "../$dscfn" or die "$dscfn $!"; $dsc = parsecontrol("../$dscfn"); + check_not_dirty(); prep_ud(); chdir $ud or die $!; print "checking that $dscfn corresponds to HEAD\n"; @@ -671,6 +684,7 @@ sub cmd_pull { sub cmd_push { parseopts(); die if defined $package; + runcmd @git, qw(diff --quiet HEAD); my $clogp = parsechangelog(); $package = $clogp->{Source}; if (@ARGV==0) { -- 2.30.2