From e987208d76e87e1c9d526f8a20ad9247df5c6007 Mon Sep 17 00:00:00 2001 From: dzdidi Date: Wed, 7 Feb 2024 16:46:40 +0000 Subject: [PATCH] state: small reduce of call to io for state Signed-off-by: dzdidi --- src/state.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/state.js b/src/state.js index fc56bf3..f759f17 100644 --- a/src/state.js +++ b/src/state.js @@ -15,14 +15,15 @@ module.exports = async function setState (store, drives = {}) { 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] = {} for (const ref in ls) { repositories[repo][ref] = ls[ref] 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`) localPackStream.on('ready', () => localPackStream.stdout.pipe(driveStream)) }