Welcome to mirror list, hosted at ThFree Co, Russian Federation.

packfile.go « packfile « git « internal - gitlab.com/gitlab-org/gitaly.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 63716a18c965e42edddb23c1c4d2377f14197bfa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package packfile

import (
	"io/ioutil"
	"path/filepath"
)

// List returns the packfiles in objDir.
func List(objDir string) ([]string, error) {
	packDir := filepath.Join(objDir, "pack")
	entries, err := ioutil.ReadDir(packDir)
	if err != nil {
		return nil, err
	}

	var packs []string
	for _, ent := range entries {
		if ent.IsDir() {
			continue
		}

		if p := filepath.Join(packDir, ent.Name()); packFileRegex.MatchString(p) {
			packs = append(packs, p)
		}
	}

	return packs, nil
}