diff options
author | Matěj Cepl <mcepl@cepl.eu> | 2024-07-19 22:51:20 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@cepl.eu> | 2024-10-07 11:02:09 +0200 |
commit | 09ecef53ab3b13990dce64d09d7200e5800d20d0 (patch) | |
tree | 479623f9030712c5812d1a45db98d64630d81c2e /git-vc | |
parent | d18be7283b483cde0e270d3ab2e1ffea38300e1b (diff) | |
download | gosc-09ecef53ab3b13990dce64d09d7200e5800d20d0.tar.gz |
fix(git-vc): allow setting BEFORE commit directly
If the last Version: in the SPEC file is not a formatted tag,
this allows to specify the previous commit ID on the command line
as an argument.
Diffstat (limited to 'git-vc')
-rwxr-xr-x | git-vc | 10 |
1 files changed, 7 insertions, 3 deletions
@@ -4,13 +4,17 @@ set -eu EDITOR=${EDITOR:-vi} REPO="$(basename "$(readlink -f .)")" -BEFORE=$(git diff --color=never|awk -F. '/^-Version/ {print $NF}') +if [ "$#" -gt 0 ] ; then + BEFORE="$1" +else + BEFORE=$(git diff --color=never|awk -F. '/^-Version/ {print $NF}') +fi AFTER=$(git diff --color=never|awk -F. '/^+Version/ {print $NF}') -[ -z "$BEFORE" -o -z "$AFTER" ] && exit 0 +[ -z "$BEFORE" ] || [ "$AFTER" ] && exit 0 cd "$REPO" CHGLOG="$(git log --pretty='format: - %s' "$BEFORE..$AFTER")" cd .. osc vc -m "Update from $BEFORE to $AFTER:\n$CHGLOG" -$EDITOR *.changes +$EDITOR ./*.changes |