File: generate_changelog.sh

package info (click to toggle)
gimp 3.0.4-3
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 210,076 kB
  • sloc: ansic: 842,287; lisp: 10,761; python: 10,318; cpp: 7,238; perl: 4,355; sh: 1,043; xml: 963; yacc: 609; lex: 348; javascript: 150; makefile: 43
file content (35 lines) | stat: -rwxr-xr-x 870 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash

srcdir="$1"
output="$2"

echo "Creating ${output} based on git log"

gitdir="${srcdir}/.git"

if [[ ! -d "${gitdir}" ]]; then
    echo "A git checkout and git-log is required to write changelog in ${output}." \
    | tee ${output} >&2
    exit 1
fi


CHANGELOG_START=74424325abb54620b370f2595445b2b2a19fe5e7

( \
    git log "${CHANGELOG_START}^.." --stat "${srcdir}" | fmt --split-only \
        > "${output}.tmp" \
    && [ ${PIPESTATUS[0]} -eq 0 ] \
    && mv "${output}.tmp" "${output}" -f \
    && echo "Appending ChangeLog.pre-git" \
    && cat "${srcdir}/ChangeLog.pre-git" >> "${output}" \
    && exit 0
) \
||\
( \
    rm "${output}.tmp" -f \
    && echo "Failed to generate ChangeLog, your ChangeLog may be outdated" >&2 \
    && (test -f "${output}" \
        || echo "git-log is required to generate this file" >> "${output}") \
    && exit 1
)