File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -303,3 +303,26 @@ git -C "$empty" config user.name "Foobar"
303
303
git -C " $empty " commit --allow-empty --allow-empty-message --message " "
304
304
305
305
nix eval --impure --expr " let attrs = builtins.fetchGit $empty ; in assert attrs.lastModified != 0; assert attrs.rev != \" 0000000000000000000000000000000000000000\" ; assert attrs.revCount == 1; true"
306
+
307
+ # Test a repo with `eol=crlf`.
308
+ repo=" $TEST_ROOT /crlf"
309
+ git init " $repo "
310
+ git -C $repo config user.email " foobar@example.com"
311
+ git -C $repo config user.name " Foobar"
312
+
313
+ echo -n -e ' foo\nbar\nbaz' > " $repo /newlines.txt"
314
+ echo -n -e ' foo\nbar\nbaz' > " $repo /test.txt"
315
+ git -C " $repo " add newlines.txt test.txt
316
+ git -C " $repo " commit -m ' Add files containing LF line endings'
317
+ echo ' test.txt eol=crlf' > " $repo /.gitattributes"
318
+ git -C " $repo " add .gitattributes
319
+ git -C " $repo " commit -m ' Add eol=crlf to gitattributes'
320
+ narhash=$( nix eval --raw --impure --expr " (builtins.fetchGit { url = \" $repo \" ; ref = \" master\" ; }).narHash" )
321
+ [[ " $narhash " = " sha256-k7u7RAaF+OvrbtT3KCCDQA8e9uOdflUo5zSgsosoLzA=" ]]
322
+
323
+ # Ensure that NAR hash doesn't depend on user configuration.
324
+ rm -rf $TEST_HOME /.cache/nix
325
+ export GIT_CONFIG_GLOBAL=" $TEST_ROOT /gitconfig"
326
+ git config --global core.autocrlf true
327
+ new_narhash=$( nix eval --raw --impure --expr " (builtins.fetchGit { url = \" $repo \" ; ref = \" master\" ; }).narHash" )
328
+ [[ " $new_narhash " = " $narhash " ]]
You can’t perform that action at this time.
0 commit comments