MCPcopy Create free account
hub / github.com/decaporg/decap-cms / getTreeFiles

Function getTreeFiles

packages/decap-cms-backend-github/src/API.ts:200–218  ·  view source on GitHub ↗
(files: GitHubCompareFiles)

Source from the content-addressed store, hash-verified

198}
199
200function getTreeFiles(files: GitHubCompareFiles) {
201 const treeFiles = files.reduce((arr, file) => {
202 if (file.status === 'removed') {
203 // delete the file
204 arr.push({ sha: null, path: file.filename });
205 } else if (file.status === 'renamed') {
206 // delete the previous file
207 arr.push({ sha: null, path: file.previous_filename as string });
208 // add the renamed file
209 arr.push({ sha: file.sha, path: file.filename });
210 } else {
211 // add the file
212 arr.push({ sha: file.sha, path: file.filename });
213 }
214 return arr;
215 }, [] as TreeFileForUpdate[]);
216
217 return treeFiles;
218}
219
220export type Diff = {
221 path: string;

Callers 2

rebaseSingleCommitMethod · 0.85
forceMergePRMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected