Improve tag update script

This commit is contained in:
Philipp Oppermann
2015-12-20 15:32:26 +01:00
parent 60eb7ed4a7
commit dced423588
2 changed files with 7 additions and 11 deletions

View File

@@ -12,9 +12,11 @@
# Exit if anything fails
set -e
my_dir=`dirname $0`
# Copy internal script to a temporary untracked file because an untracked
# file is kept by git when switching branches (that way we can update tags
# where this script doesn't exist).
cp "cherry_pick_to_tags_internal.sh" "cherry_pick_to_tags_internal_tmp.sh"
sh "cherry_pick_to_tags_internal_tmp.sh" $*
rm "cherry_pick_to_tags_internal_tmp.sh"
cp "$my_dir/cherry_pick_to_tags_internal.sh" "$my_dir/cherry_pick_to_tags_internal_tmp.sh"
sh "$my_dir/cherry_pick_to_tags_internal_tmp.sh" $*
rm "$my_dir/cherry_pick_to_tags_internal_tmp.sh"

View File

@@ -17,10 +17,6 @@ if [ "$#" -lt 2 ]; then
exit 1
fi
branch_name=$(git symbolic-ref -q HEAD)
branch_name=${branch_name##refs/heads/}
branch_name=${branch_name:-HEAD}
commit="$1"
echo "current branch $branch_name"
@@ -33,16 +29,14 @@ shift
for tag in "$@"; do
echo "UPDATING TAG $tag"
{
git branch tmp_update_tag_"$tag" "$tag"
git co "$tag"
# cherry pick commit and update tag
git checkout tmp_update_tag_"$tag"
git cherry-pick -x "$commit"
git tag -f "$tag" HEAD
# switch back to previous branch
git checkout "$branch_name"
git branch -D tmp_update_tag_"$tag"
git co -
# push the updated tag
git push origin "$tag" --force