Skip to content

Commit

Permalink
fix getGitLog
Browse files Browse the repository at this point in the history
  • Loading branch information
TimurRin committed Jul 21, 2024
1 parent 8d6ab40 commit 61bb338
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 8 deletions.
4 changes: 2 additions & 2 deletions anca.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
"dataVersion": 0,
"version": {
"latest": "0.1.2",
"latestNext": "0.1.2+next.20240721_203213",
"timestamp": 1721593933
"latestNext": "0.1.2+next.20240721_211706",
"timestamp": 1721596626
},
"files": [
{
Expand Down
4 changes: 2 additions & 2 deletions src/cinnabar.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file was generated by Cinnabar Meta. Do not edit.

export const CINNABAR_PROJECT_TIMESTAMP = 1721593933;
export const CINNABAR_PROJECT_VERSION = "0.1.2+next.20240721_203213";
export const CINNABAR_PROJECT_TIMESTAMP = 1721596626;
export const CINNABAR_PROJECT_VERSION = "0.1.2+next.20240721_211706";
14 changes: 10 additions & 4 deletions src/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,17 @@ import { CinnabarMetaGitLogItem } from "./types.js";
export function getGitLog(tagOrCommit: string): CinnabarMetaGitLogItem[] {
try {
const log = execSync(
`git log ${tagOrCommit}..HEAD --pretty=format:'%H|%ad|%s|%an' --date=short`,
`git log ${tagOrCommit}..HEAD --pretty=format:'%H%n%B'`,
).toString();
return log.split("\n").map((line) => {
const [hash, date, message, author] = line.split("|");
return { author, date, hash, message };
return log.split("\n\n").map((line) => {
const [hash, ...message] = line.split("\n");
const messages: string[] = [];
message.forEach((msg) => {
if (msg.length > 0) {
messages.push(msg);
}
});
return { hash, message: messages.join("\n") };
});
} catch (error) {
console.error("Error fetching git log:", error);
Expand Down

0 comments on commit 61bb338

Please sign in to comment.