Skip to content

Commit bdb9fcb

Browse files
committed
*: add siva files to the repository pool with an ID
Signed-off-by: Manuel Carmona <[email protected]>
1 parent 4d99164 commit bdb9fcb

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

cmd/gitbase/command/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ func (c *Server) addMatch(match string) error {
271271

272272
if !c.DisableSiva &&
273273
info.Mode().IsRegular() && gitbase.IsSivaFile(info.Name()) {
274-
if err := c.pool.AddSivaFile(path); err != nil {
274+
if err := c.pool.AddSivaFileWithID(info.Name(), path); err != nil {
275275
logrus.WithFields(logrus.Fields{
276276
"path": path,
277277
"error": err,

repository_pool.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -171,24 +171,26 @@ func (p *RepositoryPool) Add(repo repository) error {
171171
return nil
172172
}
173173

174-
// AddGit checks if a git repository can be opened and adds it to the pool. It
175-
// also sets its path as ID.
174+
// AddGit adds a git repository to the pool. It also sets its path as ID.
176175
func (p *RepositoryPool) AddGit(path string) error {
177176
return p.AddGitWithID(path, path)
178177
}
179178

180-
// AddGitWithID checks if a git repository can be opened and adds it to the
181-
// pool. ID should be specified.
179+
// AddGitWithID adds a git repository to the pool. ID should be specified.
182180
func (p *RepositoryPool) AddGitWithID(id, path string) error {
183181
return p.Add(gitRepo(id, path))
184182
}
185183

186-
// AddSivaFile adds to the pool the given file if it's a siva repository,
187-
// that is, has the .siva extension
184+
// AddSivaFile adds a siva file to the pool. It also sets its path as ID.
188185
func (p *RepositoryPool) AddSivaFile(path string) error {
189186
return p.Add(sivaRepo(path, path))
190187
}
191188

189+
// AddSivaFileWithID adds a siva file to the pool. ID should be specified.
190+
func (p *RepositoryPool) AddSivaFileWithID(id, path string) error {
191+
return p.Add(sivaRepo(id, path))
192+
}
193+
192194
// GetPos retrieves a repository at a given position. If the position is
193195
// out of bounds it returns io.EOF.
194196
func (p *RepositoryPool) GetPos(pos int) (*Repository, error) {

0 commit comments

Comments
 (0)