]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Keep track of some hooks used by the primary repository
authorJunio C Hamano <gitster@pobox.com>
Fri, 22 Jan 2010 07:36:31 +0000 (23:36 -0800)
committerJunio C Hamano <gitster@pobox.com>
Sat, 23 Jan 2010 03:00:14 +0000 (19:00 -0800)
post-applypatch [new file with mode: 0755]
pre-applypatch [new file with mode: 0755]

diff --git a/post-applypatch b/post-applypatch
new file mode 100755 (executable)
index 0000000..a546636
--- /dev/null
@@ -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"
diff --git a/pre-applypatch b/pre-applypatch
new file mode 100755 (executable)
index 0000000..217b0b7
--- /dev/null
@@ -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