-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
builtins.fetchGit: Use clean, unsmudged files
- Loading branch information
Showing
2 changed files
with
181 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,14 +8,19 @@ fi | |
clearStore | ||
|
||
repo=$TEST_ROOT/git | ||
submodule_upstream=$TEST_ROOT/submodule-upstream | ||
|
||
export _NIX_FORCE_HTTP=1 | ||
|
||
rm -rf $repo ${repo}-tmp $TEST_HOME/.cache/nix $TEST_ROOT/worktree $TEST_ROOT/shallow | ||
|
||
git init $repo | ||
git -C $repo config user.email "[email protected]" | ||
git -C $repo config user.name "Foobar" | ||
init_repo() { | ||
git init $1 | ||
git -C $1 config user.email "[email protected]" | ||
git -C $1 config user.name "Foobar" | ||
} | ||
|
||
init_repo $repo | ||
|
||
echo utrecht > $repo/hello | ||
touch $repo/.gitignore | ||
|
@@ -283,7 +288,29 @@ cmp $path7/einstein.q <(echo "> Insanity is building the same thing over and ove | |
path8=$(nix eval --impure --raw --expr "(builtins.fetchGit { url = $repo; rev = \"$rev4\"; }).outPath") | ||
[[ $path7 = $path8 ]] | ||
|
||
# Files are clean when fetching from a local repo with local changes without ref or rev and submodules = true. | ||
echo "All impurity needs to gain a foothold is for people of good conscience to remain unaware of undeclared inputs." >$repo/jefferson.q | ||
git -C $repo add -N $repo/jefferson.q | ||
|
||
path8=$(nix eval --impure --raw --expr "(builtins.fetchGit { url = $repo; submodules = true; }).outPath") | ||
cmp $path8/jefferson.q <(echo "> All impurity needs to gain a foothold is for people of good conscience to remain unaware of undeclared inputs.") | ||
|
||
# Files are clean when fetching from a local repo with local changes without ref or rev. | ||
path9=$(nix eval --impure --raw --expr "(builtins.fetchGit $repo).outPath") | ||
cmp $path9/jefferson.q <(echo "> All impurity needs to gain a foothold is for people of good conscience to remain unaware of undeclared inputs.") | ||
|
||
# Changes in submodules are included | ||
init_repo $submodule_upstream | ||
echo "# Auxiliary quotes" >$submodule_upstream/README.md | ||
git -C $submodule_upstream add $submodule_upstream/README.md | ||
git -C $submodule_upstream commit -m 'First commit' | ||
git -C $repo submodule add $submodule_upstream aux-quotes | ||
echo > $repo/aux-quotes/wisdom "Teach a man to write hello and you'll confuse him for a day. Teach a man to write hello world, and you'll confuse him for a lifetime." | ||
echo > $repo/aux-quotes/actual-einstein "Nix doesn't play dice." | ||
git -C $repo/aux-quotes add -N $repo/aux-quotes/wisdom | ||
git -C $repo/aux-quotes add $repo/aux-quotes/actual-einstein | ||
# git -C $repo diff --submodule=diff | ||
path10=$(nix eval --impure --raw --expr "(builtins.fetchGit { url = $repo; submodules = true; }).outPath") | ||
cmp $path10/aux-quotes/wisdom <(echo "Teach a man to write hello and you'll confuse him for a day. Teach a man to write hello world, and you'll confuse him for a lifetime.") | ||
cmp $path10/aux-quotes/actual-einstein <(echo "Nix doesn't play dice.") | ||
|
||
# TBD |