Announce: we build for fc13 these days
[alt-git.git] / post-applypatch
blobdbe3e01b928880b7d75055799d3732328b8b4dbe
1 #!/bin/sh
3 GIT_DIR=.git
4 dotest="$GIT_DIR/rebase-apply"
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 -ne '
11 /^[ ]/{
12 # Append continuation line
15 s/\n//
19 # Hold this new line, and look at what is in the hold space
21 # Is it the Message-ID line? If so, spit out and finish.
22 /^[Mm][Ee][Ss][Ss][Aa][Gg][Ee]-[Ii][Dd]:[ ]*/{
23 s///p
26 # Otherwise, check if this new line is empty
28 # Is it? Then we are done with the header
29 /^$/b end
30 # Otherwise we need to hold onto this header line
32 # And start the next cycle
34 : end
36 ' "$dotest/$msgnum") &&
38 test -n "$message_id" &&
39 head=$(git rev-parse --verify HEAD 2>/dev/null) &&
41 echo "$head $message_id" >>"$GIT_DIR"/am.log &&
42 GIT_NOTES_REF=refs/notes/amlog \
43 git notes add -f -m "Message-Id: $message_id" "$head"