Skip to content

Commit e6ec8db

Browse files
authored
Merge pull request #29 from coderoad/fix/commit-position-validation
Fix/commit position validation
2 parents 4f01daa + 54dfeda commit e6ec8db

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Diff for: src/utils/commits.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ export async function getCommits({
7575
// add to the list
7676
commits[position].push(commit.hash);
7777
}
78-
positions.push(position);
78+
positions.unshift(position);
7979
} else {
8080
const initMatches = commit.message.match(/^INIT/);
8181
if (initMatches && initMatches.length) {
@@ -86,7 +86,7 @@ export async function getCommits({
8686
// add to the list
8787
commits.INIT.push(commit.hash);
8888
}
89-
positions.push("INIT");
89+
positions.unshift("INIT");
9090
}
9191
}
9292
}

Diff for: src/utils/validateCommits.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ export function validateCommitOrder(positions: string[]): boolean {
1313
current = { level: 0, step: 0 };
1414
return;
1515
} else {
16-
const levelMatch = position.match(/^L([0-9])+$/);
17-
const stepMatch = position.match(/^L([0-9])+S([0-9])+$/);
16+
const levelMatch = position.match(/^L([0-9]+)Q?$/);
17+
const stepMatch = position.match(/^L([0-9]+)S([0-9]+)[Q|A]?$/);
1818
if (levelMatch) {
1919
// allows next level or step
2020
const [_, levelString] = levelMatch;
@@ -28,7 +28,7 @@ export function validateCommitOrder(positions: string[]): boolean {
2828
current = { level, step };
2929
} else {
3030
// error
31-
console.error(`Invalid commit position: ${position}`);
31+
console.warn(`Invalid commit position: ${position}`);
3232
return;
3333
}
3434
if (

0 commit comments

Comments
 (0)