...
 
Commits (2)
......@@ -4,6 +4,7 @@
import git from './git';
import pipe from './pipe';
import invariant from '../common/invariant';
export default function getWhatChanged(
revisions: string,
......@@ -29,6 +30,16 @@ export default function getWhatChanged(
);
}
// For Flow.
function getStatus(status: string): 'A' | 'D' | 'M' {
invariant(
status === 'A' || status === 'D' || status === 'M',
`getWhatChanged(): Status '%s' must be A, D or M.`,
status,
);
return status;
}
export async function forEachCommit(
commits: string,
callback: ({
......@@ -65,11 +76,8 @@ export async function forEachCommit(
updatedAt = match[2];
createdAt = match[3];
} else {
const status = match[4];
const status = getStatus(match[4]);
const file = match[5];
if (!status.match(/^[ADM]$/)) {
throw new Error(`getWhatChanged: Unrecognized status: '${status}'.`);
}
if (!commit || !createdAt || !file || !updatedAt) {
throw new Error(
'getWhatChanged: Failed to extract all of: commit, createdAt, file, updatedAt.',
......
......@@ -4208,9 +4208,9 @@ flat-cache@^1.2.1:
write "^0.2.1"
flow-bin@*:
version "0.87.0"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.87.0.tgz#fab7f984d8cc767e93fa9eb01cf7d57ed744f19d"
integrity sha512-mnvBXXZkUp4y6A96bR5BHa3q1ioIIN2L10w5osxJqagAakTXFYZwjl0t9cT3y2aCEf1wnK6n91xgYypQS/Dqbw==
version "0.89.0"
resolved "https://registry.yarnpkg.com/flow-bin/-/flow-bin-0.89.0.tgz#6bd29c2af7e0f429797f820662f33749105c32fa"
integrity sha512-DkO4PsXYrl53V6G5+t5HbRMC5ajYUQej2LEGPUZ+j9okTb41Sn5j9vfxsCpXMEAslYnQoysHhYu4GUZsQX/DrQ==
flow-typed@*:
version "2.5.1"
......