summaryrefslogtreecommitdiff
path: root/dgit
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2017-08-02 16:46:37 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2017-08-03 09:57:52 +0100
commit9e4421b0f366840ee6935acc6b077224173e893f (patch)
treefeb8a40b7fe55bc1cfa82ef5fd746aff4563188b /dgit
parent92c7352791550d402fe59214d437f13aa564207a (diff)
directory handling: dgit: Use $maindir rather than ../../..
Replace all the open-coded ../.. constructs with references to $maindir. Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Diffstat (limited to 'dgit')
-rwxr-xr-xdgit20
1 files changed, 12 insertions, 8 deletions
diff --git a/dgit b/dgit
index 1db1430..bc8274f 100755
--- a/dgit
+++ b/dgit
@@ -1709,8 +1709,8 @@ sub remove_stray_gits ($) {
sub mktree_in_ud_from_only_subdir ($;$) {
my ($what,$raw) = @_;
-
# changes into the subdir
+
my (@dirs) = <*/.>;
die "expected one subdir but found @dirs ?" unless @dirs==1;
$dirs[0] =~ m#^([^/]+)/\.$# or die;
@@ -2057,7 +2057,7 @@ sub generate_commits_from_dsc () {
foreach my $fi (@dfi) {
my $f = $fi->{Filename};
die "$f ?" if $f =~ m#/|^\.|\.dsc$|\.tmp$#;
- my $upper_f = "../../../../$f";
+ my $upper_f = "$maindir/../$f";
printdebug "considering reusing $f: ";
@@ -2376,6 +2376,10 @@ END
local $ENV{GIT_AUTHOR_DATE} = $authline[2];
my $path = $ENV{PATH} or die;
+
+ # we use ../../gbp-pq-output, which (given that we are in
+ # $playground/PLAYTREE, and $playground is .git/dgit/unpack,
+ # is .git/dgit.
foreach my $use_absurd (qw(0 1)) {
runcmd @git, qw(checkout -q unpa);
@@ -3731,7 +3735,7 @@ sub maybe_split_brain_save ($$$) {
my ($headref, $dgitview, $msg) = @_;
# => message fragment "$saved" describing disposition of $dgitview
return "commit id $dgitview" unless defined $split_brain_save;
- my @cmd = (shell_cmd "cd ../../../..",
+ my @cmd = (shell_cmd 'cd "$1"; shift', $maindir,
@git, qw(update-ref -m),
"dgit --dgit-view-save $msg HEAD=$headref",
$split_brain_save, $dgitview);
@@ -4217,7 +4221,7 @@ END
changedir $playground;
progress "checking that $dscfn corresponds to HEAD";
runcmd qw(dpkg-source -x --),
- $dscpath =~ m#^/# ? $dscpath : "../../../$dscpath";
+ $dscpath =~ m#^/# ? $dscpath : "$maindir/$dscpath";
my ($tree,$dir) = mktree_in_ud_from_only_subdir("source package");
check_for_vendor_patches() if madformat($dsc->{format});
changedir $maindir;
@@ -5363,7 +5367,7 @@ sub quilt_fixup_linkorigs ($$) {
my ($upstreamversion, $fn) = @_;
# calls $fn->($leafname);
- foreach my $f (<../../../../*>) { #/){
+ foreach my $f (<$maindir/../*>) { #/){
my $b=$f; $b =~ s{.*/}{};
{
local ($debuglevel) = $debuglevel-1;
@@ -5442,12 +5446,12 @@ END
debian/control debian/changelog);
foreach my $maybe (qw(debian/patches debian/source/options
debian/tests/control)) {
- next unless stat_exists "../../../$maybe";
+ next unless stat_exists "$maindir/$maybe";
push @files, $maybe;
}
my $debtar= srcfn $fakeversion,'.debian.tar.gz';
- runcmd qw(env GZIP=-1n tar -zcf), "./$debtar", qw(-C ../../..), @files;
+ runcmd qw(env GZIP=-1n tar -zcf), "./$debtar", qw(-C), $maindir, @files;
$dscaddfile->($debtar);
close $fakedsc or die $!;
@@ -5490,7 +5494,7 @@ sub quilt_check_splitbrain_cache ($$) {
debugcmd "|(probably)",@cmd;
my $child = open GC, "-|"; defined $child or die $!;
if (!$child) {
- chdir '../../..' or die $!;
+ chdir $maindir or die $!;
if (!stat ".git/logs/refs/$splitbraincache") {
$! == ENOENT or die $!;
printdebug ">(no reflog)\n";