diff options
| author | 2026-03-06 01:48:44 +0800 | |
|---|---|---|
| committer | 2026-03-06 01:48:44 +0800 | |
| commit | 120509f0aad0e945d8e0fc90a822fa904fb70b68 (patch) | |
| tree | 20a541f059591b35795a1a5d3b7dcf48ec711b6a /repository/config.go | |
| parent | refstore/loose: Fix package-level comment (diff) | |
| signature | No signature | |
repository: Refactor v0.1.55
Diffstat (limited to 'repository/config.go')
| -rw-r--r-- | repository/config.go | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/repository/config.go b/repository/config.go new file mode 100644 index 00000000..de33e2c3 --- /dev/null +++ b/repository/config.go @@ -0,0 +1,32 @@ +package repository + +import ( + "fmt" + "os" + + "codeberg.org/lindenii/furgit/config" +) + +func parseRepositoryConfig(root *os.Root) (*config.Config, error) { + configFile, err := root.Open("config") + if err != nil { + return nil, fmt.Errorf("repository: open config: %w", err) + } + + defer func() { _ = configFile.Close() }() + + cfg, err := config.ParseConfig(configFile) + if err != nil { + return nil, fmt.Errorf("repository: parse config: %w", err) + } + + return cfg, nil +} + +// Config returns the parsed repository configuration snapshot. +// +// The returned pointer is owned by Repository. Callers should treat it as +// read-only. +func (repo *Repository) Config() *config.Config { + return repo.config +} |
