Standardize git status terminology to use 'New' for untracked files

- Web UI: Changed 'Added' to 'New' for untracked files
- Mac UI: Changed 'Untracked' to 'New' and removed staged file display
- Both UIs now consistently show: New (green +), Modified (yellow ~), Deleted (red -)
- Focused on working directory changes, removed staging area counts
- Backend: Changed untracked to added in git-status.ts for consistency
This commit is contained in:
Peter Steinberger 2025-07-28 15:16:37 +02:00
parent 75dd51883b
commit 0812bfd89d
5 changed files with 29 additions and 42 deletions

View file

@ -46,12 +46,12 @@ public struct GitRepository: Sendable, Equatable, Hashable {
/// Whether the repository has uncommitted changes
public var hasChanges: Bool {
modifiedCount > 0 || addedCount > 0 || deletedCount > 0 || untrackedCount > 0
modifiedCount > 0 || deletedCount > 0 || untrackedCount > 0
}
/// Total number of files with changes
public var totalChangedFiles: Int {
modifiedCount + addedCount + deletedCount + untrackedCount
modifiedCount + deletedCount + untrackedCount
}
/// Folder name for display
@ -66,18 +66,15 @@ public struct GitRepository: Sendable, Equatable, Hashable {
}
var parts: [String] = []
if untrackedCount > 0 {
parts.append("\(untrackedCount)N")
}
if modifiedCount > 0 {
parts.append("\(modifiedCount)M")
}
if addedCount > 0 {
parts.append("\(addedCount)A")
}
if deletedCount > 0 {
parts.append("\(deletedCount)D")
}
if untrackedCount > 0 {
parts.append("\(untrackedCount)U")
}
return parts.joined(separator: " ")
}

View file

@ -36,12 +36,12 @@ struct GitRepositoryRow: View {
.foregroundColor(AppColors.Fallback.gitModified(for: colorScheme))
}
}
if repository.addedCount > 0 {
if repository.untrackedCount > 0 {
HStack(spacing: 1) {
Image(systemName: "plus")
.font(.system(size: 8, weight: .medium))
.foregroundColor(AppColors.Fallback.gitAdded(for: colorScheme))
Text("\(repository.addedCount)")
Text("\(repository.untrackedCount)")
.font(.system(size: 9, weight: .medium))
.foregroundColor(AppColors.Fallback.gitAdded(for: colorScheme))
}
@ -56,16 +56,6 @@ struct GitRepositoryRow: View {
.foregroundColor(AppColors.Fallback.gitDeleted(for: colorScheme))
}
}
if repository.untrackedCount > 0 {
HStack(spacing: 1) {
Image(systemName: "questionmark")
.font(.system(size: 8))
.foregroundColor(AppColors.Fallback.gitUntracked(for: colorScheme))
Text("\(repository.untrackedCount)")
.font(.system(size: 9, weight: .medium))
.foregroundColor(AppColors.Fallback.gitUntracked(for: colorScheme))
}
}
}
}
}

View file

@ -2,7 +2,7 @@
* Git Status Badge Component
*
* Displays git repository status information in a compact badge format.
* Shows counts for modified, untracked, staged files, and ahead/behind commits.
* Shows counts for added, modified, deleted files, and ahead/behind commits.
*/
import { html, LitElement } from 'lit';
import { customElement, property } from 'lit/decorators.js';
@ -46,8 +46,8 @@ export class GitStatusBadge extends LitElement {
const _hasLocalChanges =
(this.session?.gitModifiedCount ?? 0) > 0 ||
(this.session?.gitUntrackedCount ?? 0) > 0 ||
(this.session?.gitStagedCount ?? 0) > 0;
(this.session?.gitAddedCount ?? 0) > 0 ||
(this.session?.gitDeletedCount ?? 0) > 0;
const _hasRemoteChanges =
(this.session?.gitAheadCount ?? 0) > 0 || (this.session?.gitBehindCount ?? 0) > 0;
@ -79,10 +79,10 @@ export class GitStatusBadge extends LitElement {
private renderLocalChanges() {
if (!this.session) return null;
const addedCount = this.session?.gitAddedCount ?? 0;
const modifiedCount = this.session?.gitModifiedCount ?? 0;
const untrackedCount = this.session?.gitUntrackedCount ?? 0;
const stagedCount = this.session?.gitStagedCount ?? 0;
const totalChanges = modifiedCount + untrackedCount + stagedCount;
const deletedCount = this.session?.gitDeletedCount ?? 0;
const totalChanges = addedCount + modifiedCount + deletedCount;
if (totalChanges === 0 && !this.detailed) return null;
@ -91,10 +91,10 @@ export class GitStatusBadge extends LitElement {
return html`
<span class="flex items-center gap-1">
${
stagedCount > 0
addedCount > 0
? html`
<span class="text-green-600 dark:text-green-400" title="Staged files">
+${stagedCount}
<span class="text-green-600 dark:text-green-400" title="New files">
+${addedCount}
</span>
`
: null
@ -109,10 +109,10 @@ export class GitStatusBadge extends LitElement {
: null
}
${
untrackedCount > 0
deletedCount > 0
? html`
<span class="text-blue-600 dark:text-blue-400" title="Untracked files">
?${untrackedCount}
<span class="text-red-600 dark:text-red-400" title="Deleted files">
-${deletedCount}
</span>
`
: null
@ -122,7 +122,7 @@ export class GitStatusBadge extends LitElement {
} else {
// Compact view shows total with an indicator
return html`
<span class="text-yellow-600 dark:text-yellow-400" title="${modifiedCount} modified, ${untrackedCount} untracked, ${stagedCount} staged">
<span class="text-yellow-600 dark:text-yellow-400" title="${addedCount} new, ${modifiedCount} modified, ${deletedCount} deleted">
${totalChanges}
</span>
`;

View file

@ -243,8 +243,9 @@ export class GitWatcher {
return (
oldStatus.modified !== newStatus.modified ||
oldStatus.untracked !== newStatus.untracked ||
oldStatus.added !== newStatus.added ||
oldStatus.staged !== newStatus.staged ||
oldStatus.deleted !== newStatus.deleted ||
oldStatus.ahead !== newStatus.ahead ||
oldStatus.behind !== newStatus.behind
);
@ -268,8 +269,7 @@ export class GitWatcher {
type: 'git-status-update',
sessionId,
gitModifiedCount: status.modified,
gitUntrackedCount: status.untracked,
gitStagedCount: status.staged,
gitAddedCount: status.added,
gitDeletedCount: status.deleted,
gitAheadCount: status.ahead,
gitBehindCount: status.behind,

View file

@ -12,7 +12,7 @@ const execFileAsync = promisify(execFile);
export interface GitStatusCounts {
modified: number;
untracked: number;
added: number;
staged: number;
deleted: number;
ahead: number;
@ -42,7 +42,7 @@ export async function getDetailedGitStatus(workingDir: string): Promise<GitStatu
let aheadCount = 0;
let behindCount = 0;
let modifiedCount = 0;
let untrackedCount = 0;
let addedCount = 0;
let stagedCount = 0;
let deletedCount = 0;
@ -80,15 +80,15 @@ export async function getDetailedGitStatus(workingDir: string): Promise<GitStatu
deletedCount++;
}
// Untracked files
// Added files (untracked)
if (indexStatus === '?' && workingStatus === '?') {
untrackedCount++;
addedCount++;
}
}
return {
modified: modifiedCount,
untracked: untrackedCount,
added: addedCount,
staged: stagedCount,
deleted: deletedCount,
ahead: aheadCount,
@ -98,7 +98,7 @@ export async function getDetailedGitStatus(workingDir: string): Promise<GitStatu
// Not a git repository or git command failed
return {
modified: 0,
untracked: 0,
added: 0,
staged: 0,
deleted: 0,
ahead: 0,