]> git.pld-linux.org Git - packages/rpm-build-tools.git/commitdiff
shrc: refuse to delete AC-branch if that branch point is unassociated (has no tag...
authorElan Ruusamäe <glen@delfi.ee>
Sun, 12 Aug 2012 20:48:28 +0000 (23:48 +0300)
committerElan Ruusamäe <glen@delfi.ee>
Sun, 12 Aug 2012 20:48:28 +0000 (23:48 +0300)
rpm-build.sh

index 312248ffc25258a6b6757eac071a4b8f0115026e..ddde76590da31ecf2f4d212d26f15d3095d50ced 100755 (executable)
@@ -20,15 +20,19 @@ alias $dist-requires=dist-requires
 
 # move AC-branch tag to current checkout
 # if AC-branch as branch exists, it is first removed
-# TODO: refuse to delete AC-branch if that branch point is unassociated (has no tag on the same hash)
 ac-tag() {
        # see if remote has branch present
-       if [ -n "$(git branch -r | grep AC-branch)" ]; then
-               git push --delete origin AC-branch
+       local branch=AC-branch
+       if [ -n "$(git branch -r | grep $branch)" ]; then
+               if [ -z "$(git tag --points-at $branch)" ]; then
+                       echo >&2 "There's no tag pointing to current $branch; refusing to delete branch"
+                       return 1
+               fi
+               git push --delete origin $branch
        fi
 
-       git tag -f AC-branch
-       git push origin AC-branch
+       git tag -f $branch
+       git push origin $branch
 }
 
 # undo spec utf8
This page took 0.037895 seconds and 4 git commands to generate.