aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rwxr-xr-xgist5
1 files changed, 4 insertions, 1 deletions
diff --git a/gist b/gist
index 455d4fa..9c6bdc6 100755
--- a/gist
+++ b/gist
@@ -267,10 +267,13 @@ _check_repo_status() {
267 fi 267 fi
268 else 268 else
269 cd "$1" || exit 1 269 cd "$1" || exit 1
270 if [[ -n $(git status --short) || $(git branch | sed -n '/\* / s///p') != 'master' ]] &>/dev/null; then 270 # git status is not clean or working on non-master branch
271 if [[ -n $(git status --short) || $(cat .git/HEAD) != 'ref: refs/heads/master' ]] &>/dev/null; then
271 echo "\e[36m[working]\e[0m" 272 echo "\e[36m[working]\e[0m"
272 else 273 else
274 # files contents are not the same with the last time called GIST API, so warn user to call 'gist fetch'
273 [[ $(_blob_code "$1") != "$2" ]] 2>/dev/null && local status="\e[31m[outdated]\e[0m" 275 [[ $(_blob_code "$1") != "$2" ]] 2>/dev/null && local status="\e[31m[outdated]\e[0m"
276 # current HEAD is newer than remote, warn user to call 'git push'
274 [[ -n $(git cherry) ]] 2>/dev/null && local status="\e[31m[ahead]\e[0m" 277 [[ -n $(git cherry) ]] 2>/dev/null && local status="\e[31m[ahead]\e[0m"
275 echo "$status" 278 echo "$status"
276 fi 279 fi