mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-01-26 09:35:38 -05:00
Merge from vscode 4d91d96e5e121b38d33508cdef17868bab255eae
This commit is contained in:
committed by
AzureDataStudio
parent
a971aee5bd
commit
5e7071e466
@@ -422,7 +422,7 @@ export class Git {
|
||||
const result = await this.exec(repositoryPath, ['rev-parse', '--show-toplevel']);
|
||||
|
||||
// Keep trailing spaces which are part of the directory name
|
||||
const repoPath = path.normalize(result.stdout.trimLeft().replace(/(\r\n|\r|\n)+$/, ''));
|
||||
const repoPath = path.normalize(result.stdout.trimLeft().replace(/[\r\n]+$/, ''));
|
||||
|
||||
if (isWindows) {
|
||||
// On Git 2.25+ if you call `rev-parse --show-toplevel` on a mapped drive, instead of getting the mapped drive path back, you get the UNC path for the mapped drive.
|
||||
@@ -905,7 +905,7 @@ export class Repository {
|
||||
}
|
||||
|
||||
async buffer(object: string): Promise<Buffer> {
|
||||
const child = this.stream(['show', object]);
|
||||
const child = this.stream(['show', '--textconv', object]);
|
||||
|
||||
if (!child.stdout) {
|
||||
return Promise.reject<Buffer>('Can\'t open file from git');
|
||||
@@ -978,7 +978,7 @@ export class Repository {
|
||||
}
|
||||
|
||||
async detectObjectType(object: string): Promise<{ mimetype: string, encoding?: string }> {
|
||||
const child = await this.stream(['show', object]);
|
||||
const child = await this.stream(['show', '--textconv', object]);
|
||||
const buffer = await readBytes(child.stdout!, 4100);
|
||||
|
||||
try {
|
||||
@@ -1791,13 +1791,23 @@ export class Repository {
|
||||
.map(([ref]) => ({ name: ref, type: RefType.Head } as Branch));
|
||||
}
|
||||
|
||||
async getRefs(opts?: { sort?: 'alphabetically' | 'committerdate', contains?: string }): Promise<Ref[]> {
|
||||
const args = ['for-each-ref', '--format', '%(refname) %(objectname)'];
|
||||
async getRefs(opts?: { sort?: 'alphabetically' | 'committerdate', contains?: string, pattern?: string, count?: number }): Promise<Ref[]> {
|
||||
const args = ['for-each-ref'];
|
||||
|
||||
if (opts?.count) {
|
||||
args.push(`--count=${opts.count}`);
|
||||
}
|
||||
|
||||
if (opts && opts.sort && opts.sort !== 'alphabetically') {
|
||||
args.push('--sort', `-${opts.sort}`);
|
||||
}
|
||||
|
||||
args.push('--format', '%(refname) %(objectname)');
|
||||
|
||||
if (opts?.pattern) {
|
||||
args.push(opts.pattern);
|
||||
}
|
||||
|
||||
if (opts?.contains) {
|
||||
args.push('--contains', opts.contains);
|
||||
}
|
||||
@@ -1920,7 +1930,7 @@ export class Repository {
|
||||
}
|
||||
|
||||
async getBranches(query: BranchQuery): Promise<Ref[]> {
|
||||
const refs = await this.getRefs({ contains: query.contains });
|
||||
const refs = await this.getRefs({ contains: query.contains, pattern: query.pattern ? `refs/${query.pattern}` : undefined, count: query.count });
|
||||
return refs.filter(value => (value.type !== RefType.Tag) && (query.remote || !value.remote));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user