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