mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 21:09:43 +00:00
Git - handle --intent-to-add on a renamed resource (#183307)
This commit is contained in:
parent
36464655d1
commit
e7e97f8ea8
|
@ -362,6 +362,7 @@ function getStatus(status: Status): string {
|
|||
case Status.UNTRACKED: return 'UNTRACKED';
|
||||
case Status.IGNORED: return 'IGNORED';
|
||||
case Status.INTENT_TO_ADD: return 'INTENT_TO_ADD';
|
||||
case Status.INTENT_TO_RENAME: return 'INTENT_TO_RENAME';
|
||||
case Status.ADDED_BY_US: return 'ADDED_BY_US';
|
||||
case Status.ADDED_BY_THEM: return 'ADDED_BY_THEM';
|
||||
case Status.DELETED_BY_US: return 'DELETED_BY_US';
|
||||
|
|
1
extensions/git/src/api/git.d.ts
vendored
1
extensions/git/src/api/git.d.ts
vendored
|
@ -78,6 +78,7 @@ export const enum Status {
|
|||
UNTRACKED,
|
||||
IGNORED,
|
||||
INTENT_TO_ADD,
|
||||
INTENT_TO_RENAME,
|
||||
|
||||
ADDED_BY_US,
|
||||
ADDED_BY_THEM,
|
||||
|
|
|
@ -131,7 +131,7 @@ class GitDecorationProvider implements FileDecorationProvider {
|
|||
bucket.set(r.rightUri.toString(), decoration);
|
||||
}
|
||||
|
||||
if (r.type === Status.INDEX_RENAMED) {
|
||||
if (r.type === Status.INDEX_RENAMED || r.type === Status.INTENT_TO_RENAME) {
|
||||
bucket.set(r.resourceUri.toString(), decoration);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -793,7 +793,7 @@ export class GitStatusParser {
|
|||
// space
|
||||
i++;
|
||||
|
||||
if (entry.x === 'R' || entry.x === 'C') {
|
||||
if (entry.x === 'R' || entry.y === 'R' || entry.x === 'C') {
|
||||
lastIndex = raw.indexOf('\0', i);
|
||||
|
||||
if (lastIndex === -1) {
|
||||
|
|
|
@ -58,6 +58,7 @@ export class Resource implements SourceControlResourceState {
|
|||
case Status.UNTRACKED: return l10n.t('Untracked');
|
||||
case Status.IGNORED: return l10n.t('Ignored');
|
||||
case Status.INTENT_TO_ADD: return l10n.t('Intent to Add');
|
||||
case Status.INTENT_TO_RENAME: return l10n.t('Intent to Rename');
|
||||
case Status.BOTH_DELETED: return l10n.t('Conflict: Both Deleted');
|
||||
case Status.ADDED_BY_US: return l10n.t('Conflict: Added By Us');
|
||||
case Status.DELETED_BY_THEM: return l10n.t('Conflict: Deleted By Them');
|
||||
|
@ -71,7 +72,7 @@ export class Resource implements SourceControlResourceState {
|
|||
|
||||
@memoize
|
||||
get resourceUri(): Uri {
|
||||
if (this.renameResourceUri && (this._type === Status.MODIFIED || this._type === Status.DELETED || this._type === Status.INDEX_RENAMED || this._type === Status.INDEX_COPIED)) {
|
||||
if (this.renameResourceUri && (this._type === Status.MODIFIED || this._type === Status.DELETED || this._type === Status.INDEX_RENAMED || this._type === Status.INDEX_COPIED || this._type === Status.INTENT_TO_RENAME)) {
|
||||
return this.renameResourceUri;
|
||||
}
|
||||
|
||||
|
@ -136,6 +137,7 @@ export class Resource implements SourceControlResourceState {
|
|||
case Status.UNTRACKED: return Resource.Icons[theme].Untracked;
|
||||
case Status.IGNORED: return Resource.Icons[theme].Ignored;
|
||||
case Status.INTENT_TO_ADD: return Resource.Icons[theme].Added;
|
||||
case Status.INTENT_TO_RENAME: return Resource.Icons[theme].Renamed;
|
||||
case Status.BOTH_DELETED: return Resource.Icons[theme].Conflict;
|
||||
case Status.ADDED_BY_US: return Resource.Icons[theme].Conflict;
|
||||
case Status.DELETED_BY_THEM: return Resource.Icons[theme].Conflict;
|
||||
|
@ -193,6 +195,7 @@ export class Resource implements SourceControlResourceState {
|
|||
case Status.DELETED:
|
||||
return 'D';
|
||||
case Status.INDEX_RENAMED:
|
||||
case Status.INTENT_TO_RENAME:
|
||||
return 'R';
|
||||
case Status.UNTRACKED:
|
||||
return 'U';
|
||||
|
@ -230,6 +233,7 @@ export class Resource implements SourceControlResourceState {
|
|||
return new ThemeColor('gitDecoration.addedResourceForeground');
|
||||
case Status.INDEX_COPIED:
|
||||
case Status.INDEX_RENAMED:
|
||||
case Status.INTENT_TO_RENAME:
|
||||
return new ThemeColor('gitDecoration.renamedResourceForeground');
|
||||
case Status.UNTRACKED:
|
||||
return new ThemeColor('gitDecoration.untrackedResourceForeground');
|
||||
|
@ -520,6 +524,7 @@ class ResourceCommandResolver {
|
|||
case Status.INDEX_MODIFIED:
|
||||
case Status.INDEX_RENAMED:
|
||||
case Status.INDEX_ADDED:
|
||||
case Status.INTENT_TO_RENAME:
|
||||
return toGitUri(resource.original, 'HEAD');
|
||||
|
||||
case Status.MODIFIED:
|
||||
|
@ -554,7 +559,8 @@ class ResourceCommandResolver {
|
|||
case Status.MODIFIED:
|
||||
case Status.UNTRACKED:
|
||||
case Status.IGNORED:
|
||||
case Status.INTENT_TO_ADD: {
|
||||
case Status.INTENT_TO_ADD:
|
||||
case Status.INTENT_TO_RENAME: {
|
||||
const uriString = resource.resourceUri.toString();
|
||||
const [indexStatus] = this.repository.indexGroup.resourceStates.filter(r => r.resourceUri.toString() === uriString);
|
||||
|
||||
|
@ -599,6 +605,10 @@ class ResourceCommandResolver {
|
|||
case Status.UNTRACKED:
|
||||
return l10n.t('{0} (Untracked)', basename);
|
||||
|
||||
case Status.INTENT_TO_ADD:
|
||||
case Status.INTENT_TO_RENAME:
|
||||
return l10n.t('{0} (Intent to add)', basename);
|
||||
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
|
@ -2177,6 +2187,7 @@ export class Repository implements Disposable {
|
|||
case 'M': workingTreeGroup.push(new Resource(this.resourceCommandResolver, ResourceGroupType.WorkingTree, uri, Status.MODIFIED, useIcons, renameUri)); break;
|
||||
case 'D': workingTreeGroup.push(new Resource(this.resourceCommandResolver, ResourceGroupType.WorkingTree, uri, Status.DELETED, useIcons, renameUri)); break;
|
||||
case 'A': workingTreeGroup.push(new Resource(this.resourceCommandResolver, ResourceGroupType.WorkingTree, uri, Status.INTENT_TO_ADD, useIcons, renameUri)); break;
|
||||
case 'R': workingTreeGroup.push(new Resource(this.resourceCommandResolver, ResourceGroupType.WorkingTree, uri, Status.INTENT_TO_RENAME, useIcons, renameUri)); break;
|
||||
}
|
||||
|
||||
return undefined;
|
||||
|
|
1
extensions/github/src/typings/git.d.ts
vendored
1
extensions/github/src/typings/git.d.ts
vendored
|
@ -78,6 +78,7 @@ export const enum Status {
|
|||
UNTRACKED,
|
||||
IGNORED,
|
||||
INTENT_TO_ADD,
|
||||
INTENT_TO_RENAME,
|
||||
|
||||
ADDED_BY_US,
|
||||
ADDED_BY_THEM,
|
||||
|
|
Loading…
Reference in a new issue