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