diff options
author | kitsunyan | 2018-05-19 04:47:37 +0000 |
---|---|---|
committer | kitsunyan | 2018-05-19 14:10:15 +0000 |
commit | a6c016ce89028d5195522a52f6dc0587c196fcb8 (patch) | |
tree | 4ced54c37be91455da268f1abae5f87d388b8164 /src/feature/syncsource.nim | |
parent | e301fefe660f3cb1f27f924e04d25db5db9f28a6 (diff) |
Clone package repos without tags to user cache
Diffstat (limited to 'src/feature/syncsource.nim')
-rw-r--r-- | src/feature/syncsource.nim | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/feature/syncsource.nim b/src/feature/syncsource.nim index f7e2524..2bc88ee 100644 --- a/src/feature/syncsource.nim +++ b/src/feature/syncsource.nim @@ -33,14 +33,14 @@ proc getFilesOrClear(base: string, repoPath: string, gitSubdir: Option[string]): (newSeq[string](), some(tr"$#: failed to clone git repository" % [base])) proc cloneRepositories(config: Config, targets: seq[BaseTarget], - update: (int, int) -> void): (List[CloneResult], seq[string], seq[string]) = - let (barePaths, berrors) = cloneBareRepos(config, + update: (int, int) -> void): (List[CloneResult], seq[string]) = + let (bcount, berrors) = cloneBareRepos(config, BareKind.repo, targets.filter(t => t.gitRepo.isSome).map(t => t.gitRepo.unsafeGet), proc (progress: int, count: int) = update(progress, count + targets.len), false) proc cloneNext(index: int, results: List[CloneResult], messages: List[string]): (List[CloneResult], List[string]) = - update(barePaths.len + index, barePaths.len + targets.len) + update(bcount + index, bcount + targets.len) if index >= targets.len: (results.reversed, messages.reversed) @@ -81,10 +81,10 @@ proc cloneRepositories(config: Config, targets: seq[BaseTarget], cloneNext(index + 1, results, message ^& messages) if berrors.len > 0: - (nil, barePaths, berrors) + (nil, berrors) else: let (results, cerrors) = cloneNext(0, nil, nil) - (results, barePaths, toSeq(cerrors.items)) + (results, toSeq(cerrors.items)) proc copyFiles(config: Config, quiet: bool, results: seq[CloneResult]): List[string] = proc copyNext(index: int, messages: List[string]): List[string] = @@ -136,7 +136,7 @@ proc cloneAndCopy(config: Config, quiet: bool, else: printProgressShare(config.progressBar, tr"cloning repositories") - let (results, barePaths, rerrors) = cloneRepositories(config, baseTargets, update) + let (results, rerrors) = cloneRepositories(config, baseTargets, update) terminate() for e in rerrors: printError(config.color, e) @@ -145,8 +145,6 @@ proc cloneAndCopy(config: Config, quiet: bool, for result in results: removeDirQuiet(result.path) - for path in barePaths: - removeDirQuiet(path) discard rmdir(config.tmpRootCurrent) if rerrors != nil and cerrors != nil: |