aboutsummaryrefslogtreecommitdiffstats
path: root/git-vc
diff options
context:
space:
mode:
authorMatěj Cepl <mcepl@cepl.eu>2024-07-19 22:51:20 +0200
committerMatěj Cepl <mcepl@cepl.eu>2024-10-07 11:02:09 +0200
commit09ecef53ab3b13990dce64d09d7200e5800d20d0 (patch)
tree479623f9030712c5812d1a45db98d64630d81c2e /git-vc
parentd18be7283b483cde0e270d3ab2e1ffea38300e1b (diff)
downloadgosc-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-xgit-vc10
1 files changed, 7 insertions, 3 deletions
diff --git a/git-vc b/git-vc
index 5876236..e75f10a 100755
--- a/git-vc
+++ b/git-vc
@@ -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