From 681b19425bc29ecefd64baa6079a859be78e9afb Mon Sep 17 00:00:00 2001
From: Stefano Alberto Russo <stefano.russo@gmail.com>
Date: Mon, 20 Jan 2020 16:23:23 +0100
Subject: [PATCH] Fixed bug in rerunning a service if there are no changes in
 the Docker image.

---
 rosetta/rerun | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/rosetta/rerun b/rosetta/rerun
index 2ceb754..553a013 100755
--- a/rosetta/rerun
+++ b/rosetta/rerun
@@ -10,5 +10,11 @@ if [[ $# -eq 0 ]] ; then
     docker-compose down
     docker-compose up -d
 else
-    docker-compose up -d --no-deps $@
+    UPDATE_OUT=$(docker-compose up -d --no-deps $@ 2>&1)
+    if [[ $UPDATE_OUT == *"is up-to-date"* ]]; then
+        echo "Image is up to date, only restarting the service..."
+        docker-compose restart $@
+    else
+        echo "Updated image and restarted the the service."
+    fi
 fi
-- 
GitLab