Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fetchTree/fetchGit: add test for .gitattributes #9391

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions tests/functional/fetchGit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,25 @@ rev_tag2=$(git -C $repo rev-parse refs/tags/tag2)
[[ $rev_tag2_nix = $rev_tag2 ]]
unset _NIX_FORCE_HTTP

# Ensure export-ignore in .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 ]]

# Ensure export-subst in .gitattributes is respected
echo '$Format:%H$' > $repo/exported-file
echo '/exported-file export-subst' >> $repo/.gitattributes
git -C $repo add exported-file .gitattributes
git -C $repo commit -m 'Bla7'
rev6=$(git -C $repo rev-parse HEAD)
path13=$(nix eval --impure --raw --expr "(builtins.fetchGit { url = file://$repo; rev = \"$rev6\"; }).outPath")
[[ $(cat $path13/exported-file) = $rev6 ]]
[[ $(cat $path13/exported-file) != '$Format:%H$' ]]

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