From 1b00a9cacf289a94f1fc9e5a1035c74c242dd23d Mon Sep 17 00:00:00 2001 From: typebrook Date: Tue, 19 May 2020 16:29:26 +0800 Subject: Fix 'push' command --- gist | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/gist b/gist index 3c3bfd7..ce633a4 100755 --- a/gist +++ b/gist @@ -623,16 +623,16 @@ _export_to_github() { # Simply commit current changes and push to remote _push_to_remote() { - if [[ ! $(pwd) =~ ^$folder/[0-9a-z]+$ ]]; then - _gist_id "$1" || return 1 - cd "$folder/$GIST_ID" - fi + _set_gist_id $1 || return 1 + cd "$folder/$GIST_ID" + if [[ -n $(git status --short) ]]; then git add . && git commit -m 'update' fi if [[ -n $(git cherry) ]]; then git push origin master && \ - (http_method GET "$GITHUB_API/gists/$GIST_ID" | _update_gist $1 &> /dev/null &) + http_method GET "$GITHUB_API/gists/$GIST_ID" | _update_gist $1 + # FIXME $1 might be empty fi } -- cgit v1.2.3-70-g09d2