File tree Expand file tree Collapse file tree 2 files changed +6
-5
lines changed
src/lib/services/backends Expand file tree Collapse file tree 2 files changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -310,14 +310,15 @@ const fetchLastCommit = async () => {
310310
311311/**
312312 * Fetch the repository’s complete file list, and return it in the canonical format.
313+ * @param {string } [lastHash] - The last commit’s SHA-1 hash.
313314 * @returns {Promise<BaseFileListItem[]> } File list.
314315 */
315- const fetchFileList = async ( ) => {
316+ const fetchFileList = async ( lastHash ) => {
316317 const { owner, repo, branch } = repository ;
317318
318319 const result =
319320 /** @type {{ tree: { type: string, path: string, sha: string, size: number }[] } } */ (
320- await fetchAPI ( `/repos/${ owner } /${ repo } /git/trees/${ branch } ?recursive=1` )
321+ await fetchAPI ( `/repos/${ owner } /${ repo } /git/trees/${ lastHash ?? branch } ?recursive=1` )
321322 ) ;
322323
323324 return result . tree
Original file line number Diff line number Diff line change @@ -67,8 +67,8 @@ export const createFileList = (files) => {
6767 * default branch name.
6868 * @param {() => Promise<{ hash: string, message: string }> } args.fetchLastCommit - Function to
6969 * fetch the last commit’s SHA-1 hash and message.
70- * @param {() => Promise<BaseFileListItem[]> } args.fetchFileList - Function to fetch the
71- * repository’s complete file list.
70+ * @param {(lastHash: string ) => Promise<BaseFileListItem[]> } args.fetchFileList - Function to fetch
71+ * the repository’s complete file list.
7272 * @param {(fetchingFiles: (BaseEntryListItem | BaseAssetListItem)[]) =>
7373 * Promise<RepositoryContentsMap>} args.fetchFileContents - Function to fetch the metadata of
7474 * entry/asset files as well as text file contents.
@@ -102,7 +102,7 @@ export const fetchAndParseFiles = async ({
102102 fileList = createFileList ( cachedFileEntries . map ( ( [ path , data ] ) => ( { path, ...data } ) ) ) ;
103103 } else {
104104 // Get a complete file list first, and filter what’s managed in CMS
105- fileList = createFileList ( await fetchFileList ( ) ) ;
105+ fileList = createFileList ( await fetchFileList ( lastHash ) ) ;
106106 metaDB . set ( 'last_commit_hash' , lastHash ) ;
107107 }
108108
You can’t perform that action at this time.
0 commit comments