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

Function getTreeFiles

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

Source from the content-addressed store, hash-verified

173}
174
175function getTreeFiles(files: GitHubCompareFiles) {
176 const treeFiles = files.reduce((arr, file) => {
177 if (file.status === 'removed') {
178 // delete the file
179 arr.push({ sha: null, path: file.filename });
180 } else if (file.status === 'renamed') {
181 // delete the previous file
182 arr.push({ sha: null, path: file.previous_filename as string });
183 // add the renamed file
184 arr.push({ sha: file.sha, path: file.filename });
185 } else {
186 // add the file
187 arr.push({ sha: file.sha, path: file.filename });
188 }
189 return arr;
190 }, [] as TreeFileForUpdate[]);
191
192 return treeFiles;
193}
194
195export type Diff = {
196 path: string;

Callers 2

rebaseSingleCommitMethod · 0.85
forceMergePRMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected