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

Function getTreeFiles

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

Source from the content-addressed store, hash-verified

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

Callers 2

rebaseSingleCommitMethod · 0.85
forceMergePRMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected