Merge pull request #955 from logseq/fix/git-add-today-journal

fix: git add today's journal even if it exists
pull/970/head
Michael Wong 2020-12-18 17:28:28 +08:00 committed by GitHub
commit d2bb957a31
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 11 deletions

View File

@ -1,11 +1,11 @@
(ns frontend.handler.git
(:require [frontend.util :as util :refer-macros [profile]]
[promesa.core :as p]
[lambdaisland.glogi :as log]
[frontend.state :as state]
[frontend.db :as db]
[frontend.git :as git]
[frontend.date :as date]
[goog.object :as gobj]
[frontend.handler.notification :as notification]
[frontend.handler.route :as route-handler]
[frontend.handler.common :as common-handler]
@ -42,14 +42,17 @@
(defn commit-and-force-push!
[commit-message pushing?]
(when-let [repo (frontend.state/get-current-repo)]
(p/let [remote-oid (common-handler/get-remote-ref repo)
commit-oid (git/commit repo commit-message (array remote-oid))
result (git/write-ref! repo commit-oid)
token (helper/get-github-token repo)
push-result (git/push repo token true)]
(reset! pushing? false)
(notification/clear! nil)
(route-handler/redirect! {:to :home}))))
(->
(p/let [remote-oid (common-handler/get-remote-ref repo)
commit-oid (git/commit repo commit-message (array remote-oid))
result (git/write-ref! repo commit-oid)
token (helper/get-github-token repo)
push-result (git/push repo token true)]
(reset! pushing? false)
(notification/clear! nil)
(route-handler/redirect! {:to :home}))
(p/catch (fn [error]
(log/error :git/commit-and-force-push! error))))))
(defn git-set-username-email!
[repo-url {:keys [name email]}]

View File

@ -139,8 +139,8 @@
file-exists? (fs/create-if-not-exists repo-url repo-dir file-path content)]
(when-not file-exists?
(file-handler/reset-file! repo-url path content)
(ui-handler/re-render-root!)
(git-handler/git-add repo-url path)))))))
(ui-handler/re-render-root!))
(git-handler/git-add repo-url path))))))
(defn create-today-journal!
[]