diff --git a/abump.in b/abump.in index 2ee8fce..80112b6 100644 --- a/abump.in +++ b/abump.in @@ -51,6 +51,9 @@ do_bump() { || die "APKBUILD has different \$pkgname for $name" type package | grep -q function \ || die "missing package() for $name" + if [ "$pkgver" = "$ver" ] && git diff-index --quiet HEAD -- APKBUILD; then + die "version is already $ver" + fi cd "${a%/*}" section=${PWD%/*} diff --git a/tests/abump.bats b/tests/abump.bats index 13d0c39..e9bda21 100644 --- a/tests/abump.bats +++ b/tests/abump.bats @@ -83,3 +83,33 @@ teardown() { run $ABUMP foo-1.0 [ $status -ne 0 ] } + +@test "abump: test bumping same version which is not in git" { + mkdir -p "$tmpdir"/main/foo + cd "$tmpdir"/main/foo + echo "first" > foo-1.0.txt + echo "second" > foo-1.1.txt + cat > APKBUILD <<-EOF + # Maintainer: Test user + pkgname="foo" + pkgver=1.0 + pkgrel=0 + pkgdesc="dummy package for test" + url="https://alpinelinux.org" + license="MIT" + arch="noarch" + source="foo-\$pkgver.txt" + options="!check" + package() { + install -D "\$srcdir"/foo-\$pkgver.txt "\$pkgdir"/foo + } + EOF + $ABUILD checksum + $ABUILD + git add APKBUILD foo-1.0.txt + git commit -m "test commit" + + sed -i -e 's/pkgver=.*/pkgver=1.1/' APKBUILD + + $ABUMP foo-1.1 +}