Skip to content

Commit 78cfe9c

Browse files
committed
updateJoininBox: option to update to commit
1 parent 98a9b3f commit 78cfe9c

1 file changed

Lines changed: 18 additions & 14 deletions

File tree

scripts/_functions.sh

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -193,23 +193,27 @@ echo "# Checking the updates in https://github.com/openoms/joininbox"
193193
cd /home/joinmarket/joininbox
194194
# fetch latest master
195195
sudo -u joinmarket git fetch
196-
# unset $1
197-
set --
198-
UPSTREAM=${1:-'@{u}'}
199-
LOCAL=$(git rev-parse @)
200-
REMOTE=$(git rev-parse "$UPSTREAM")
201-
if [ $LOCAL = $REMOTE ]; then
202-
TAG=$(git tag | sort -V | tail -1)
203-
echo "# You are up-to-date on version" $TAG
196+
if [ "$1" = "commit" ]; then
197+
TAG=$(git describe --tags)
198+
echo "# Updating to the latest commit in the default branch:"
199+
echo "# $TAG"
204200
else
205-
echo "# Pulling latest changes..."
206-
sudo -u joinmarket git pull -p
207-
echo "# Reset to the latest release tag"
208201
TAG=$(git tag | sort -V | tail -1)
209-
sudo -u joinmarket git reset --hard $TAG
210-
echo "# Updated to version" $TAG
202+
# unset $1
203+
set --
204+
UPSTREAM=${1:-'@{u}'}
205+
LOCAL=$(git rev-parse @)
206+
REMOTE=$(git rev-parse "$UPSTREAM")
207+
if [ $LOCAL = $REMOTE ]; then
208+
echo "# You are up-to-date on version" $TAG
209+
else
210+
echo "# Pulling latest changes..."
211+
sudo -u joinmarket git pull -p
212+
echo "# Reset to the latest release tag"
213+
sudo -u joinmarket git reset --hard $TAG
214+
echo "# Updated to version" $TAG
215+
fi
211216
fi
212-
213217
echo "# Copying the scripts in place"
214218
sudo -u joinmarket cp /home/joinmarket/joininbox/scripts/*.* /home/joinmarket/
215219
sudo -u joinmarket cp /home/joinmarket/joininbox/scripts/.* /home/joinmarket/ 2>/dev/null

0 commit comments

Comments
 (0)