chiark / gitweb /
worktree support: Fix playtree_setup
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Wed, 2 Aug 2017 18:19:38 +0000 (19:19 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Thu, 3 Aug 2017 19:37:19 +0000 (20:37 +0100)
In a worktree, .git is not a directory.  We need to use
$maindir_common.  Add a comment, too.

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

index 52e192e..3abb174 100644 (file)
@@ -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 $!;