chiark / gitweb /
worktree support: Fix ensure_a_playground (gives absolute path now)
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 2 Aug 2017 18:17:14 +0000 (19:17 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 3 Aug 2017 17:14:59 +0000 (18:14 +0100)
Make it honour $maindir_gitdir so it will DTRT in a `git worktree'.
The .git/dgit play area ends up in the .git/worktrees/<worktreename>
for this worktree.

It now returns an absolute path.  The only call site that needs
adjusting is the one in fresh_playground.

Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
Debian/Dgit.pm

index b678ba5..52e192e 100644 (file)
@@ -543,7 +543,7 @@ our $playground;
 sub ensure_a_playground_parent ($) {
     my ($spc) = @_;
     record_maindir();
-    $spc = ".git/$spc";
+    $spc = "$maindir_gitdir/$spc";
     my $parent = dirname $spc;
     mkdir $parent or $!==EEXIST
        or fail "failed to mkdir playground parent $parent: $!";
@@ -562,7 +562,7 @@ sub fresh_playground ($) {
     $spc = ensure_a_playground_parent $spc;
     rmtree $spc;
     mkdir $spc or die "$spc $!";
-    return $playground = "$maindir/$spc";
+    return $playground = $spc;
 }
 
 # ----- playtrees -----