]> git.scottworley.com Git - pinch/blobdiff - tests/reject-duplicates.sh
fallback git-cache 1.2.1 -> 1.3.1
[pinch] / tests / reject-duplicates.sh
index d30bc40e32ab37217f21279930d452f9fb44fc2f..a6978f8dd3f0706bc2ddc507ecec57ad38a0b67e 100755 (executable)
@@ -1,50 +1,23 @@
 #!/bin/sh
 
-set -e
+. ./tests/lib/test-setup.sh
 
-repo_dir1="`mktemp -d`"
-repo1="$repo_dir1/repo"
-git init "$repo1"
-(
-  cd "$repo1"
-  echo Contents > test-file
-  git add test-file
-  git commit -m 'Commit message'
-)
+foo_setup
 
-repo_dir2="`mktemp -d`"
-repo2="$repo_dir2/repo"
-git init "$repo2"
-(
-  cd "$repo2"
-  echo Contents > test-file
-  git add test-file
-  git commit -m 'Commit message'
-)
+repo_dir1=$repo_dir
+repo1=$repo
+conf1=$conf
 
-conf1="`mktemp`"
-cat > "$conf1" <<EOF
-[same]
-git_repo = file://$repo1
-git_ref = master
-EOF
-
-conf2="`mktemp`"
-cat > "$conf2" <<EOF
-[same]
-git_repo = file://$repo2
-git_ref = master
-EOF
+foo_setup
 
 python3 ./pinch.py pin "$conf1"
-python3 ./pinch.py pin "$conf2"
+python3 ./pinch.py pin "$conf"
 
-if python3 ./pinch.py update --dry-run "$conf1" "$conf2";then
+if python3 ./pinch.py update --dry-run "$conf1" "$conf";then
   echo "FAIL: Duplicate names should be rejected"
   exit 1
 else
   echo PASS
 fi
 
-rm -rf "$repo_dir1" "$repo_dir2" "$conf1" "$conf2"
-
+rm -rf "$repo_dir1" "$repo1" "$conf1"