about summary refs log tree commit diff stats
path: root/dscip
diff options
context:
space:
mode:
Diffstat (limited to 'dscip')
-rwxr-xr-xdscip7
1 files changed, 5 insertions, 2 deletions
diff --git a/dscip b/dscip
index de733e7..d27c9cc 100755
--- a/dscip
+++ b/dscip
@@ -114,12 +114,15 @@ run () {
 	# Loads last commit hash if it exists. # 
 	if [ -f "$WORKING_DIRECTORY/LAST_COMMIT" ]; then
 		LAST_COMMIT="$(cat "$WORKING_DIRECTORY/LAST_COMMIT")"
-		export LAST_COMMIT
+		if [ -z "$LAST_COMMIT" ]; then # Check if LAST_COMMIT was grabbed successfully.
+			return 0
+		fi
 	fi
+	export LAST_COMMIT
 
 	# Loads current commit hash #
 	CURRENT_COMMIT=$(git ls-remote "$DSCIP_GITREPO" | awk "/refs\/(heads|tags)\/$DSCIP_BRANCH/{print \$1}")
-	if [ -z "$CURRENT_COMMIT" ]; then
+	if [ -z "$CURRENT_COMMIT" ]; then # Checks if CURRENT_COMMIT is blank, if so, abort script.
 		return 0
 	fi
 	export CURRENT_COMMIT