chiark / gitweb /
dgit: Fix suggested diff rune in split brain mode
[dgit.git] / Debian / Dgit.pm
index b678ba53ead7cba05a4d579ebef5ae1f5f5df6c9..c4a61af1f081b62f21938ac86783a0deef000286 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: $!";
@@ -561,8 +561,8 @@ sub fresh_playground ($) {
     my ($spc) = @_;
     $spc = ensure_a_playground_parent $spc;
     rmtree $spc;
-    mkdir $spc or die "$spc $!";
-    return $playground = "$maindir/$spc";
+    mkdir $spc or fail "failed to mkdir the playground $spc: $!";
+    return $playground = $spc;
 }
 
 # ----- playtrees -----
@@ -582,8 +582,13 @@ sub playtree_setup (;$) {
        next unless $v;
        runcmd qw(git config), $copy, $_ foreach @$v;
     }
+    # this is confusing: we have
+    #   .                   playtree, not a worktree, has .git/, our cwd
+    #   $maindir            might be a worktree so
+    #   $maindir_gitdir     contains our main working "dgit", HEAD, etc.
+    #   $maindir_gitcommon  the shared stuff, including .objects
     rmtree('.git/objects');
-    symlink "$maindir/.git/objects",'.git/objects' or die $!;
+    symlink "$maindir_gitcommon/objects",'.git/objects' or die $!;
     ensuredir '.git/info';
     open GA, "> .git/info/attributes" or die $!;
     print GA "* $negate_harmful_gitattrs\n" or die $!;