From e04e236a703c24e462a0e500d2232d4509028101 Mon Sep 17 00:00:00 2001 From: Anton Golub Date: Tue, 19 Dec 2023 22:48:05 +0300 Subject: [PATCH] feat: log commit delta from initial if another from ref is not specified --- src/main/js/api/git.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/js/api/git.js b/src/main/js/api/git.js index ae8faee..48b3112 100644 --- a/src/main/js/api/git.js +++ b/src/main/js/api/git.js @@ -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('+++')