Repository navigation
BUG: Auto memory import finds a submodule's and a bare repository's notes, and reads a note's type and BOM right - #107
Merged
Merged
Conversation
…yte order mark does not hide its frontmatter
… worktree whose git dir is not named .git
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes runningbugs #331 and #332, stacked on #106.
<super>/.git/modules/<name>) and a bare repository's worktree (/x/repo.git), that names a folder Claude Code never writes, so the import said there was nothing to import.gitstate.AutoMemoryRootnow follows Claude Code 2.1.316's own rule, read from the binary. A checkout that is not a linked worktree is its own top level. A linked worktree goes under the parent of a common dir named.git, and under the common dir itself otherwise, unless that dir has a.gitof its own. It makes onegit rev-parsecall and compares folders withos.SameFile, not by spelling. TheCLAUDE_CONFIG_DIRhalf of #331 was already fixed by Import reads every place Claude Code, Codex and auto memory keep their files #101.metadata.typeandtypedisagreed got its kind from one field and its scope from the other. Both now come from the same field. A note saved with a UTF-8 byte order mark had its whole frontmatter imported as the memory text; the BOM is now stripped first.Review findings left alone, on purpose:
--separate-git-dirworktree land in the git dir, and a bare repo named.gitlands in its parent. That is where Claude Code files them, and a new test pins it.Identity's root used by resume, the settings lookup from a subdirectory, and UTF-16 notes are outside this fix.Tests:
TestAutoMemoryIsFoundFromASubmodule,TestAutoMemoryIsFoundFromAWorktreeOfABareRepository,TestAutoMemoryIsFoundFromAWorktreeOfASubmoduleWhereClaudeCodeFilesIt,TestANoteWhoseTwoTypeFieldsDisagreeIsScopedByTheTypeItsKindCameFrom,TestANoteSavedWithAByteOrderMarkKeepsItsFrontmatterOutOfTheMemory. The two bugfix commits' tests fail on the code before them (check-bug-tests).go test ./..., vet, gofmt and the chaos tier all pass.