mirror of
https://gerrit.googlesource.com/git-repo
synced 2026-05-07 11:29:27 +00:00
project: support reftable anchors in worktree .git migration
The reftable backend creates real refs/ and reftable/ dirs. Update _MigrateOldWorkTreeGitDir to expect these dirs and remove them. Bug: 476209856 Change-Id: I4700da70cb466e25ecbc51ba4de9a906b8716bd8 Reviewed-on: https://gerrit-review.googlesource.com/c/git-repo/+/550761 Reviewed-by: Mike Frysinger <vapier@google.com> Tested-by: Gavin Mak <gavinmak@google.com> Commit-Queue: Gavin Mak <gavinmak@google.com>
This commit is contained in:
@@ -341,6 +341,7 @@ class MigrateWorkTreeTests(unittest.TestCase):
|
||||
"""Check _MigrateOldWorkTreeGitDir handling."""
|
||||
|
||||
_SYMLINKS = {
|
||||
# go/keep-sorted start
|
||||
"config",
|
||||
"description",
|
||||
"hooks",
|
||||
@@ -349,9 +350,11 @@ class MigrateWorkTreeTests(unittest.TestCase):
|
||||
"objects",
|
||||
"packed-refs",
|
||||
"refs",
|
||||
"reftable",
|
||||
"rr-cache",
|
||||
"shallow",
|
||||
"svn",
|
||||
# go/keep-sorted end
|
||||
}
|
||||
_FILES = {
|
||||
"COMMIT_EDITMSG",
|
||||
@@ -430,6 +433,25 @@ class MigrateWorkTreeTests(unittest.TestCase):
|
||||
for name in self._SYMLINKS:
|
||||
self.assertTrue((dotgit / name).is_symlink())
|
||||
|
||||
def test_reftable_anchor_with_refs_dir(self):
|
||||
"""Migrate when reftable/ and refs/ are directories."""
|
||||
with self._simple_layout() as tempdir:
|
||||
dotgit = tempdir / "src/test/.git"
|
||||
(dotgit / "refs").unlink()
|
||||
(dotgit / "refs").mkdir()
|
||||
(dotgit / "refs" / "heads").write_text("dummy")
|
||||
|
||||
(dotgit / "reftable").unlink()
|
||||
(dotgit / "reftable").mkdir()
|
||||
(dotgit / "reftable" / "tables.list").write_text("dummy")
|
||||
project.Project._MigrateOldWorkTreeGitDir(str(dotgit))
|
||||
|
||||
self.assertTrue(dotgit.is_symlink())
|
||||
self.assertEqual(
|
||||
os.readlink(dotgit),
|
||||
os.path.normpath("../../.repo/projects/src/test.git"),
|
||||
)
|
||||
|
||||
|
||||
class ManifestPropertiesFetchedCorrectly(unittest.TestCase):
|
||||
"""Ensure properties are fetched properly."""
|
||||
|
||||
Reference in New Issue
Block a user