add 'lfs pull' test with unicode filename

This commit is contained in:
risk danger olson 2016-02-21 11:10:36 -07:00
parent ad022c978e
commit d9e84ffa85
2 changed files with 41 additions and 19 deletions

@ -18,58 +18,76 @@ begin_test "pull"
contents="a" contents="a"
contents_oid=$(calc_oid "$contents") contents_oid=$(calc_oid "$contents")
contents2="A"
contents2_oid=$(calc_oid "$contents2")
printf "$contents" > a.dat printf "$contents" > a.dat
git add a.dat printf "$contents2" > á.dat
git add .gitattributes git add a.dat á.dat .gitattributes
git commit -m "add a.dat" 2>&1 | tee commit.log git commit -m "add files" 2>&1 | tee commit.log
grep "master (root-commit)" commit.log grep "master (root-commit)" commit.log
grep "2 files changed" commit.log grep "3 files changed" commit.log
grep "create mode 100644 a.dat" commit.log grep "create mode 100644 a.dat" commit.log
grep "create mode 100644 .gitattributes" commit.log grep "create mode 100644 .gitattributes" commit.log
ls -al
[ "a" = "$(cat a.dat)" ] [ "a" = "$(cat a.dat)" ]
[ "A" = "$(cat "á.dat")" ]
assert_pointer "master" "a.dat" "$contents_oid" 1 assert_pointer "master" "a.dat" "$contents_oid" 1
assert_pointer "master" "á.dat" "$contents2_oid" 1
refute_server_object "$reponame" "$contents_oid" refute_server_object "$reponame" "$contents_oid"
refute_server_object "$reponame" "$contents2_oid"
echo "initial push"
git push origin master 2>&1 | tee push.log git push origin master 2>&1 | tee push.log
grep "(1 of 1 files)" push.log grep "(2 of 2 files)" push.log
grep "master -> master" push.log grep "master -> master" push.log
assert_server_object "$reponame" "$contents_oid" assert_server_object "$reponame" "$contents_oid"
assert_server_object "$reponame" "$contents2_oid"
# change to the clone's working directory # change to the clone's working directory
cd ../clone cd ../clone
git pull 2>&1 | grep "Downloading a.dat (1 B)" echo "normal pull"
git pull 2>&1 | tee pull.log
grep "Downloading a.dat (1 B)" pull.log
grep "Downloading á.dat (1 B)" pull.log
[ "a" = "$(cat a.dat)" ] [ "a" = "$(cat a.dat)" ]
[ "A" = "$(cat "á.dat")" ]
assert_local_object "$contents_oid" 1 assert_local_object "$contents_oid" 1
assert_local_object "$contents2_oid" 1
echo "lfs pull"
# Remove the working directory and lfs files rm a.dat á.dat
rm a.dat
rm -rf .git/lfs/objects rm -rf .git/lfs/objects
git lfs pull 2>&1 | grep "(1 of 1 files)" git lfs pull 2>&1 | grep "(2 of 2 files)"
ls -al
[ "a" = "$(cat a.dat)" ] [ "a" = "$(cat a.dat)" ]
[ "A" = "$(cat "á.dat")" ]
assert_local_object "$contents_oid" 1 assert_local_object "$contents_oid" 1
assert_local_object "$contents2_oid" 1
# Try with remote arg echo "lfs pull with remote"
rm a.dat rm a.dat á.dat
rm -rf .git/lfs/objects rm -rf .git/lfs/objects
git lfs pull origin 2>&1 | grep "(1 of 1 files)" git lfs pull origin 2>&1 | grep "(2 of 2 files)"
[ "a" = "$(cat a.dat)" ] [ "a" = "$(cat a.dat)" ]
[ "A" = "$(cat "á.dat")" ]
assert_local_object "$contents_oid" 1 assert_local_object "$contents_oid" 1
assert_local_object "$contents2_oid" 1
# Remove just the working directory echo "lfs pull with local storage"
rm a.dat rm a.dat á.dat
git lfs pull git lfs pull
[ "a" = "$(cat a.dat)" ] [ "a" = "$(cat a.dat)" ]
[ "A" = "$(cat "á.dat")" ]
# Test include / exclude filters supplied in gitconfig echo "lfs pull with include/exclude filters in gitconfig"
rm -rf .git/lfs/objects rm -rf .git/lfs/objects
git config "lfs.fetchinclude" "a*" git config "lfs.fetchinclude" "a*"
git lfs pull git lfs pull
@ -81,7 +99,7 @@ begin_test "pull"
git lfs pull git lfs pull
refute_local_object "$contents_oid" refute_local_object "$contents_oid"
# Test include / exclude filters supplied on the command line echo "lfs pull with include/exclude filters in command line"
git config --unset "lfs.fetchexclude" git config --unset "lfs.fetchexclude"
rm -rf .git/lfs/objects rm -rf .git/lfs/objects
git lfs pull --include="a*" git lfs pull --include="a*"

@ -10,8 +10,12 @@ assert_pointer() {
local oid="$3" local oid="$3"
local size="$4" local size="$4"
tree=$(git ls-tree -lr "$ref") gitblob=$(git ls-tree -lrz "$ref" |
gitblob=$(echo "$tree" | grep "$path" | cut -f 3 -d " ") while read -r -d $'\0' x; do
echo $x
done |
grep "$path" | cut -f 3 -d " ")
actual=$(git cat-file -p $gitblob) actual=$(git cat-file -p $gitblob)
expected=$(pointer $oid $size) expected=$(pointer $oid $size)