diff --git a/app/src/api.js b/app/src/api.js index c17566e3..142f7ec3 100644 --- a/app/src/api.js +++ b/app/src/api.js @@ -2529,7 +2529,7 @@ export async function getRepo(repoId) { await reposError(response, 'Failed to fetch repo.'); } -// `repo`: {url, name?, tag_name?, frequency?, mode?, branch?, description?} +// `repo`: {url, directory?, name?, tag_name?, frequency?, mode?, branch?, description?} export async function createRepo(repo) { const response = await apiPost(REPOS_API, repo); if (response.ok) { @@ -2597,8 +2597,7 @@ export function repoArchiveURL(repoId) { return `${REPOS_API}/${repoId}/archive.zip`; } -// What importing the git clone in `directory` (relative to the media directory) would do, with the URL the -// import will use. Changes nothing. +// What importing the git clone in `directory` (relative to the media directory) would do. Changes nothing. export async function inspectRepoImport(directory, name, tagName, url) { const body = {directory, name: name || null, tag_name: tagName || null, url: url || null}; const response = await apiPost(`${REPOS_API}/import/inspect`, body); @@ -2608,8 +2607,7 @@ export async function inspectRepoImport(directory, name, tagName, url) { return {error: await getErrorMessage(response, 'Cannot import this directory.')}; } -// Import an existing git clone as a Repo. `repo`: {directory, destination, confirm, url?, name?, tag_name?, ...} -// `destination` is the inspected one; the server refuses to move the clone anywhere else. +// Import an existing git clone as a Repo; it stays where it is. `repo`: {directory, confirm, url?, name?, ...} export async function importRepo(repo) { const response = await apiPost(`${REPOS_API}/import`, repo); if (response.ok) { diff --git a/app/src/components/Repos.js b/app/src/components/Repos.js index cfb76774..10d33de2 100644 --- a/app/src/components/Repos.js +++ b/app/src/components/Repos.js @@ -545,6 +545,7 @@ export function RepoNewPage() { const [branch, setBranch] = useState(''); const [submodules, setSubmodules] = useState(false); const [description, setDescription] = useState(''); + const [directory, setDirectory] = useState(''); const [submitting, setSubmitting] = useState(false); const urlIsValid = !!safeRepoHref(url.trim()); @@ -563,6 +564,7 @@ export function RepoNewPage() { branch: branch.trim() || null, submodules, description: description.trim() || null, + directory: directory.trim() || null, }); toast({type: 'success', title: 'Repo added', description: repo.name, time: 3000}); navigate(`/repos/${repo.id}`); @@ -617,6 +619,15 @@ export function RepoNewPage() { + + + setDirectory(value || '')}/> + + Optional. Empty saves it in the Repos Directory, whose files are never indexed. The + files of a repo in another directory are indexed (searchable), unless you ignore that + directory in Files. The directory must be empty. + +