Skip to content

Commit 7f2bac3

Browse files
committed
remotes: actually fetch when clicking fetch
1 parent 1292a39 commit 7f2bac3

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

components/remotes/remotes.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,10 @@ class RemotesViewModel {
5252
ungit.logger.debug('remotes.fetch() triggered');
5353

5454
try {
55-
const tagPromise = this.server.getPromise('/remote/tags', {
55+
await this.server.postPromise('/fetch', {
5656
path: this.repoPath(),
5757
remote: this.currentRemote(),
5858
});
59-
programEvents.dispatch({ event: 'remote-tags-update', tags: await tagPromise });
6059
if (!this.server.isInternetConnected) {
6160
this.server.isInternetConnected = true;
6261
}

source/git-api.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ exports.registerApi = (env) => {
516516
jw(async (req, res) => {
517517
if (req.query.remoteFetch) {
518518
if (res.setTimeout) res.setTimeout(tenMinTimeoutMs);
519-
await req.repo.remoteAllFetch().catch((err) => {
519+
await req.repo.remoteAllFetch(config.autoPruneOnFetch).catch((err) => {
520520
console.warn('ignoring fetch error', err);
521521
});
522522
}

source/nodegit.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -275,24 +275,25 @@ class NGWrap {
275275
*/
276276
async remoteFetch(remoteName, refs = null, prune) {
277277
const remote = await this.r.getRemote(remoteName).catch(normalizeError);
278-
// TODO use credentialshelper
279278
await remote.fetch(
280279
refs,
281280
{
282281
callbacks: {
283-
credentials: (url, userName) => nodegit.Cred.sshKeyFromAgent(userName),
282+
// TODO use credentialshelper
283+
// @ts-ignore -- Credential does exist, bad typing
284+
credentials: (url, userName) => nodegit.Credential.sshKeyFromAgent(userName),
284285
},
285286
prune: prune ? nodegit.Fetch.PRUNE.GIT_FETCH_PRUNE : undefined,
286287
},
287288
undefined
288289
);
289290
}
290291

291-
async remoteAllFetch() {
292+
async remoteAllFetch(prune) {
292293
const remotes = await this.getRemotes();
293294
// making calls serially as credential helpers may get confused to which cred to get.
294295
for (const name of remotes) {
295-
await this.remoteFetch(name);
296+
await this.remoteFetch(name, null, prune);
296297
}
297298
}
298299

0 commit comments

Comments
 (0)