Meta/Doit: retire unused script
[alt-git.git] / post-applypatch
blob1aa18f54e5d5bb3fe7011e0241f11d20bbb95043
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 to hold space
14 # Swap hold and pattern
16 # Remove the LF, making it a single line
17 s/\n//
18 # Swap hold and pattern back
20 # Discard the pattern and go on
23 # Hold this new line, and look at what is in the hold space
25 # Is it the Message-ID line? If so, spit out and finish.
26 /^[Mm][Ee][Ss][Ss][Aa][Gg][Ee]-[Ii][Dd]:[ ]*/{
27 s///p
30 # Otherwise, check if this new line is empty
32 # Is it? Then we are done with the header
33 /^$/b end
34 # Otherwise we need to hold onto this header line
36 # And start the next cycle
38 : end
40 ' "$dotest/$msgnum") &&
42 if test -n "$message_id" &&
43 head=$(git rev-parse --verify HEAD 2>/dev/null)
44 then
45 echo "$head $message_id" >>"$GIT_DIR"/am.log &&
46 GIT_NOTES_REF=refs/notes/amlog \
47 git notes add -f -m "Message-Id: $message_id" "$head"