From e2353bcc8fc93c462f782652f3f3606a01a6914c Mon Sep 17 00:00:00 2001 From: Lorenzo Pacchiardi Date: Tue, 5 Jan 2021 16:04:18 +0100 Subject: [PATCH] Check for local untracked files when deploying (#168) * Check for local untracked files when deploying * Compress test for untracked files to 1 line Co-authored-by: Maruan * Add vendor to .gitignore * Add .bundle to .gitignore Co-authored-by: Maruan Al-Shedivat --- .gitignore | 2 ++ bin/deploy | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/.gitignore b/.gitignore index 1740398..51dd633 100644 --- a/.gitignore +++ b/.gitignore @@ -1,7 +1,9 @@ _site +.bundle .sass-cache .jekyll-metadata .DS_store .ruby-version .tweet-cache/ Gemfile.lock +vendor diff --git a/bin/deploy b/bin/deploy index 72b4e2f..070e2f7 100755 --- a/bin/deploy +++ b/bin/deploy @@ -67,6 +67,15 @@ if ! git diff-index --quiet HEAD --; then [[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 fi +# Check if there are any untracked files +if ! test -z "$(git ls-files --exclude-standard --others)"; then + echo "There are untracked files:" + git ls-files --exclude-standard --others + echo "Please commit those files or stash them before proceeding." + echo "Aborting." + [[ "$0" = "$BASH_SOURCE" ]] && exit 1 || return 1 +fi + # Switch to source branch (creates it if necessary from the current branch) if [ `git branch | grep $SRC_BRANCH | tr ' ' '\n' | tail -1` ] then