The identity writer appends as 06 promised — clearing is the one sanctioned edit
Claude-Session: https://claude.ai/code/session_014PtZdPwqZuqEDLc6wZMtEy
This commit is contained in:
@@ -983,8 +983,8 @@ struct GitIdentityWriteTests {
|
||||
#expect(read.email == "[email protected]")
|
||||
}
|
||||
|
||||
@Test("An existing value is replaced in place and everything else survives verbatim")
|
||||
func replacesInPlace() {
|
||||
@Test("A new value appends a fresh section that wins on read — existing lines survive verbatim")
|
||||
func appendsAndWins() {
|
||||
let original = """
|
||||
[core]
|
||||
\trepositoryformatversion = 0
|
||||
@@ -1001,11 +1001,15 @@ struct GitIdentityWriteTests {
|
||||
|
||||
#expect(written.contains("\tname = New Name"))
|
||||
#expect(written.contains("\temail = [email protected]"))
|
||||
#expect(!written.contains("Old Name"))
|
||||
#expect(written.contains("\tname = Old Name"), "sets never edit existing sections — 06's append-only rule")
|
||||
#expect(written.contains("\tsigningkey = ABC123"), "a key this app has no opinion about survives")
|
||||
#expect(written.contains("[remote \"origin\"]"))
|
||||
#expect(written.contains("\turl = [email protected]:board.git"))
|
||||
#expect(written.contains("\tbare = false"))
|
||||
|
||||
let read = GitConfigFile.identity(inConfigText: written)
|
||||
#expect(read.name == "New Name", "the appended section is last, and reads take the last")
|
||||
#expect(read.email == "[email protected]")
|
||||
}
|
||||
|
||||
@Test("An empty field clears its key, and clearing both removes the section entirely")
|
||||
|
||||
Reference in New Issue
Block a user