MCPcopy
hub / github.com/claude-code-best/claude-code / onHeadChanged

Method onHeadChanged

src/utils/git/gitFilesystem.ts:429–438  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

427 }
428
429 private async onHeadChanged(): Promise<void> {
430 // HEAD changed — could be a branch switch or detach.
431 // Defer file I/O (readGitHead, watchFile setup) until scroll settles so
432 // watchFile callbacks that land mid-scroll don't compete for the event
433 // loop. invalidate() is cheap (just marks dirty) so do it first — the
434 // cache correctly serves stale-marked values until the watcher updates.
435 this.invalidate()
436 await waitForScrollIdle()
437 await this.watchCurrentBranchRef()
438 }
439
440 private invalidate(): void {
441 for (const entry of this.cache.values()) {

Callers 1

startMethod · 0.95

Calls 3

invalidateMethod · 0.95
watchCurrentBranchRefMethod · 0.95
waitForScrollIdleFunction · 0.85

Tested by

no test coverage detected