-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathpkgcommit
More file actions
executable file
·47 lines (42 loc) · 843 Bytes
/
pkgcommit
File metadata and controls
executable file
·47 lines (42 loc) · 843 Bytes
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
36
37
38
39
40
41
42
43
44
45
46
47
#!/usr/bin/env bash
# handy wrapper for 'git commit', prepending package name
# (c) 2019-2024 Michał Górny <mgorny@gentoo.org>
# SPDX-License-Identifier: GPL-2.0-or-later
args=()
msg=
used_bump=
# check for -m ...
while [[ ${#} -gt 0 ]]; do
case ${1} in
-m)
msg=${2}
shift 2
continue
;;
--bump)
if [[ ! -f .pkgbump-pv ]]; then
echo "No .pkgbump-pv (pkgbump not used?)" >&2
exit 1
fi
# make sure it doesn't up being committed
git rm --cached .pkgbump-pv || :
used_bump=1
msg="Bump to $(<.pkgbump-pv)"
shift
continue
;;
esac
args+=( "${1}" )
shift
done
set -e -x
tmpf=$(mktemp)
echo "$(pkg): ${msg}" > "${tmpf}"
[[ ${msg} ]] || ${EDITOR:-vim} "${tmpf}"
if [[ -s ${tmpf} ]]; then
git commit -F "${tmpf}" "${args[@]}"
fi
rm -f "${tmpf}"
if [[ ${used_bump} ]]; then
rm .pkgbump-pv
fi