Skip to content

Format git log to include only commit shas #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions src/datomic/codeq/core.clj
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@
es))))

(defn commit
[[sha _]]
[sha]
(let [trim-email (fn [s] (subs s 1 (dec (count s))))
dt (fn [ds] (Date. (* 1000 (Integer/parseInt ds))))
[tree parents author committer msg]
Expand Down Expand Up @@ -420,14 +420,11 @@
tx))

(defn commits
"Returns log as [[sha msg] ...], in commit order. commit-name may be nil
"Returns log as [sha ...], in commit order. commit-name may be nil
or any acceptable commit name arg for git log"
[commit-name]
(let [commits (with-open [s (exec-stream (str "git log --pretty=oneline --date-order --reverse " commit-name))]
(mapv
#(vector (subs % 0 40)
(subs % 41 (count %)))
(line-seq s)))]
(let [commits (with-open [s (exec-stream (str "git log --pretty=format:%H --date-order --reverse " commit-name))]
(mapv identity (line-seq s)))]
commits))

(defn unimported-commits
Expand All @@ -439,7 +436,7 @@
[?tx :tx/commit ?e]
[?e :git/sha ?sha]]
db))]
(pmap commit (remove (fn [[sha _]] (imported sha)) (commits commit-name)))))
(pmap commit (remove (fn [sha] (imported sha)) (commits commit-name)))))


(defn ensure-db [db-uri]
Expand Down