MCPcopy Index your code
hub / github.com/changesets/changesets / getChangedChangesetFilesSinceRef

Function getChangedChangesetFilesSinceRef

packages/git/src/index.ts:221–251  ·  view source on GitHub ↗
({
  cwd,
  ref,
}: {
  cwd: string;
  ref: string;
})

Source from the content-addressed store, hash-verified

219
220// below are less generic functions that we use in combination with other things we are doing
221export async function getChangedChangesetFilesSinceRef({
222 cwd,
223 ref,
224}: {
225 cwd: string;
226 ref: string;
227}): Promise<Array<string>> {
228 try {
229 const divergedAt = await getDivergedCommit(cwd, ref);
230 // Now we can find which files we added
231 const cmd = await spawn(
232 "git",
233 ["diff", "--name-only", "--diff-filter=d", "--no-relative", divergedAt],
234 {
235 cwd,
236 }
237 );
238
239 let tester = /.changeset\/[^/]+\.md$/;
240
241 const files = cmd.stdout
242 .toString()
243 .trim()
244 .split("\n")
245 .filter((file) => tester.test(file));
246 return files;
247 } catch (err) {
248 if (err instanceof GitError) return [];
249 throw err;
250 }
251}
252
253export async function getChangedPackagesSinceRef({
254 cwd,

Callers 1

index.test.tsFile · 0.85

Calls 1

getDivergedCommitFunction · 0.85

Tested by

no test coverage detected