mirror of https://github.com/logseq/logseq
Merge pull request #955 from logseq/fix/git-add-today-journal
fix: git add today's journal even if it existspull/970/head
commit
d2bb957a31
|
@ -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]}]
|
||||
|
|
|
@ -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!
|
||||
[]
|
||||
|
|
Loading…
Reference in New Issue