mirror of
https://github.com/AutoMaker-Org/automaker.git
synced 2026-02-02 08:33:36 +00:00
feat: enhance git diff functionality for untracked files
- Implemented synthetic diff generation for untracked files in both git and non-git directories. - Added fallback UI in the GitDiffPanel for files without diff content, ensuring better user experience. - Improved error handling and logging for git operations, enhancing reliability in file diff retrieval. This update allows users to see diffs for new files that are not yet tracked by git, improving the overall functionality of the diff panel.
This commit is contained in:
@@ -620,6 +620,41 @@ export function GitDiffPanel({
|
||||
onToggle={() => toggleFile(fileDiff.filePath)}
|
||||
/>
|
||||
))}
|
||||
{/* Fallback for files that have no diff content (shouldn't happen after fix, but safety net) */}
|
||||
{files.length > 0 && parsedDiffs.length === 0 && (
|
||||
<div className="space-y-2">
|
||||
{files.map((file) => (
|
||||
<div
|
||||
key={file.path}
|
||||
className="border border-border rounded-lg overflow-hidden"
|
||||
>
|
||||
<div className="w-full px-3 py-2 flex items-center gap-2 text-left bg-card">
|
||||
{getFileIcon(file.status)}
|
||||
<span className="flex-1 text-sm font-mono truncate text-foreground">
|
||||
{file.path}
|
||||
</span>
|
||||
<span
|
||||
className={cn(
|
||||
"text-xs px-1.5 py-0.5 rounded border font-medium",
|
||||
getStatusBadgeColor(file.status)
|
||||
)}
|
||||
>
|
||||
{getStatusDisplayName(file.status)}
|
||||
</span>
|
||||
</div>
|
||||
<div className="px-4 py-3 text-sm text-muted-foreground bg-background border-t border-border">
|
||||
{file.status === "?" ? (
|
||||
<span>New file - content preview not available</span>
|
||||
) : file.status === "D" ? (
|
||||
<span>File deleted</span>
|
||||
) : (
|
||||
<span>Diff content not available</span>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
)}
|
||||
|
||||
Reference in New Issue
Block a user