fix: don't git push when it's already pushing

pull/667/head
Tienson Qin 2020-11-14 21:58:25 +08:00
parent ebb4e4c745
commit cdba94dae7
1 changed files with 9 additions and 3 deletions

View File

@ -387,9 +387,12 @@
commit-push? false
force? false}}]
(let [status (db/get-key-value repo-url :git/status)]
(when (and
(when (or
commit-push?
(and
(db/cloned? repo-url)
(not (state/get-edit-input-id)))
(not (state/get-edit-input-id))
(not= status :pushing)))
(-> (p/let [files (js/window.workerThread.getChangedFiles (util/get-repo-dir (state/get-current-repo)))]
(when (or
commit-push?
@ -419,6 +422,7 @@
(and permission? (not fallback?))
(request-app-tokens!
(fn []
(git-handler/set-git-status! repo-url :re-push)
(push repo-url
{:commit-message commit-message
:fallback? true}))
@ -439,6 +443,8 @@
nil)))))))))))
(p/catch (fn [error]
(println "Git push error: ")
(git-handler/set-git-status! repo-url :push-failed)
(git-handler/set-git-error! repo-url error)
(js/console.dir error)))))))
(defn push-if-auto-enabled!