{#if gitStatus?.is_repo}
{#if expanded}
{/if}
{ expanded = !expanded; if (expanded) { refresh(); if (view === 'history') loadHistory(); } }} > {#if gitStatus.ahead > 0}↑{gitStatus.ahead}{/if} {#if gitStatus.behind > 0}↓{gitStatus.behind}{/if} {#if totalChanges > 0}{$t('git.changedCount', { count: totalChanges })}+{totalAdditions}-{totalDeletions}{/if} {#if actionMsg}{actionMsg}{/if}
{#if showBranches && branchBtnEl} { showBranches = false; creatingBranch = false; newBranchName = ''; }} preferAbove forceAbove maxHeight="15rem" className="w-56" align="start" headerDivider={false} footerDivider={false} > {#snippet header()}
{ if (e.key === 'Escape') showBranches = false; }} />
{#if !branchData}
{/if}
{/snippet} {#snippet children()} {#if branchData} {#if filteredBranches.length > 0}
{$t('git.branches')}
{#each filteredBranches as branch (branch.name)}
{/each} {/if} {#if filteredBranches.length === 0}
{$t('git.noBranchesFound')}
{/if} {:else if branchData}
{$t('git.noBranchesFound')}
{/if} {/snippet} {#snippet footer()} {#if creatingBranch}
{ if (e.key === 'Enter') createBranch(); if (e.key === 'Escape') { creatingBranch = false; newBranchName = ''; } }} />
{:else} {/if} {/snippet}
{/if} {#if showWorktrees && worktreeBtnEl} { showWorktrees = false; creatingWorktree = false; newWorktreeBranch = ''; }} preferAbove forceAbove maxHeight="15rem" className="w-60" align="start" headerDivider={false} footerDivider={false} > {#snippet header()}
{ if (e.key === 'Escape') showWorktrees = false; }} />
{#if !worktreeData}
{/if}
{/snippet} {#snippet children()} {#if worktreeData} {#if filteredWorktrees.length > 0}
{$t('git.worktrees')}
{#each filteredWorktrees as worktree (worktree.path)} {/each} {:else}
{$t('git.noWorktreesFound')}
{/if} {/if} {/snippet} {#snippet footer()} {#if creatingWorktree}
{ if (e.key === 'Enter') createWorktree(); if (e.key === 'Escape') { creatingWorktree = false; newWorktreeBranch = ''; } }} />
{:else} {/if} {/snippet}
{/if} {#if expanded}
{#if showDiff} {/if}
{#if remoteWebUrl} {/if}
{#if showDiffSettings && diffSettingsBtnEl} (showDiffSettings = false)} preferAbove /> {/if}
{#if view === 'changes'} {#if totalChanges > 0} {/if}
{#each gitStatus?.files ?? [] as file (file.path)} {@const fp = fPath(file.path)} {/each}
{ if (e.key === 'Enter' && !e.shiftKey) doCommit(); }} />
{:else}
{#each commits as c, i} {#if i === unpushedCount && unpushedCount > 0}
{$t('git.unpushedCommit', { count: unpushedCount })}
{/if} {/each} {#if !commits.length}
{$t('git.noCommits')}
{/if}
{/if}
{#if fileDiff.length}
{#each fileDiff as df} {#if fileDiff.length > 1}
{df.path}
{/if} {#each df.hunks as hunk}
{hunk.header}
{/each} {/each}
{:else}
{#if view === 'history' && !selectedCommit} {$t('git.selectCommit')} {:else if totalChanges} {$t('git.selectFile')} {:else} {$t('git.noLocalChanges')} {/if}
{/if}
{/if}
{/if} {#if pendingCheckoutBranch} (pendingCheckoutBranch = null)} class="w-full max-w-sm mx-4">

{$t('git.switchBranches')}

{$t('git.moveChangesPromptPrefix', { count: totalChanges })} {gitStatus?.branch}. {$t('git.moveChangesPromptMiddle')} {pendingCheckoutBranch}.

{/if} {#if pendingCreateBranch} (pendingCreateBranch = null)} class="w-full max-w-sm mx-4">

{$t('git.createBranchPrompt')}

{$t('git.moveChangesPromptPrefix', { count: totalChanges })} {gitStatus?.branch}. {$t('git.moveChangesPromptMiddle')} {pendingCreateBranch}.

{/if} {#if branchActionMenu} renameBranch(branchActionMenu!.branch) } ] : []), { label: $t('git.copyBranchName'), icon: 'copy', onclick: () => copyBranchName(branchActionMenu!.branch) }, ...(branchActionMenu.branch.is_local && !branchActionMenu.branch.is_current ? [ { label: $t('files.delete'), icon: 'xmark', onclick: () => deleteBranch(branchActionMenu!.branch) } ] : []) ]} onclose={closeBranchActionMenu} /> {/if} {#if contextMenu} discardFile(contextMenu!.file.path) }, { label: $t('git.copyFilePath'), icon: 'copy', onclick: () => copyFilePath(contextMenu!.file.path) }, { label: $t('git.copyRelativePath'), icon: 'copy', onclick: () => copyRelativePath(contextMenu!.file.path) } ]} onclose={closeContextMenu} /> {/if} {#if commitMenu} { doUncommit(); closeCommitMenu(); } } ] : []), { label: $t('git.copyCommitHash'), icon: 'copy', onclick: () => { navigator.clipboard.writeText(commitMenu!.commit.hash); flash($t('git.copiedPath')); closeCommitMenu(); } } ]} onclose={closeCommitMenu} /> {/if}