I'm trying to work out how to block tags from being moved in a stash repository. I have the 'reject force push' plugin enabled (on stash3.1.3), but it doesn't seem to work reliably with tags.
Starting with an empty repository:
echo "A" > file git add file; git commit -m 'add' file; git push git tag -a -m 'tag' test; git push --tags echo "B" > file git add file; git commit -m 'change' file; git push git tag -a -f -m 'tag2' test git push --tags --force # This should error, but doesn't git tag -a -f -m 'tag-back' test HEAD^ # Move the tag back to the original position git push --tags --force # This does error
I suspect that the code is assuming that a move-forward is always OK? This is true for force pushes to branches, but not for tags.
I've also tried the 'force field' plugin from the marketplace, but get the same result.
Not sure if this is a bug or a missing feature?
However, even if it is a bug I think that I'm going to have to write my own plugin to ban tag deletions anyway.
A bit of testing seems to show that a prereceive hook that blocks refChanges where (refChange.getType != RefChangeType.ADD && refChange.getRefId().startsWith("refs/tags/")) will work - is that right?
I can't work out what the from/to hash ids are for an UPDATE to a tag, so I'm worried I'm missing something...
Community moderators have prevented the ability to post new answers.
This looks like a bug (anything with --force swhould fail). Report it here.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for adding the bug Bradley, this is being fixed in Stash 3.2
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.