diff --git a/src/renderer/App.tsx b/src/renderer/App.tsx index 9f91f2b..3142041 100644 --- a/src/renderer/App.tsx +++ b/src/renderer/App.tsx @@ -589,6 +589,7 @@ const App: React.FC = () => { const [addCommandValue, setAddCommandValue] = useState(''); const [showEditedFiles, setShowEditedFiles] = useState(false); const [cwdCopied, setCwdCopied] = useState(false); + const [isWorktreeSession, setIsWorktreeSession] = useState(false); const [filePreviewPath, setFilePreviewPath] = useState(null); const [isGitRepo, setIsGitRepo] = useState(true); const [showCommitModal, setShowCommitModal] = useState(false); @@ -4861,9 +4862,13 @@ Only when ALL the above are verified complete, output exactly: ${RALPH_COMPLETIO {/* Git Branch */}
- Git Branch + Git Branch{isWorktreeSession && ' (worktree)'}
- +
{/* Edited Files Count */} @@ -6913,12 +6918,13 @@ Only when ALL the above are verified complete, output exactly: ${RALPH_COMPLETIO
- Git Branch + Git Branch{isWorktreeSession && ' (worktree)'}
diff --git a/src/renderer/components/GitBranchWidget.tsx b/src/renderer/components/GitBranchWidget.tsx index dff359a..a20c989 100644 --- a/src/renderer/components/GitBranchWidget.tsx +++ b/src/renderer/components/GitBranchWidget.tsx @@ -1,15 +1,22 @@ import React, { useState, useEffect } from 'react'; +import { CopyIcon, CheckIcon } from './Icons'; interface GitBranchWidgetProps { cwd?: string; refreshKey?: number; + onWorktreeChange?: (isWorktree: boolean) => void; } -export const GitBranchWidget: React.FC = ({ cwd, refreshKey }) => { +export const GitBranchWidget: React.FC = ({ + cwd, + refreshKey, + onWorktreeChange, +}) => { const [branch, setBranch] = useState(null); const [isLoading, setIsLoading] = useState(false); const [error, setError] = useState(null); const [isWorktree, setIsWorktree] = useState(false); + const [copied, setCopied] = useState(false); useEffect(() => { if (!cwd) { @@ -42,6 +49,7 @@ export const GitBranchWidget: React.FC = ({ cwd, refreshKe // Also check if cwd itself is a worktree path const isWorktreePath = cwd.includes('.copilot-sessions'); setIsWorktree(!!worktreeSession || isWorktreePath); + onWorktreeChange?.(!!worktreeSession || isWorktreePath); } catch (err) { console.error('Failed to get git branch:', err); setError('Failed to get branch'); @@ -83,6 +91,18 @@ export const GitBranchWidget: React.FC = ({ cwd, refreshKe ); } + const handleCopy = () => { + if (branch) { + navigator.clipboard + .writeText(branch) + .then(() => { + setCopied(true); + setTimeout(() => setCopied(false), 2000); + }) + .catch(() => {}); + } + }; + return (
= ({ cwd, refreshKe {branch} - {isWorktree && ( - - worktree - - )} +
); };