commit 2d1674b88488f45d1cf6ea52e9d721de739047b4
parent fe0e510dce20e5f89c1f69fcfa9488e0d63bc3fa
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Wed, 5 Feb 2025 12:32:32 +0100
Ensure that tests use the local git-wad executable
This was not the case for the wad filters invoked by git. They could
either use the wrong version or fail, depending on whether git-wad was
installed or not. In any case, this was not the expected behavior.
Diffstat:
2 files changed, 23 insertions(+), 19 deletions(-)
diff --git a/test_tiny_bin.sh b/test_tiny_bin.sh
@@ -27,7 +27,9 @@ die()
trap 'die $?' EXIT
trap 'die 1' TERM INT
-git_wad="$(pwd)/git-wad"
+# Use the local git-wad
+current="$(pwd)"
+export PATH="${current}":"${PATH}"
# Working directory
tmpdir="$(mktemp -d "${TMPDIR:-/tmp}"/git_wad_test_XXXXXX)"
@@ -61,12 +63,12 @@ cd "${repo}_ref"
git init
git config --local user.name "John Doe"
git config --local user.email "john@doe.com"
-"${git_wad}" init
+git wad init
git add ./*.bin README .gitattributes
git commit -m "Test small binaries"
git remote add origin "file://${repo}.git"
git push origin master
-"${git_wad}" push
+git wad push
########################################################################
# The test
@@ -88,9 +90,9 @@ diff "${repo}/.gitattributes" "${repo}_ref/.gitattributes"
# Restore the files managed by git-wad
cd "${repo}"
-"${git_wad}" init
-"${git_wad}" pull
-"${git_wad}" status
+git wad init
+git wad pull
+git wad status
# Check that, once restored, the files managed by git-wad are the same
# as the original files.
diff --git a/test_update.sh b/test_update.sh
@@ -27,7 +27,9 @@ die()
trap 'die $?' EXIT
trap 'die 1' TERM INT
-git_wad="$(pwd)/git-wad"
+# Use the local git-wad
+current="$(pwd)"
+export PATH="${current}":"${PATH}"
# Working directory
tmpdir="$(mktemp -d "${TMPDIR:-/tmp}"/git_wad_test_XXXXXX)"
@@ -54,12 +56,12 @@ cd "${repo}_ref"
git init
git config --local user.name "Jane Doe"
git config --local user.email "jane@doe.com"
-"${git_wad}" init
+git wad init
git add ./*.bin .gitattributes
git commit -m "Commit 2 binaries"
git remote add origin "file://${repo}.git"
git push origin master
-"${git_wad}" push
+git wad push
########################################################################
# Test binary updates
@@ -71,8 +73,8 @@ git clone "file://${repo}.git"
# Restore file contents and check that it the same as the original
# commited files
cd "${repo}"
-"${git_wad}" init
-"${git_wad}" pull
+git wad init
+git wad pull
diff "${repo}/file0.bin" "${repo}_ref/file0.bin"
diff "${repo}/file1.bin" "${repo}_ref/file1.bin"
@@ -82,13 +84,13 @@ dd if=/dev/random of="${repo}_ref/file2.bin" bs=1024 count="314"
git add ./file2.bin
git commit -m "Add a new binary"
git push origin master
-"${git_wad}" push
+git wad push
# Pull the updates
cd "${repo}"
git pull origin master
-"${git_wad}" pull
-"${git_wad}" status
+git wad pull
+git wad status
diff "${repo}/file0.bin" "${repo}_ref/file0.bin"
diff "${repo}/file1.bin" "${repo}_ref/file1.bin"
diff "${repo}/file2.bin" "${repo}_ref/file2.bin"
@@ -99,7 +101,7 @@ dd if=/dev/random of="${repo}_ref/file1.bin" \
bs=1 count=123 seek="$((42*1024))" conv=notrunc
git commit -am "Update some binarie content"
git push origin master
-"${git_wad}" push
+git wad push
# Check that files differ between desynchronized working directories
cd "${repo}"
@@ -107,9 +109,9 @@ diff "${repo}/file0.bin" "${repo}_ref/file0.bin"
! diff "${repo}/file1.bin" "${repo}_ref/file1.bin" || exit 1
diff "${repo}/file2.bin" "${repo}_ref/file2.bin"
git pull origin master
-"${git_wad}" fetch
+git wad fetch
! diff "${repo}/file1.bin" "${repo}_ref/file1.bin" || exit 1
-"${git_wad}" checkout
+git wad checkout
diff "${repo}/file1.bin" "${repo}_ref/file1.bin"
########################################################################
@@ -126,11 +128,11 @@ check_wads_count 4
# Prune it and check that nothing was removed,
# i.e. there are always 4 WADs
-"${git_wad}" prune
+git wad prune
check_wads_count 4
# Prune all files except the WADs of the current HEAD, so that one file
# is deleted, namely the previous version of file1.bin before it was
# updated.
-"${git_wad}" prune -1
+git wad prune -1
check_wads_count 3