mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-25 02:58:56 +01:00
Git - fix stage/unstage selected ranges in nested git repositories (#191987)
* Git - fix stage/unstage selected ranges in nested git repositories * Remove the submodule check as it is being covered by the repository check * Pull request feedback
This commit is contained in:
@@ -633,6 +633,14 @@ interface BranchProtectionMatcher {
|
||||
exclude?: picomatch.Matcher;
|
||||
}
|
||||
|
||||
export interface IRepositoryResolver {
|
||||
getRepository(sourceControl: SourceControl): Repository | undefined;
|
||||
getRepository(resourceGroup: SourceControlResourceGroup): Repository | undefined;
|
||||
getRepository(path: string): Repository | undefined;
|
||||
getRepository(resource: Uri): Repository | undefined;
|
||||
getRepository(hint: any): Repository | undefined;
|
||||
}
|
||||
|
||||
export class Repository implements Disposable {
|
||||
|
||||
private _onDidChangeRepository = new EventEmitter<Uri>();
|
||||
@@ -784,6 +792,7 @@ export class Repository implements Disposable {
|
||||
|
||||
constructor(
|
||||
private readonly repository: BaseRepository,
|
||||
private readonly repositoryResolver: IRepositoryResolver,
|
||||
private pushErrorHandlerRegistry: IPushErrorHandlerRegistry,
|
||||
remoteSourcePublisherRegistry: IRemoteSourcePublisherRegistry,
|
||||
postCommitCommandsProviderRegistry: IPostCommitCommandsProviderRegistry,
|
||||
@@ -1010,13 +1019,13 @@ export class Repository implements Disposable {
|
||||
return;
|
||||
}
|
||||
|
||||
// Ignore path that is inside a merge group
|
||||
if (this.mergeGroup.resourceStates.some(r => r.resourceUri.path === uri.path)) {
|
||||
// Ignore path that is not inside the current repository
|
||||
if (this.repositoryResolver.getRepository(uri) !== this) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
// Ignore path that is inside a submodule
|
||||
if (this.submodules.some(s => isDescendant(path.join(this.repository.root, s.path), uri.path))) {
|
||||
// Ignore path that is inside a merge group
|
||||
if (this.mergeGroup.resourceStates.some(r => r.resourceUri.path === uri.path)) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user