Properly fetch packs

This commit is contained in:
Tillie Kottmann 2020-10-31 12:37:39 +01:00
parent 3794296b97
commit 1818bae23b
1 changed files with 3 additions and 3 deletions

View File

@ -158,15 +158,15 @@ func FetchGit(baseUrl, baseDir string) error {
if err != nil { if err != nil {
return err return err
} }
hashes := packRegex.FindAll(infoPacks, -1) hashes := packRegex.FindAllSubmatch(infoPacks, -1)
jobs := make(chan string) jobs := make(chan string)
wg := sync.WaitGroup{} wg := sync.WaitGroup{}
for w := 1; w <= utils.MinInt(maxConcurrency, len(hashes)); w++ { for w := 1; w <= utils.MinInt(maxConcurrency, len(hashes)); w++ {
go workers.DownloadWorker(c, jobs, baseUrl, baseDir, &wg) go workers.DownloadWorker(c, jobs, baseUrl, baseDir, &wg)
} }
for _, sha1 := range hashes { for _, sha1 := range hashes {
jobs <- fmt.Sprintf("./git/objects/pack/pack-%s.idx", sha1) jobs <- fmt.Sprintf(".git/objects/pack/pack-%s.idx", sha1[1])
jobs <- fmt.Sprintf("./git/objects/pack/pack-%s.pack", sha1) jobs <- fmt.Sprintf(".git/objects/pack/pack-%s.pack", sha1[1])
} }
close(jobs) close(jobs)
wg.Wait() wg.Wait()