What's cooking (2011/04 #06)
[alt-git.git] / pre-applypatch
blobae85e5a2d6c7f0c3827849318e82e9f89817bc76
1 #!/bin/sh
3 . git-sh-setup
5 # Avoid duplicated test numbers --- checking 'pu' is enough
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'
11 if test -n "$added"
12 then
13 bad=
14 exists=$(
15 git ls-tree --name-only pu:t |
16 sed -ne 's|^\(t[0-9][0-9][0-9][0-9]\)-.*\.sh$|\1|p' |
17 tr "\012" " "
19 for a in $added
21 case " $exists " in
22 *" $a "*)
23 echo >&2 "Test number $a already taken"
24 bad=1
26 esac
27 done
28 if test -n "$bad"
29 then
30 exit 1