Skip to content

Commit

Permalink
feat: log commit delta from initial if another from ref is not specified
Browse files Browse the repository at this point in the history
  • Loading branch information
antongolub committed Dec 19, 2023
1 parent c241c20 commit e04e236
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main/js/api/git.js
Original file line number Diff line number Diff line change
Expand Up @@ -87,9 +87,11 @@ export const getOrigin = memoizeBy(async (cwd) =>
)

export const getCommits = async (cwd, from, to = 'HEAD') => ctx(async ($) => {
const ref = from ? `${from}..${to}` : to

$.cwd = cwd

const _from = from || await $`git rev-list --max-parents=0 HEAD`
const ref = `${_from}..${to}`

return (await $.raw`git log ${ref} --format=+++%s__%b__%h__%H -- ${cwd}`)
.toString()
.split('+++')
Expand Down

0 comments on commit e04e236

Please sign in to comment.