]> git.scottworley.com Git - pinch/blob - tests/reject-duplicates.sh
d30bc40e32ab37217f21279930d452f9fb44fc2f
[pinch] / tests / reject-duplicates.sh
1 #!/bin/sh
2
3 set -e
4
5 repo_dir1="`mktemp -d`"
6 repo1="$repo_dir1/repo"
7 git init "$repo1"
8 (
9 cd "$repo1"
10 echo Contents > test-file
11 git add test-file
12 git commit -m 'Commit message'
13 )
14
15 repo_dir2="`mktemp -d`"
16 repo2="$repo_dir2/repo"
17 git init "$repo2"
18 (
19 cd "$repo2"
20 echo Contents > test-file
21 git add test-file
22 git commit -m 'Commit message'
23 )
24
25 conf1="`mktemp`"
26 cat > "$conf1" <<EOF
27 [same]
28 git_repo = file://$repo1
29 git_ref = master
30 EOF
31
32 conf2="`mktemp`"
33 cat > "$conf2" <<EOF
34 [same]
35 git_repo = file://$repo2
36 git_ref = master
37 EOF
38
39 python3 ./pinch.py pin "$conf1"
40 python3 ./pinch.py pin "$conf2"
41
42 if python3 ./pinch.py update --dry-run "$conf1" "$conf2";then
43 echo "FAIL: Duplicate names should be rejected"
44 exit 1
45 else
46 echo PASS
47 fi
48
49 rm -rf "$repo_dir1" "$repo_dir2" "$conf1" "$conf2"
50