Global search

{activeTab === "code" ? "Find where code was introduced" : "Find file history"}

{#if activeTab === "code"}
{#if isSearching} {/if}
{#if !hasRepository}
Open a repository first.
{:else if isSearching}
Searching all branches...
{:else if error}
{error}
{:else if !searched}
Search a string or paste a complete function to find where it was added.
{:else if results.length === 0}
No introduction found for "{searchedQuery}".
{:else}
{results.length} {results.length === 1 ? "introduction" : "introductions"} found for "{searchedQuery}"
{#each results as hit (`${hit.commit_hash}:${hit.file}:${hit.line_number ?? 0}`)}
{hit.short_hash} {hit.summary || "No commit message"} {#if hit.matches_added > 1} +{hit.matches_added} matches {/if}
{hit.author_name || "Unknown author"} {formatCommitDate(hit.date)}
{displayPath(hit)} {#if hit.line_number} :{hit.line_number} {/if}
{hit.line || searchedQuery}
{/each}
{/if}
{:else}
event.preventDefault()}>
{#if !hasRepository}
Open a repository first.
{:else if files.length === 0}
No files loaded for this repository.
{:else}
{#if !fileSearchActive}
Search a file name or path, then choose a result to show its history.
{:else if fileSearchResults.length === 0}
No file found for "{fileQuery.trim()}".
{:else}
{fileSearchResults.length} {fileSearchResults.length === 1 ? "file" : "files"} found for "{fileQuery.trim()}"
{#each fileSearchResults as file (file.path)} {@const languageIcon = languageIconForPath(file.path)} {/each}
{/if}
History {selectedFilePath ? fileName(selectedFilePath) : "No file selected"}
{#if !selectedFilePath}
Select a file result to load its commit history.
{:else if isBusy}
Loading history...
{:else if fileHistory.length === 0}
No history returned for this file.
{:else}
{#each fileHistory as commit (commit.hash)}
{commit.short_hash} {commit.summary || "No commit message"} {commit.author_name || "Unknown author"} - {formatCommitDate(commit.date)}
{/each}
{/if}
{/if}
{/if}