waitstatusmsg failedcmd_waitstatus
failedcmd_report_cmd failedcmd
runcmd shell_cmd cmdoutput cmdoutput_errok
- git_rev_parse git_cat_file
+ git_rev_parse changedir_git_toplevel git_cat_file
git_get_ref git_get_symref git_for_each_ref
git_for_each_tag_referring is_fast_fwd
git_check_unmodified
our $versiontag_re = qr{[-+.\%_0-9a-zA-Z/]+};
our $branchprefix = 'dgit';
our $series_filename_re = qr{(?:^|\.)series(?!\n)$}s;
-our $extra_orig_namepart_re = qr{[-0-9a-z]+};
+our $extra_orig_namepart_re = qr{[-0-9a-zA-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)?";
return cmdoutput qw(git rev-parse), "$_[0]~0";
}
+sub changedir_git_toplevel () {
+ my $toplevel = cmdoutput qw(git rev-parse --show-toplevel);
+ length $toplevel or fail __ <<END;
+not in a git working tree?
+(git rev-parse --show-toplevel produced no output)
+END
+ chdir $toplevel or fail f_ "chdir toplevel %s: %s\n", $toplevel, $!;
+}
+
sub git_cat_file ($;$) {
my ($objname, $etype) = @_;
# => ($type, $data) or ('missing', undef)