-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #766 from githru/feature/712
[engine] feature/712 브랜치에서 작업한 내용을 main 브랜치에 반영
- Loading branch information
Showing
7 changed files
with
140 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import * as cp from "child_process"; | ||
import { parentPort, workerData } from "worker_threads"; | ||
|
||
import { resolveSpawnOutput } from "./git.util"; | ||
|
||
const { gitPath, currentWorkspacePath, skipCount, limitCount } = workerData; | ||
|
||
async function getPartialGitLog() { | ||
const gitLogFormat = | ||
"%n%n" + | ||
[ | ||
"%H", // commit hash (id) | ||
"%P", // parent hashes | ||
"%D", // ref names (branches, tags) | ||
"%an", // author name | ||
"%ae", // author email | ||
"%ad", // author date | ||
"%cn", // committer name | ||
"%ce", // committer email | ||
"%cd", // committer date | ||
"%w(0,0,4)%s", // commit message subject | ||
"%b", // commit message body | ||
].join("%n"); | ||
|
||
const args = [ | ||
"--no-pager", | ||
"log", | ||
"--all", | ||
"--parents", | ||
"--numstat", | ||
"--date-order", | ||
`--pretty=format:${gitLogFormat}`, | ||
"--decorate", | ||
"-c", | ||
`--skip=${skipCount}`, | ||
`-n ${limitCount}`, | ||
]; | ||
|
||
resolveSpawnOutput( | ||
cp.spawn(gitPath, args, { | ||
cwd: currentWorkspacePath, | ||
env: Object.assign({}, process.env), | ||
}) | ||
) | ||
.then(([status, stdout, stderr]) => { | ||
const { code, error } = status; | ||
|
||
if (code === 0 && !error && parentPort !== null) { | ||
parentPort.postMessage(stdout.toString()); | ||
} else { | ||
if (parentPort !== null) parentPort.postMessage(stderr); | ||
} | ||
}) | ||
.catch((error) => { | ||
console.error("Spawn Error:", error); | ||
}); | ||
} | ||
|
||
getPartialGitLog(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters