What's cooking (2015/07 #07)
[alt-git.git] / pre-applypatch
blob4e6dbebd6fdeb2d0c9729e2dad1136f24b4d808d
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