Keep track of some hooks used by the primary repository
Junio C Hamano committed
Jan 21, 2010 at 23:36 UTC
0197e2226950f107723575c23fda49cd7e6b9f61
2 files changed
+55
post-applypatch
new
+23
@@ -0,0 +1,23 @@
1
+#!/bin/sh
2
+
3
+GIT_DIR=.git
4
+dotest="$GIT_DIR/rebase-apply"
5
+
6
+prec=4 &&
7
+this=$(cat 2>/dev/null "$dotest/next") &&
8
+msgnum=$(printf "%0${prec}d" $this) &&
9
+test -f "$dotest/$msgnum" &&
10
+message_id=$(sed -n '
11
+ /^Message-I[Dd]:[ ]*\(<.*>\)[ ]*$/{
12
+ s//\1/p
13
+ q
14
+ }
15
+ /^$/q
16
+' "$dotest/$msgnum") &&
17
+
18
+test -n "$message_id" &&
19
+head=$(git rev-parse --verify HEAD 2>/dev/null) &&
20
+
21
+echo "$head $message_id" >>"$GIT_DIR"/am.log &&
22
+GIT_NOTES_REF=refs/notes/amlog \
23
+ git notes edit -m "Message-Id: $message_id" "$head"
pre-applypatch
new
+32
@@ -0,0 +1,32 @@
1
+#!/bin/sh
2
+
3
+. git-sh-setup
4
+
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'
10
+)
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" " "
18
+ )
19
+ for a in $added
20
+ do
21
+ case " $exists " in
22
+ *" $a "*)
23
+ echo "Test number $a already taken"
24
+ bad=1
25
+ ;;
26
+ esac
27
+ done
28
+ if test -n "$bad"
29
+ then
30
+ exit 1
31
+ fi
32
+fi