Skip to content

fix: count whitespace-distinct Git conflict filenames correctly - #709

Merged
sirmalloc merged 4 commits into
sirmalloc:mainfrom
vishnujayvel:oss/occ-00l-ccstatusline-git-conflict-filenames
Oct 29, 2026
Merged

sirmalloc merged 4 commits into
sirmalloc:mainfrom
vishnujayvel:oss/occ-00l-ccstatusline-git-conflict-filenames

Conversation

@vishnujayvel

Copy link
Copy Markdown
Contributor

Summary

Count conflicted files separately when their UTF-8 names differ by whitespace. For example, a b.txt and a b.txt now contribute two conflicts, while multiple index stages for one file still count once.

Type: bug fix · Risk: low — limited to conflict counting and its tests.

Changes

File Change
src/utils/git.ts Read NUL-delimited unmerged entries and preserve whitespace in UTF-8 pathnames after the metadata tab.
src/utils/__tests__/git.test.ts Cover whitespace, stage deduplication, empty output, and Git failures.
src/utils/__tests__/git-conflicts.test.ts Exercise the helper and widget with real Git indexes; isolate persistent caches in temporary homes and verify cleanup.
src/widgets/__tests__/GitConflicts.test.ts Use NUL-delimited fixtures and check repeated-space filenames.

How verified

  • bun test src/utils/__tests__/git-conflicts.test.ts: three cases pass after the isolation correction. They cover repeated spaces, a single-file control, tabs, newlines, leading/trailing spaces, and a directory path. Each checks the helper count, widget output, temporary-home cache location, and fixture cleanup. The real-home cache is unchanged before and after the run.
  • bun test src/utils/__tests__/git.test.ts src/widgets/__tests__/GitConflicts.test.ts: reuse the recorded 77 passing tests; the tested files and production dependencies remain unchanged and their committed blobs match the retained receipts.
  • bun run lint: TypeScript and ESLint pass after the test correction.
  • Retained pre-fix reproduction: two whitespace-distinct filenames produced 1 and ⚠1; the corrected helper and widget produce 2 and ⚠2.

Scope

The filename scope is UTF-8: the existing Git command wrapper decodes output as UTF-8, so distinct non-UTF-8 byte sequences may decode to the same string. This change does not address that limitation. Validation covers the focused checks above on macOS; the full suite, Windows execution, and CI were not run for this correction.

vishnujayvel and others added 4 commits October 8, 2026 03:08
Spy on os.homedir using the existing useTempHome pattern and restore spies after each case. Verify the real helper cache uses the temporary home and that fixture directories are removed.

Agent-Signature: provider=codex model=gpt-6.1-sol agent=ccstatusline/codex session=oc-wisp-s9dpgh task=occ-x9f6
@sirmalloc
sirmalloc merged commit dc04137 into sirmalloc:main Oct 29, 2026
3 checks passed
sirmalloc added a commit that referenced this pull request Oct 29, 2026
* fix(git): preserve exact filenames when counting conflicts

* test(git): isolate real-index conflict cache in temporary homes

Spy on os.homedir using the existing useTempHome pattern and restore spies after each case. Verify the real helper cache uses the temporary home and that fixture directories are removed.

Agent-Signature: provider=codex model=gpt-6.1-sol agent=ccstatusline/codex session=oc-wisp-s9dpgh task=occ-x9f6

* test: adapt conflict checks to Git hardening and isolate real Git probes

---------

Co-authored-by: Matthew Breedlove <[email protected]>
pcvelz added a commit to pcvelz/ccstatusline-usage that referenced this pull request Oct 29, 2026
Upstream: Extra Usage Limit widget (sirmalloc#756), live widget preview while picking (sirmalloc#755), Fast Mode widget (sirmalloc#754), transcript block fallback fixes (sirmalloc#752), editor keys on a global install (sirmalloc#751), git cache TTL (sirmalloc#750), npx cached copy skip (sirmalloc#749), Block Usage hide at 100% (sirmalloc#747), Block Reset Timer hide until 100% (sirmalloc#697), fish-style branch abbreviation (sirmalloc#614), jj detached HEAD (sirmalloc#705), hooks save warning (sirmalloc#703), dev reload (sirmalloc#700), merge ends at a hidden widget (sirmalloc#698), Block Forecast and Block Limit Timer widgets (sirmalloc#699), contributor guide (sirmalloc#706), POSIX path case fix (sirmalloc#707), whitespace-distinct conflict filenames (sirmalloc#709), Quick Start reorder (sirmalloc#715), bunx launch guidance (sirmalloc#714), jj diff summary counts (sirmalloc#711), powerline manual separators (sirmalloc#713), keychain credential by account (sirmalloc#532), Keychain probe timeout (sirmalloc#760), usage cache scoped per CLAUDE_CONFIG_DIR (sirmalloc#266), test isolation (sirmalloc#717, sirmalloc#753), dev-dependency bumps (sirmalloc#745)

Conflicts resolved per the standard-resolution table; fork deletions re-applied.

Hand edits outside conflicts:
- src/utils/global-command-resolution.ts: fork-rename (ccstatusline@ -> ccstatusline-usage@ in upstream's new bunx pattern)
- src/utils/__tests__/global-package-manager.test.ts: fork-rename (package dir ccstatusline-usage in upstream's new tests)
- src/utils/usage-fetch.ts: compat fix - cacheUsageData gained a fetchedAtMs arg (upstream sirmalloc#266); adapted the fork-only fetchFreshUsageData call site
- src/utils/__tests__/usage-fetch.test.ts: compat fixes - cache/lock now hashed per CLAUDE_CONFIG_DIR (usageFilePath helper) in four fork tests; upstream fableUsage renamed to fork's weeklyFableUsage; seedUsageCache takes TokenHome
- src/utils/__tests__/usage-prefetch.test.ts: compat fix - mockFetchUsageData renamed to upstream's mockFetchUsage in cleanly-merged tests
- README.md: took upstream's Quick Start move (sirmalloc#715) and dropped the fork's old copy; fork-rename of its ccstatusline@ specifiers; links to fork-deleted docs (docs/USAGE.md, docs/WINDOWS.md) replaced with the fork's inline text
- CONTRIBUTING.md: links to the fork-deleted docs/DEVELOPMENT.md pointed at the README Development section
- docs/test-retirements.md: ledger entries for the 12 upstream test renames (sirmalloc#697, sirmalloc#698, sirmalloc#700, sirmalloc#705, sirmalloc#713, sirmalloc#760)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants