X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=dgit.git;a=blobdiff_plain;f=dgit;h=b3a4e9b7fc10252debef9133c3010f6be52ac498;hp=573faa43e5bf327aac88d2b1046a3b8ad3877ef6;hb=f8ad84e8235e1741857849e46bcc70c2f5bc3790;hpb=571ed009639e736c3b640692603ff5c075d7f0cf diff --git a/dgit b/dgit index 573faa43..b3a4e9b7 100755 --- a/dgit +++ b/dgit @@ -28,6 +28,7 @@ use Dpkg::Version; use POSIX; our $isuite = 'unstable'; +our $idistro; our $package; our $sign = 1; @@ -246,7 +247,7 @@ sub access_distro () { sub access_cfg (@) { my (@keys) = @_; - my $distro = access_distro(); + my $distro = $idistro || access_distro(); my $value = cfg(map { ("dgit-distro.$distro.$_", "dgit.default.$_") } @keys); return $value; @@ -649,7 +650,7 @@ sub fetch_from_archive () { } else { $hash = generate_commit_from_dsc(); } - print DEBUG "current hash $hash\n"; + print DEBUG "current hash=$hash\n"; if ($upload_hash) { fail "not fast forward on last upload branch!". " (archive's version left in DGIT_ARCHIVE)" @@ -706,7 +707,15 @@ sub pull () { } sub check_not_dirty () { - runcmd @git, qw(diff --quiet HEAD); + my @cmd = (@git, qw(diff --quiet HEAD)); + printcmd(\*DEBUG,"+",@cmd) if $debug>0; + $!=0; $?=0; system @cmd; + return if !$! && !$?; + if (!$! && $?==256) { + fail "working tree is dirty (does not match HEAD)"; + } else { + failedcmd @cmd; + } } sub commit_quilty_patch ($) { @@ -978,6 +987,8 @@ sub parseopts () { push @$om, $2; } elsif (m/^--existing-package=(.*)/s) { $existing_package = $1; + } elsif (m/^--distro=(.*)/s) { + $idistro = $1; } else { badusage "unknown long option \`$_'"; } @@ -994,6 +1005,8 @@ sub parseopts () { $new_package=1; } elsif (s/^-c(.*=.*)//s) { push @git, '-c', $1; + } elsif (s/^-d(.*)//s) { + $idistro = $1; } elsif (s/^-C(.*)//s) { $changesfile = $1; } elsif (s/^-k(.*)//s) {