Keep track of some hooks used by the primary repository

todo
Junio C Hamano 2010-01-21 23:36:31 -08:00
parent bb45256da8
commit 0197e22269
2 changed files with 55 additions and 0 deletions

23
post-applypatch Executable file
View File

@ -0,0 +1,23 @@
#!/bin/sh

GIT_DIR=.git
dotest="$GIT_DIR/rebase-apply"

prec=4 &&
this=$(cat 2>/dev/null "$dotest/next") &&
msgnum=$(printf "%0${prec}d" $this) &&
test -f "$dotest/$msgnum" &&
message_id=$(sed -n '
/^Message-I[Dd]:[ ]*\(<.*>\)[ ]*$/{
s//\1/p
q
}
/^$/q
' "$dotest/$msgnum") &&

test -n "$message_id" &&
head=$(git rev-parse --verify HEAD 2>/dev/null) &&

echo "$head $message_id" >>"$GIT_DIR"/am.log &&
GIT_NOTES_REF=refs/notes/amlog \
git notes edit -m "Message-Id: $message_id" "$head"

32
pre-applypatch Executable file
View File

@ -0,0 +1,32 @@
#!/bin/sh

. git-sh-setup

# Avoid duplicated test numbers --- checking 'pu' is enough
# as we will usually add, but never remove them.
added=$(
git diff-index --cached --name-only --diff-filter=A HEAD -- t |
sed -ne 's|t/\(t[0-9][0-9][0-9][0-9]\)-.*\.sh$|\1|p'
)
if test -n "$added"
then
bad=
exists=$(
git ls-tree --name-only pu:t |
sed -ne 's|^\(t[0-9][0-9][0-9][0-9]\)-.*\.sh$|\1|p' |
tr "\012" " "
)
for a in $added
do
case " $exists " in
*" $a "*)
echo "Test number $a already taken"
bad=1
;;
esac
done
if test -n "$bad"
then
exit 1
fi
fi