fix(config): accept extensions.preciousObjects and relativeWorktrees (GO-009)
- commit
- 6881eb3b67e63d6a09ceaf05776e63a4fbbc97be
- author
- brice · · 2026-10-10 22:15 UTC
- parent
- eb2657a
- signature
- GPG Verified
CD88F9E564E0102646FB6077A1A07C7C7C3E349D· arch-gpg Verified for the committer email
2 files · +7 -2
M config.go +5 -2
| @@ -79,8 +79,11 @@ func checkConfigData(data []byte) error { | |||
| 79 | 79 | if !strings.EqualFold(val, "files") { | |
| 80 | 80 | return unsupported("extensions.refstorage = %s", truncate(val)) | |
| 81 | 81 | } | |
| 82 | - | case "noop", "worktreeconfig": | |
| 83 | - | // No effect on reading a bare repository. | |
| 82 | + | case "noop", "worktreeconfig", "preciousobjects", "relativeworktrees": | |
| 83 | + | // No effect on reading: preciousobjects only forbids | |
| 84 | + | // deleting objects, relativeworktrees changes how linked | |
| 85 | + | // worktrees point at the repository (they are rejected | |
| 86 | + | // anyway). | |
| 84 | 87 | default: | |
| 85 | 88 | return unsupported("extensions.%s", truncate(key)) | |
| 86 | 89 | } | |
| @@ -79,8 +79,11 @@ func checkConfigData(data []byte) error { | |||||
| 79 | if !strings.EqualFold(val, "files") { | 79 | if !strings.EqualFold(val, "files") { | ||
| 80 | return unsupported("extensions.refstorage = %s", truncate(val)) | 80 | return unsupported("extensions.refstorage = %s", truncate(val)) | ||
| 81 | } | 81 | } | ||
| 82 | - | case "noop", "worktreeconfig": | 82 | + | case "noop", "worktreeconfig", "preciousobjects", "relativeworktrees": |
| 83 | - | // No effect on reading a bare repository. | 83 | + | // No effect on reading: preciousobjects only forbids |
| 84 | + | // deleting objects, relativeworktrees changes how linked | |||
| 85 | + | // worktrees point at the repository (they are rejected | |||
| 86 | + | // anyway). | |||
| 84 | default: | 87 | default: | ||
| 85 | return unsupported("extensions.%s", truncate(key)) | 88 | return unsupported("extensions.%s", truncate(key)) | ||
| 86 | } | 89 | } | ||
M open_test.go +2 -0
| @@ -17,6 +17,8 @@ func TestConfigChecks(t *testing.T) { | |||
| 17 | 17 | "[core]\n\trepositoryformatversion = 1\n[extensions]\n\tobjectformat = sha1\n\trefstorage = files\n", | |
| 18 | 18 | "[core]\n\trepositoryformatversion = 1\n[extensions]\n\tObjectFormat = SHA1 # comment\n", | |
| 19 | 19 | "[core]\n\trepositoryformatversion = 1\n[extensions]\n\tnoop = true\n\tworktreeConfig = true\n", | |
| 20 | + | "[core]\n\trepositoryformatversion = 1\n[extensions]\n\tpreciousObjects = true\n\tRelativeWorktrees = true\n", | |
| 21 | + | "[core]\n\trepositoryformatversion = 1\n[EXTENSIONS]\n\tPRECIOUSOBJECTS = true\n\trelativeworktrees = true\n", | |
| 20 | 22 | "[remote \"origin\"]\n\turl = x\n[extensions-lookalike]\n\tfoo = bar\n", | |
| 21 | 23 | "# comment\n; comment\n[core]\nrepositoryformatversion=0\n", | |
| 22 | 24 | "[branch \"extensions\"]\n\tobjectformat = sha256\n", | |
| @@ -17,6 +17,8 @@ func TestConfigChecks(t *testing.T) { | |||||
| 17 | "[core]\n\trepositoryformatversion = 1\n[extensions]\n\tobjectformat = sha1\n\trefstorage = files\n", | 17 | "[core]\n\trepositoryformatversion = 1\n[extensions]\n\tobjectformat = sha1\n\trefstorage = files\n", | ||
| 18 | "[core]\n\trepositoryformatversion = 1\n[extensions]\n\tObjectFormat = SHA1 # comment\n", | 18 | "[core]\n\trepositoryformatversion = 1\n[extensions]\n\tObjectFormat = SHA1 # comment\n", | ||
| 19 | "[core]\n\trepositoryformatversion = 1\n[extensions]\n\tnoop = true\n\tworktreeConfig = true\n", | 19 | "[core]\n\trepositoryformatversion = 1\n[extensions]\n\tnoop = true\n\tworktreeConfig = true\n", | ||
| 20 | + | "[core]\n\trepositoryformatversion = 1\n[extensions]\n\tpreciousObjects = true\n\tRelativeWorktrees = true\n", | |||
| 21 | + | "[core]\n\trepositoryformatversion = 1\n[EXTENSIONS]\n\tPRECIOUSOBJECTS = true\n\trelativeworktrees = true\n", | |||
| 20 | "[remote \"origin\"]\n\turl = x\n[extensions-lookalike]\n\tfoo = bar\n", | 22 | "[remote \"origin\"]\n\turl = x\n[extensions-lookalike]\n\tfoo = bar\n", | ||
| 21 | "# comment\n; comment\n[core]\nrepositoryformatversion=0\n", | 23 | "# comment\n; comment\n[core]\nrepositoryformatversion=0\n", | ||
| 22 | "[branch \"extensions\"]\n\tobjectformat = sha256\n", | 24 | "[branch \"extensions\"]\n\tobjectformat = sha256\n", | ||