From 4488e5d0f908ced3cec63cd9ca1ac2a733195a6b Mon Sep 17 00:00:00 2001 From: YongHyunKing Date: Mon, 7 Oct 2024 23:23:02 +0900 Subject: [PATCH] =?UTF-8?q?[engine]=20git.worker.ts=EC=97=90=20=EC=83=88?= =?UTF-8?q?=EB=A1=9C=EC=9A=B4=20git=20format=20=EC=A0=81=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/vscode/src/extension.ts | 3 +-- packages/vscode/src/utils/git.util.ts | 2 ++ packages/vscode/src/utils/git.worker.ts | 23 +++++++++++++++++++++-- 3 files changed, 24 insertions(+), 4 deletions(-) diff --git a/packages/vscode/src/extension.ts b/packages/vscode/src/extension.ts index 77ec148c..4e7f3bfe 100644 --- a/packages/vscode/src/extension.ts +++ b/packages/vscode/src/extension.ts @@ -60,8 +60,7 @@ export async function activate(context: vscode.ExtensionContext) { const fetchBranches = async () => await getBranches(gitPath, currentWorkspacePath); - // const gitLog = await fetchGitLogInParallel(gitPath, currentWorkspacePath); - const gitLog = await getGitLog(gitPath, currentWorkspacePath); + const gitLog = await fetchGitLogInParallel(gitPath, currentWorkspacePath); const fetchCurrentBranch = async () => { let branchName; diff --git a/packages/vscode/src/utils/git.util.ts b/packages/vscode/src/utils/git.util.ts index 795afb36..7a97caa6 100644 --- a/packages/vscode/src/utils/git.util.ts +++ b/packages/vscode/src/utils/git.util.ts @@ -259,6 +259,8 @@ if (totalCnt > taskThreshold) { currentWorkspacePath, skipCount, limitCount, + COMMIT_SEPARATOR, + GIT_LOG_SEPARATOR }, }); diff --git a/packages/vscode/src/utils/git.worker.ts b/packages/vscode/src/utils/git.worker.ts index 4a3f9a49..5540fc2a 100644 --- a/packages/vscode/src/utils/git.worker.ts +++ b/packages/vscode/src/utils/git.worker.ts @@ -3,9 +3,28 @@ import { parentPort, workerData } from 'worker_threads'; import { resolveSpawnOutput } from './git.util' -const { gitPath, currentWorkspacePath, skipCount, limitCount } = workerData; +const { gitPath, currentWorkspacePath, skipCount, limitCount,COMMIT_SEPARATOR,GIT_LOG_SEPARATOR } = workerData; + + + async function getPartialGitLog() { + const gitLogFormat = + COMMIT_SEPARATOR + + [ + "%H", // commit hash (id) + "%P", // parent hashes + "%D", // ref names (branches, tags) + "%an", // author name + "%ae", // author email + "%ad", // author date + "%cn", + "%ce", + "%cd", // committer name, committer email and committer date + "%B", // commit message (subject and body) + ].join(GIT_LOG_SEPARATOR) + + GIT_LOG_SEPARATOR; + const args = [ '--no-pager', 'log', @@ -13,7 +32,7 @@ async function getPartialGitLog() { '--parents', '--numstat', '--date-order', - '--pretty=fuller', + `--pretty=format:${gitLogFormat}`, '--decorate', '-c', `--skip=${skipCount}`,