Skip to content
Snippets Groups Projects
Commit e8fa9a45 authored by vlorentz's avatar vlorentz
Browse files

to_disk: Represent revisions as empty directories instead of symlinks

The symlink representation is slightly ambiguous, so not necessarily
very useful.
Additionally, it made directory-flat bundles differ from a non-recursive
'git clone' checkout, which confuses Guix and potentially other tools.

We may revisit this in the future, eg. by adding a dotfile in the
directory or metadata at the root.
parent b153a693
No related branches found
Tags v1.9.0
1 merge request!187to_disk: Represent revisions as empty directories instead of symlinks
Pipeline #4285 passed
......@@ -580,8 +580,8 @@ class TestDirectoryCooker:
with cook_extract_directory_dircooker(
swh_storage, dir.swhid(), fsck=False
) as p:
assert (p / "submodule").is_symlink()
assert os.readlink(str(p / "submodule")) == target_rev
assert (p / "submodule").is_dir()
assert list((p / "submodule").iterdir()) == []
class RepoFixtures:
......
......@@ -133,8 +133,7 @@ class DirectoryBuilder:
identifier."""
for file_data in revs_data:
path = os.path.join(self.root, file_data["path"])
target = hashutil.hash_to_bytehex(file_data["target"])
self._create_file(path, target, mode=DentryPerms.symlink)
os.makedirs(path)
def _create_file(
self, path: bytes, content: bytes, mode: int = DentryPerms.content
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment