server_branch server_ref
stat_exists link_ltarget
hashfile
- fail ensuredir executable_on_path
+ fail ensuredir must_getcwd executable_on_path
waitstatusmsg failedcmd_waitstatus
failedcmd_report_cmd failedcmd
runcmd cmdoutput cmdoutput_errok
$debugprefix *debuglevel *DEBUG
shellquote printcmd messagequote
$negate_harmful_gitattrs
- git_slurp_config_src
+ changedir git_slurp_config_src
workarea_setup
fresh_workarea in_workarea);
# implicitly uses $main::us
die "mkdir $dir: $!";
}
+sub must_getcwd () {
+ my $d = getcwd();
+ defined $d or fail "getcwd failed: $!";
+ return $d;
+}
+
sub executable_on_path ($) {
my ($program) = @_;
return 1 if $program =~ m{/};
}
}
+sub changedir ($) {
+ my ($newdir) = @_;
+ printdebug "CD $newdir\n";
+ chdir $newdir or confess "chdir: $newdir: $!";
+}
+
sub git_slurp_config_src ($) {
my ($src) = @_;
# returns $r such that $r->{KEY}[] = VALUE
# $twa should be relative paths of the form .git/FOO/BAR
my ($twa) = @_;
$twa //= $wa;
- chdir $twa or die "$twa $!";
+ changedir $twa or die "$twa $!";
my $r = eval { $sub->($twa); };
- chdir '../../..' or die "$@; $!";
+ changedir '../../..' or die "$@; $!";
die $@ if length $@;
return $r;
}