mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-01 22:12:26 +01:00
💄
This commit is contained in:
@@ -14,7 +14,7 @@ import * as filetype from 'file-type';
|
||||
import { assign, groupBy, denodeify, IDisposable, toDisposable, dispose, mkdirp, readBytes, detectUnicodeEncoding, Encoding, onceEvent } from './util';
|
||||
import { CancellationToken, Uri, workspace } from 'vscode';
|
||||
import { detectEncoding } from './encoding';
|
||||
import { Ref, RefType, Branch, Remote, GitErrorCodes, LogOptions, Change, Status, TrackingShip } from './api/git';
|
||||
import { Ref, RefType, Branch, Remote, GitErrorCodes, LogOptions, Change, Status } from './api/git';
|
||||
|
||||
const readfile = denodeify<string, string | null, string>(fs.readFile);
|
||||
|
||||
@@ -1578,19 +1578,12 @@ export class Repository {
|
||||
}
|
||||
}
|
||||
|
||||
async GetTracking(upstreamBranch: string): Promise<TrackingShip[]> {
|
||||
const result = await this.run(['for-each-ref', '--format', '%(if)%(upstream:short)%(then)%(refname:short)->%(upstream:short) %(else)* %(end)', 'refs/heads']);
|
||||
async findTrackingBranches(upstreamBranch: string): Promise<Branch[]> {
|
||||
const result = await this.run(['for-each-ref', '--format', '%(refname:short)%00%(upstream:short)', 'refs/heads']);
|
||||
return result.stdout.trim().split('\n')
|
||||
.map(line => line.trim())
|
||||
.filter(line => line !== '*')
|
||||
.map(line => {
|
||||
const splited = line.split('->');
|
||||
return {
|
||||
local: splited[0],
|
||||
upstream: splited[1]
|
||||
} as TrackingShip;
|
||||
})
|
||||
.filter(trackingShip => trackingShip.upstream === upstreamBranch);
|
||||
.map(line => line.trim().split('\0'))
|
||||
.filter(([_, upstream]) => upstream === upstreamBranch)
|
||||
.map(([ref]) => ({ name: ref, type: RefType.Head } as Branch));
|
||||
}
|
||||
|
||||
async getRefs(): Promise<Ref[]> {
|
||||
|
||||
Reference in New Issue
Block a user