diff --git a/components/remotes/remotes.js b/components/remotes/remotes.js index 6c2faecbe..1fbdcabff 100644 --- a/components/remotes/remotes.js +++ b/components/remotes/remotes.js @@ -52,11 +52,10 @@ class RemotesViewModel { ungit.logger.debug('remotes.fetch() triggered'); try { - const tagPromise = this.server.getPromise('/remote/tags', { + await this.server.postPromise('/fetch', { path: this.repoPath(), remote: this.currentRemote(), }); - programEvents.dispatch({ event: 'remote-tags-update', tags: await tagPromise }); if (!this.server.isInternetConnected) { this.server.isInternetConnected = true; } diff --git a/source/git-api.js b/source/git-api.js index 141ee135a..2b0b03f90 100644 --- a/source/git-api.js +++ b/source/git-api.js @@ -516,7 +516,7 @@ exports.registerApi = (env) => { jw(async (req, res) => { if (req.query.remoteFetch) { if (res.setTimeout) res.setTimeout(tenMinTimeoutMs); - await req.repo.remoteAllFetch().catch((err) => { + await req.repo.remoteAllFetch(config.autoPruneOnFetch).catch((err) => { console.warn('ignoring fetch error', err); }); } diff --git a/source/nodegit.js b/source/nodegit.js index 8d5a188ea..8eee4fcf6 100644 --- a/source/nodegit.js +++ b/source/nodegit.js @@ -275,12 +275,13 @@ class NGWrap { */ async remoteFetch(remoteName, refs = null, prune) { const remote = await this.r.getRemote(remoteName).catch(normalizeError); - // TODO use credentialshelper await remote.fetch( refs, { callbacks: { - credentials: (url, userName) => nodegit.Cred.sshKeyFromAgent(userName), + // TODO use credentialshelper + // @ts-ignore -- Credential does exist, bad typing + credentials: (url, userName) => nodegit.Credential.sshKeyFromAgent(userName), }, prune: prune ? nodegit.Fetch.PRUNE.GIT_FETCH_PRUNE : undefined, }, @@ -288,11 +289,11 @@ class NGWrap { ); } - async remoteAllFetch() { + async remoteAllFetch(prune) { const remotes = await this.getRemotes(); // making calls serially as credential helpers may get confused to which cred to get. for (const name of remotes) { - await this.remoteFetch(name); + await this.remoteFetch(name, null, prune); } }