1
0
Fork 0
mirror of https://github.com/NixOS/nix synced 2025-06-29 06:21:14 +02:00

Don't dereference top-level regular files

Since this yielded an empty directory as far back as Nix 2.3, we don't
really need special handling for executables vs non-executables.
This commit is contained in:
Eelco Dolstra 2024-07-29 14:34:02 +02:00
parent e0012b97ab
commit 7c18b4d060
3 changed files with 3 additions and 17 deletions

View file

@ -491,14 +491,13 @@ struct GitRepoImpl : GitRepo, std::enable_shared_from_this<GitRepoImpl>
{
auto oid = hashToOID(oid_);
/* If the root directory contains */
auto _tree = lookupObject(*this, oid, GIT_OBJECT_TREE);
auto tree = (const git_tree *) &*_tree;
if (git_tree_entrycount(tree) == 1) {
auto entry = git_tree_entry_byindex(tree, 0);
auto mode = git_tree_entry_filemode(entry);
if (mode == GIT_FILEMODE_BLOB || mode == GIT_FILEMODE_TREE)
if (mode == GIT_FILEMODE_TREE)
oid = *git_tree_entry_id(entry);
}