mirror of
https://github.com/NixOS/nix.git
synced 2025-11-28 21:21:00 +01:00
Add test cases
This commit is contained in:
parent
14a7b651c1
commit
a649a53679
1 changed files with 23 additions and 0 deletions
|
|
@ -303,3 +303,26 @@ git -C "$empty" config user.name "Foobar"
|
|||
git -C "$empty" commit --allow-empty --allow-empty-message --message ""
|
||||
|
||||
nix eval --impure --expr "let attrs = builtins.fetchGit $empty; in assert attrs.lastModified != 0; assert attrs.rev != \"0000000000000000000000000000000000000000\"; assert attrs.revCount == 1; true"
|
||||
|
||||
# Test a repo with `eol=crlf`.
|
||||
repo="$TEST_ROOT/crlf"
|
||||
git init "$repo"
|
||||
git -C $repo config user.email "foobar@example.com"
|
||||
git -C $repo config user.name "Foobar"
|
||||
|
||||
echo -n -e 'foo\nbar\nbaz' > "$repo/newlines.txt"
|
||||
echo -n -e 'foo\nbar\nbaz' > "$repo/test.txt"
|
||||
git -C "$repo" add newlines.txt test.txt
|
||||
git -C "$repo" commit -m 'Add files containing LF line endings'
|
||||
echo 'test.txt eol=crlf' > "$repo/.gitattributes"
|
||||
git -C "$repo" add .gitattributes
|
||||
git -C "$repo" commit -m 'Add eol=crlf to gitattributes'
|
||||
narhash=$(nix eval --raw --impure --expr "(builtins.fetchGit { url = \"$repo\"; ref = \"master\"; }).narHash")
|
||||
[[ "$narhash" = "sha256-k7u7RAaF+OvrbtT3KCCDQA8e9uOdflUo5zSgsosoLzA=" ]]
|
||||
|
||||
# Ensure that NAR hash doesn't depend on user configuration.
|
||||
rm -rf $TEST_HOME/.cache/nix
|
||||
export GIT_CONFIG_GLOBAL="$TEST_ROOT/gitconfig"
|
||||
git config --global core.autocrlf true
|
||||
new_narhash=$(nix eval --raw --impure --expr "(builtins.fetchGit { url = \"$repo\"; ref = \"master\"; }).narHash")
|
||||
[[ "$new_narhash" = "$narhash" ]]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue