chiark
/
gitweb
/
~ianmdlvl
/
dgit.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
exit status: Fix dgit-badcommit-fixup to use Debian::Dgit::ExitStatus
[dgit.git]
/
dgit
diff --git
a/dgit
b/dgit
index 9ce797200102205a4dc2f566cdd6faf281ab00ae..c3b66f15f75ce1acb588edb867e7cf234e4adc68 100755
(executable)
--- a/
dgit
+++ b/
dgit
@@
-18,6
+18,9
@@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+END { $? = $Debian::Dgit::ExitStatus::desired // -1; };
+use Debian::Dgit::ExitStatus;
+
use strict;
use Debian::Dgit qw(:DEFAULT :playground);
use strict;
use Debian::Dgit qw(:DEFAULT :playground);
@@
-95,7
+98,7
@@
our %format_ok = map { $_=>1 } ("1.0","3.0 (native)","3.0 (quilt)");
our $suite_re = '[-+.0-9a-z]+';
our $cleanmode_re = 'dpkg-source(?:-d)?|git|git-ff|check|none';
our $suite_re = '[-+.0-9a-z]+';
our $cleanmode_re = 'dpkg-source(?:-d)?|git|git-ff|check|none';
-our $orig_f_comp_re =
'orig(?:-[-0-9a-z]+)?'
;
+our $orig_f_comp_re =
qr{orig(?:-$extra_orig_namepart_re)?}
;
our $orig_f_sig_re = '\\.(?:asc|gpg|pgp)';
our $orig_f_tail_re = "$orig_f_comp_re\\.tar(?:\\.\\w+)?(?:$orig_f_sig_re)?";
our $orig_f_sig_re = '\\.(?:asc|gpg|pgp)';
our $orig_f_tail_re = "$orig_f_comp_re\\.tar(?:\\.\\w+)?(?:$orig_f_sig_re)?";
@@
-236,7
+239,7
@@
END {
}
};
}
};
-sub badcfg { print STDERR "$us: invalid configuration: @_\n";
exit
12; }
+sub badcfg { print STDERR "$us: invalid configuration: @_\n";
finish
12; }
sub forceable_fail ($$) {
my ($forceoptsl, $msg) = @_;
sub forceable_fail ($$) {
my ($forceoptsl, $msg) = @_;
@@
-254,7
+257,7
@@
sub forceing ($) {
sub no_such_package () {
print STDERR "$us: package $package does not exist in suite $isuite\n";
sub no_such_package () {
print STDERR "$us: package $package does not exist in suite $isuite\n";
-
exit
4;
+
finish
4;
}
sub deliberately ($) {
}
sub deliberately ($) {
@@
-559,7
+562,7
@@
END
sub badusage {
print STDERR "$us: @_\n", $helpmsg or die $!;
sub badusage {
print STDERR "$us: @_\n", $helpmsg or die $!;
-
exit
8;
+
finish
8;
}
sub nextarg {
}
sub nextarg {
@@
-572,7
+575,7
@@
sub pre_help () {
}
sub cmd_help () {
print $helpmsg or die $!;
}
sub cmd_help () {
print $helpmsg or die $!;
-
exit
0;
+
finish
0;
}
our $td = $ENV{DGIT_TEST_DUMMY_DIR} || "DGIT_TEST_DUMMY_DIR-unset";
}
our $td = $ENV{DGIT_TEST_DUMMY_DIR} || "DGIT_TEST_DUMMY_DIR-unset";
@@
-3508,7
+3511,7
@@
sub fork_for_multisuite ($) {
sub {
@end = ();
fetch();
sub {
@end = ();
fetch();
-
exit
0;
+
finish
0;
});
# xxx collecte the ref here
});
# xxx collecte the ref here
@@
-3692,15
+3695,7
@@
sub check_not_dirty () {
return if $ignoredirty;
return if $ignoredirty;
- my @cmd = (@git, qw(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;
- }
+ git_check_unmodified();
}
sub commit_admin ($) {
}
sub commit_admin ($) {
@@
-4511,13
+4506,8
@@
sub cmd_clone {
}
sub branchsuite () {
}
sub branchsuite () {
- my @cmd = (@git, qw(symbolic-ref -q HEAD));
- my $branch = cmdoutput_errok @cmd;
- if (!defined $branch) {
- $?==256 or failedcmd @cmd;
- return undef;
- }
- if ($branch =~ m#$lbranch_re#o) {
+ my $branch = git_get_symref();
+ if (defined $branch && $branch =~ m#$lbranch_re#o) {
return $1;
} else {
return undef;
return $1;
} else {
return undef;
@@
-4548,7
+4538,7
@@
sub cmd_fetch {
parseopts();
fetchpullargs();
my $multi_fetched = fork_for_multisuite(sub { });
parseopts();
fetchpullargs();
my $multi_fetched = fork_for_multisuite(sub { });
-
exit
0 if $multi_fetched;
+
finish
0 if $multi_fetched;
fetch();
}
fetch();
}
@@
-4757,7
+4747,7
@@
sub i_resp_complete {
i_cleanup();
printdebug "all done\n";
i_cleanup();
printdebug "all done\n";
-
exit
0;
+
finish
0;
}
sub i_resp_file ($) {
}
sub i_resp_file ($) {
@@
-5588,7
+5578,7
@@
sub quilt_check_splitbrain_cache ($$) {
if (!stat "$maindir_gitcommon/logs/refs/$splitbraincache") {
$! == ENOENT or die $!;
printdebug ">(no reflog)\n";
if (!stat "$maindir_gitcommon/logs/refs/$splitbraincache") {
$! == ENOENT or die $!;
printdebug ">(no reflog)\n";
-
exit
0;
+
finish
0;
}
exec @cmd; die $!;
}
}
exec @cmd; die $!;
}
@@
-5714,6
+5704,7
@@
sub quilt_fixup_multipatch ($$$) {
rmtree '.pc';
rmtree '.pc';
+ rmtree 'debian'; # git checkout commitish paths does not delete!
runcmd @git, qw(checkout -f), $headref, qw(-- debian);
my $unapplied=git_add_write_tree();
printdebug "fake orig tree object $unapplied\n";
runcmd @git, qw(checkout -f), $headref, qw(-- debian);
my $unapplied=git_add_write_tree();
printdebug "fake orig tree object $unapplied\n";
@@
-5840,7
+5831,7
@@
sub quilt_fixup_editor () {
}
I2->error and die $!;
close O or die $1;
}
I2->error and die $!;
close O or die $1;
-
exit
0;
+
finish
0;
}
sub maybe_apply_patches_dirtily () {
}
sub maybe_apply_patches_dirtily () {
@@
-6530,7
+6521,7
@@
sub cmd_setup_new_tree {
sub cmd_version {
print "dgit version $our_version\n" or die $!;
sub cmd_version {
print "dgit version $our_version\n" or die $!;
-
exit
0;
+
finish
0;
}
our (%valopts_long, %valopts_short);
}
our (%valopts_long, %valopts_short);
@@
-6882,7
+6873,7
@@
print STDERR "DAMP RUN - WILL MAKE LOCAL (UNSIGNED) CHANGES\n"
if $dryrun_level == 1;
if (!@ARGV) {
print STDERR $helpmsg or die $!;
if $dryrun_level == 1;
if (!@ARGV) {
print STDERR $helpmsg or die $!;
-
exit
8;
+
finish
8;
}
$cmd = $subcommand = shift @ARGV;
$cmd =~ y/-/_/;
}
$cmd = $subcommand = shift @ARGV;
$cmd =~ y/-/_/;
@@
-6896,3
+6887,5
@@
git_slurp_config();
my $fn = ${*::}{"cmd_$cmd"};
$fn or badusage "unknown operation $cmd";
$fn->();
my $fn = ${*::}{"cmd_$cmd"};
$fn or badusage "unknown operation $cmd";
$fn->();
+
+finish 0;