* Builds a deferred stub for a repository file. Content is empty and fetched * lazily via getDocument for new/changed files only. The contentHash is the git * blob objectId, identical between the stub and the hydrated document.
(organization: string, project: string, entry: RepoFileEntry)
| 843 | * blob objectId, identical between the stub and the hydrated document. |
| 844 | */ |
| 845 | function fileToStub(organization: string, project: string, entry: RepoFileEntry): ExternalDocument { |
| 846 | const path = entry.item.path |
| 847 | const title = path.split('/').filter(Boolean).pop() || path |
| 848 | return { |
| 849 | externalId: fileExternalId(entry.repoId, path), |
| 850 | title, |
| 851 | content: '', |
| 852 | contentDeferred: true, |
| 853 | mimeType: 'text/plain', |
| 854 | sourceUrl: buildFileSourceUrl(entry.repoWebUrl, entry.branch, path), |
| 855 | contentHash: buildFileContentHash(entry.repoId, entry.item.objectId), |
| 856 | metadata: { |
| 857 | kind: 'file', |
| 858 | organization, |
| 859 | project, |
| 860 | repository: entry.repoName, |
| 861 | repositoryId: entry.repoId, |
| 862 | branch: entry.branch, |
| 863 | path, |
| 864 | }, |
| 865 | } |
| 866 | } |
| 867 | |
| 868 | /** |
| 869 | * Resolves the flattened, filtered list of repository files for the configured |
no test coverage detected