mirror of
https://github.com/ckaczor/vscode-gitlens.git
synced 2026-01-16 09:35:40 -05:00
Refactors git models & parsers
Adds full git status parsing Adds git status info into status quick pick Switches to async/await in file blame/log
This commit is contained in:
29
src/git/models/branch.ts
Normal file
29
src/git/models/branch.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
'use strict';
|
||||
|
||||
export class GitBranch {
|
||||
|
||||
current: boolean;
|
||||
name: string;
|
||||
remote: boolean;
|
||||
|
||||
constructor(branch: string) {
|
||||
branch = branch.trim();
|
||||
|
||||
if (branch.startsWith('* ')) {
|
||||
branch = branch.substring(2);
|
||||
this.current = true;
|
||||
}
|
||||
|
||||
if (branch.startsWith('remotes/')) {
|
||||
branch = branch.substring(8);
|
||||
this.remote = true;
|
||||
}
|
||||
|
||||
const index = branch.indexOf(' ');
|
||||
if (index !== -1) {
|
||||
branch = branch.substring(0, index);
|
||||
}
|
||||
|
||||
this.name = branch;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user