summaryrefslogtreecommitdiff
path: root/debian/patch-to-news
blob: f1f7abc880fa736ea5b8f4f78873c26dea74aa76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash

set -eo pipefail

patch="$1"

sed '
  # delete everything after the first line starting with "--- " (the diff)
  /^--- [^ ]/,$d' < "$patch" \
| tac \
| sed '
  # delete everything up to the first line containing only "---" (the diffstat)
  1,/^---$/d' \
| tac \
| sed '
  # delete everything before the first blank line (git summary line)
  1,/^$/d' \
| sed '
  # convert to our README.Debian NEWS format
  1 s/^/* /
  2,$ s/^/  /'

echo "  Patch: $(basename $patch)"