Skip to content

Commit

Permalink
fetchTree/fetchGit: add test for .gitattributes
Browse files Browse the repository at this point in the history
...with the intention to prevent future regressions in fetchGit
  • Loading branch information
DavHau authored and roberth committed Nov 27, 2023
1 parent 0c6fe1b commit e5c6a9e
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions tests/functional/fetchGit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,15 @@ rev_tag2=$(git -C $repo rev-parse refs/tags/tag2)
[[ $rev_tag2_nix = $rev_tag2 ]]
unset _NIX_FORCE_HTTP

# Ensure .gitattributes is respected
touch $repo/not-exported-file
echo "/not-exported-file export-ignore" >> $repo/.gitattributes
git -C $repo add not-exported-file .gitattributes
git -C $repo commit -m 'Bla6'
rev5=$(git -C $repo rev-parse HEAD)
path12=$(nix eval --impure --raw --expr "(builtins.fetchGit { url = file://$repo; rev = \"$rev5\"; }).outPath")
[[ ! -e $path12/not-exported-file ]]

# should fail if there is no repo
rm -rf $repo/.git
(! nix eval --impure --raw --expr "(builtins.fetchGit \"file://$repo\").outPath")
Expand Down

0 comments on commit e5c6a9e

Please sign in to comment.