From 6cdcebb9d42ddbd4e47278c9ac55c93f2c69122d Mon Sep 17 00:00:00 2001 From: Joseph Werle Date: Sun, 12 Jun 2022 15:57:42 +0200 Subject: [PATCH] fix(scripts/git-tag-history): check for diff before modifying --- scripts/fix-tag-history | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/scripts/fix-tag-history b/scripts/fix-tag-history index 85214be..802ccaa 100755 --- a/scripts/fix-tag-history +++ b/scripts/fix-tag-history @@ -15,14 +15,17 @@ for tag in "${tags[@]}"; do ## set versions in files sed -i "$regex" bpkg.sh sed -i "$regex" setup.sh - ## remove current tag - git tag -d "$tag" - ## amend HEAD for current tag - git commit -a --amend --no-edit - ## retag - git tag "$tag" - ## force push update - git push origin "$tag" -f + + if ! git diff --exit-code; then + ## remove current tag + git tag -d "$tag" + ## amend HEAD for current tag + git commit -a --amend --no-edit + ## retag + git tag "$tag" + ## force push update + git push origin "$tag" -f + fi done git checkout master