chiark / gitweb /
Test suite: setup import: Cope with nested and multiple imports
[dgit.git] / dgit
diff --git a/dgit b/dgit
index 9fcd1fcc40508cc34a5c51956e69ec5b44312cdb..7ca97c57f018f5b59df7ca92aa6868f8fa8ee503 100755 (executable)
--- a/dgit
+++ b/dgit
@@ -3917,6 +3917,22 @@ END
     ensuredir ".git/logs/refs/dgit-intern";
     my $makelogfh = new IO::File ".git/logs/refs/$splitbraincache", '>>'
       or die $!;
+
+    my $oldcache = git_get_ref "refs/$splitbraincache";
+    if ($oldcache eq $dgitview) {
+       my $tree = cmdoutput qw(git rev-parse), "$dgitview:";
+       # git update-ref doesn't always update, in this case.  *sigh*
+       my $dummy = make_commit_text <<END;
+tree $tree
+parent $dgitview
+author Dgit <dgit\@example.com> 1000000000 +0000
+committer Dgit <dgit\@example.com> 1000000000 +0000
+
+Dummy commit - do not use
+END
+       runcmd @git, qw(update-ref -m), "dgit $our_version - dummy",
+           "refs/$splitbraincache", $dummy;
+    }
     runcmd @git, qw(update-ref -m), $cachekey, "refs/$splitbraincache",
        $dgitview;