]>
Commit | Line | Data |
---|---|---|
0197e222 JH |
1 | #!/bin/sh |
2 | ||
3 | . git-sh-setup | |
4 | ||
c483b4cf | 5 | # Avoid duplicated test numbers --- checking 'seen' is enough |
0197e222 JH |
6 | # as we will usually add, but never remove them. |
7 | added=$( | |
8 | git diff-index --cached --name-only --diff-filter=A HEAD -- t | | |
9 | sed -ne 's|t/\(t[0-9][0-9][0-9][0-9]\)-.*\.sh$|\1|p' | |
10 | ) | |
11 | if test -n "$added" | |
12 | then | |
13 | bad= | |
14 | exists=$( | |
c483b4cf | 15 | git ls-tree --name-only seen:t | |
0197e222 JH |
16 | sed -ne 's|^\(t[0-9][0-9][0-9][0-9]\)-.*\.sh$|\1|p' | |
17 | tr "\012" " " | |
18 | ) | |
19 | for a in $added | |
20 | do | |
21 | case " $exists " in | |
22 | *" $a "*) | |
23b485f6 | 23 | echo >&2 "Test number $a already taken" |
0197e222 JH |
24 | bad=1 |
25 | ;; | |
26 | esac | |
27 | done | |
28 | if test -n "$bad" | |
29 | then | |
ca2a4aa4 | 30 | : exit 1 |
0197e222 JH |
31 | fi |
32 | fi |