mirror of
https://github.com/aljazceru/gitpear.git
synced 2025-12-17 06:04:25 +01:00
state: small reduce of call to io for state
Signed-off-by: dzdidi <deniszalessky@gmail.com>
This commit is contained in:
@@ -15,14 +15,15 @@ module.exports = async function setState (store, drives = {}) {
|
|||||||
await drives[repo].ready()
|
await drives[repo].ready()
|
||||||
}
|
}
|
||||||
|
|
||||||
const ls = await git.lsPromise(home.getCodePath(repo))
|
const homePath = home.getCodePath(repo)
|
||||||
|
const ls = await git.lsPromise(homePath)
|
||||||
|
|
||||||
repositories[repo] = {}
|
repositories[repo] = {}
|
||||||
for (const ref in ls) {
|
for (const ref in ls) {
|
||||||
repositories[repo][ref] = ls[ref]
|
repositories[repo][ref] = ls[ref]
|
||||||
announcedRefs[ls[ref]] = repo
|
announcedRefs[ls[ref]] = repo
|
||||||
|
|
||||||
const localPackStream = git.uploadPack(home.getCodePath(repo), ls[ref])
|
const localPackStream = git.uploadPack(homePath, ls[ref])
|
||||||
const driveStream = drives[repo].createWriteStream(`/packs/${ls[ref]}.pack`)
|
const driveStream = drives[repo].createWriteStream(`/packs/${ls[ref]}.pack`)
|
||||||
localPackStream.on('ready', () => localPackStream.stdout.pipe(driveStream))
|
localPackStream.on('ready', () => localPackStream.stdout.pipe(driveStream))
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user