forked from lix-project/lix
Merge "libfetchers: represent unfetched submodules consistently" into main
This commit is contained in:
commit
fed34594d8
|
@ -232,7 +232,7 @@ std::pair<StorePath, Input> fetchFromWorkdir(ref<Store> store, Input & input, co
|
||||||
if (S_ISDIR(st.st_mode)) {
|
if (S_ISDIR(st.st_mode)) {
|
||||||
auto prefix = file + "/";
|
auto prefix = file + "/";
|
||||||
auto i = files.lower_bound(prefix);
|
auto i = files.lower_bound(prefix);
|
||||||
return i != files.end() && (*i).starts_with(prefix);
|
return (i != files.end() && (*i).starts_with(prefix)) || files.count(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
return files.count(file);
|
return files.count(file);
|
||||||
|
|
|
@ -40,6 +40,7 @@ initGitRepo $rootRepo
|
||||||
git -C $rootRepo submodule init
|
git -C $rootRepo submodule init
|
||||||
git -C $rootRepo submodule add $subRepo sub
|
git -C $rootRepo submodule add $subRepo sub
|
||||||
git -C $rootRepo add sub
|
git -C $rootRepo add sub
|
||||||
|
r0=$(nix eval --impure --raw --expr "(builtins.fetchGit { url = file://$rootRepo; }).outPath")
|
||||||
git -C $rootRepo commit -m "Add submodule"
|
git -C $rootRepo commit -m "Add submodule"
|
||||||
|
|
||||||
rev=$(git -C $rootRepo rev-parse HEAD)
|
rev=$(git -C $rootRepo rev-parse HEAD)
|
||||||
|
@ -48,6 +49,7 @@ r1=$(nix eval --raw --expr "(builtins.fetchGit { url = file://$rootRepo; rev = \
|
||||||
r2=$(nix eval --raw --expr "(builtins.fetchGit { url = file://$rootRepo; rev = \"$rev\"; submodules = false; }).outPath")
|
r2=$(nix eval --raw --expr "(builtins.fetchGit { url = file://$rootRepo; rev = \"$rev\"; submodules = false; }).outPath")
|
||||||
r3=$(nix eval --raw --expr "(builtins.fetchGit { url = file://$rootRepo; rev = \"$rev\"; submodules = true; }).outPath")
|
r3=$(nix eval --raw --expr "(builtins.fetchGit { url = file://$rootRepo; rev = \"$rev\"; submodules = true; }).outPath")
|
||||||
|
|
||||||
|
[[ $r0 == $r1 ]] # verify that unfetched submodules result in empty directories in dirty mode too
|
||||||
[[ $r1 == $r2 ]]
|
[[ $r1 == $r2 ]]
|
||||||
[[ $r2 != $r3 ]]
|
[[ $r2 != $r3 ]]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue