[dim PATCH 3/7] dim: return early on tag-branch fail

Jani Nikula jani.nikula at intel.com
Wed Dec 5 15:02:55 UTC 2018


Reduce indent on the happy day scenario. Update error logging while at
it.

Signed-off-by: Jani Nikula <jani.nikula at intel.com>
---
 dim | 18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)

diff --git a/dim b/dim
index 8e782eecff70..b227f0db99dc 100755
--- a/dim
+++ b/dim
@@ -1892,16 +1892,16 @@ function dim_tag_branch
 
 	git fetch $remote
 
-	if [ $(git rev-parse $branch) == $(git rev-parse "$branch@{u}") ] ; then
-		echo "Tagging current $branch"
-
-		tag=$(tag_name "$branch")
-		tag_branch $tag $branch
-		git push $DRY_RUN $remote $tag
-	else
-		echo "$branch not up-to-date, aborting"
-		exit
+	if [ $(git rev-parse $branch) != $(git rev-parse "$branch@{u}") ]; then
+		echoerr "ERROR: $branch not up-to-date"
+		return 1
 	fi
+
+	echo "Tagging current $branch"
+
+	tag=$(tag_name "$branch")
+	tag_branch $tag $branch
+	git push $DRY_RUN $remote $tag
 }
 
 function dim_tag_next
-- 
2.11.0



More information about the dim-tools mailing list