Skip to content

Commit b3a6239

Browse files
committed
goodnight.sh: do not push if already up to date
Signed-off-by: Kipras Melnikovas <kipras@kipras.org>
1 parent 6cf104e commit b3a6239

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

goodnight.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,14 @@ set -e
1010
#
1111
CURR_BRANCH_PUSHED="origin/$(git branch --show)"
1212
git branch -f nightly "$CURR_BRANCH_PUSHED"
13-
git push -f origin nightly
13+
14+
LOCAL_NIGHTLY="$(git rev-parse nightly)"
15+
REMOTE_NIGHTLY="$(git rev-parse origin/nightly)"
16+
if [ "$LOCAL_NIGHTLY" = "$REMOTE_NIGHTLY" ]; then
17+
printf "Already up-to-date, skipping push.\n"
18+
else
19+
git push -f origin nightly
20+
fi
1421

1522
# create a git hook for this repo
1623
# that will auto-run this goodnight.sh script

0 commit comments

Comments
 (0)