Git - scaffold the git extension API (#305643)

* Git - scaffold the git extension API

* Pull request feedback
This commit is contained in:
Ladislau Szomoru
2026-03-27 13:56:36 +00:00
committed by GitHub
parent 0ed75f3304
commit bdea2b4df8
5 changed files with 46 additions and 1 deletions
+20
View File
@@ -2345,6 +2345,26 @@ export class Repository {
}
}
async restore(paths: string[], options?: { staged?: boolean; ref?: string }): Promise<void> {
const args = ['restore'];
if (options?.staged) {
args.push('--staged');
}
if (options?.ref) {
args.push('--source', options.ref);
}
if (paths.length > 0) {
for (const chunk of splitInChunks(paths.map(p => this.sanitizeRelativePath(p)), MAX_CLI_LENGTH)) {
await this.exec([...args, '--', ...chunk]);
}
} else {
await this.exec([...args, '--', '.']);
}
}
async addRemote(name: string, url: string): Promise<void> {
const args = ['remote', 'add', name, url];
await this.exec(args);