Compare commits

...
3 Commits
Author SHA1 Message Date
Christoph Brandau c087171735 Merge branch 'main' of https://git.cbsk-tech.de/Christoph/GitLite 2026-07-09 09:21:53 +02:00
Christoph Brandau 2d3c30b553 feat(App): enhance repository fetching with reference and commit updates
This update improves the repository fetching process by ensuring that
the references and commit graph are refreshed after fetching remote
repositories. This change enhances the accuracy of the displayed
repository state and ensures that users have the most up-to-date
information.

- Added a new function to refresh refs and commit history
- Integrated the refresh function into the fetching workflow
- Improved status application logic for active repositories
2026-07-09 09:21:33 +02:00
Christoph Brandau c8d5553214 refactor(App): streamline repo search and row mapping functions
This update enhances the repo search functionality by passing the search term directly to the filtering functions. It also refactors the row mapping functions to accept parameters for better flexibility and clarity, improving the overall readability and maintainability of the code.

- Simplified search and mapping logic for repositories
- Improved parameter handling in helper functions
2026-07-09 09:01:42 +02:00
+29 -15
View File
@@ -377,14 +377,14 @@
$: localBranchNames = localBranches.map((b) => b.name);
$: remoteBranches = branches.filter((b) => b.remote);
$: repoSearchTerm = repoSearch.trim().toLowerCase();
$: openRepoRows = repoTabs.filter(repoMatchesSearch);
$: openRepoRows = repoTabs.filter((repo) => repoMatchesSearch(repo, repoSearchTerm));
$: recentRepoRows = recentRepoPaths
.filter((path) => !repoTabs.some((tab) => sameRepoPath(tab.path, path)))
.map(repoRowFromPath)
.filter(repoMatchesSearch);
.map((path) => repoRowFromPath(path, repoTabs, repoStatusCache))
.filter((repo) => repoMatchesSearch(repo, repoSearchTerm));
$: favoriteRepoRows = favoriteRepoPaths
.map(repoRowFromPath)
.filter(repoMatchesSearch);
.map((path) => repoRowFromPath(path, repoTabs, repoStatusCache))
.filter((repo) => repoMatchesSearch(repo, repoSearchTerm));
$: leftSidebarRows = buildLeftSidebarRows(branchPanelCollapsed, stashPanelCollapsed, explorerPanelCollapsed);
$: allLeftPanelsCollapsed = branchPanelCollapsed && stashPanelCollapsed && explorerPanelCollapsed;
@@ -539,6 +539,7 @@
try {
await fetchRemote(activeRepoPath);
applyStatus(await getStatus(activeRepoPath));
await refreshRefsAndCommitGraph(activeRepoPath);
} catch {
// ignore — see comment above
} finally {
@@ -556,8 +557,10 @@
try {
await fetchRemote(path);
const nextStatus = await getStatus(path);
if (sameRepoPath(path, activeRepoPath)) applyStatus(nextStatus);
else updateRepoManagementStatus(path, nextStatus);
if (sameRepoPath(path, activeRepoPath)) {
applyStatus(nextStatus);
await refreshRefsAndCommitGraph(path);
} else updateRepoManagementStatus(path, nextStatus);
} catch {
// ignore; manual Fetch/Pull surfaces auth or network problems
} finally {
@@ -949,11 +952,11 @@
return result;
}
function repoRowFromPath(path: string): RepoTab {
const openTab = repoTabs.find((tab) => sameRepoPath(tab.path, path));
function repoRowFromPath(path: string, tabs = repoTabs, statusCache = repoStatusCache): RepoTab {
const openTab = tabs.find((tab) => sameRepoPath(tab.path, path));
if (openTab) return openTab;
const cached = repoStatusCache[repoKey(path)];
const cached = statusCache[repoKey(path)];
if (cached) return { ...cached, path, name: repoNameFromPath(path) };
return {
@@ -967,11 +970,11 @@
};
}
function repoMatchesSearch(repo: RepoTab): boolean {
if (!repoSearchTerm) return true;
return repo.name.toLowerCase().includes(repoSearchTerm)
|| repo.path.toLowerCase().includes(repoSearchTerm)
|| (repo.branch ?? "").toLowerCase().includes(repoSearchTerm);
function repoMatchesSearch(repo: RepoTab, searchTerm = repoSearchTerm): boolean {
if (!searchTerm) return true;
return repo.name.toLowerCase().includes(searchTerm)
|| repo.path.toLowerCase().includes(searchTerm)
|| (repo.branch ?? "").toLowerCase().includes(searchTerm);
}
function loadRepoLists() {
@@ -1629,6 +1632,16 @@
}
}
async function refreshRefsAndCommitGraph(path = activeRepoPath) {
const previousHeadHash = lastFileHistoryHeadHash;
await refreshBranchList(path);
await refreshTags(path);
await refreshCommitHistory(path);
if (lastFileHistoryHeadHash !== previousHeadHash) {
await refreshFileHistory(path);
}
}
function isCancellationMessage(message: string): boolean {
return message.toLowerCase().includes("cancelled");
}
@@ -2329,6 +2342,7 @@
errorMessage = "";
await runOperation("Fetching", async () => {
applyStatus(await fetchRemote(activeRepoPath, username, password));
await refreshRefsAndCommitGraph(activeRepoPath);
trackEvent("repository_fetched", {
from_stored_credential: fromStore ? 1 : 0,
ahead: status?.ahead ?? 0,