Browse Source

Fixes issue with open revision in quickpicks

main
Eric Amodio 5 years ago
parent
commit
75446f9ff3
2 changed files with 4 additions and 5 deletions
  1. +2
    -2
      src/commands/openInRemote.ts
  2. +2
    -3
      src/quickpicks/remotesQuickPick.ts

+ 2
- 2
src/commands/openInRemote.ts View File

@ -1,7 +1,7 @@
'use strict'; 'use strict';
import { TextEditor, Uri } from 'vscode'; import { TextEditor, Uri } from 'vscode';
import { GlyphChars } from '../constants'; import { GlyphChars } from '../constants';
import { GitLogCommit, GitRemote, GitService, RemoteResource, RemoteResourceType } from '../git/gitService';
import { GitRemote, GitService, RemoteResource, RemoteResourceType } from '../git/gitService';
import { Logger } from '../logger'; import { Logger } from '../logger';
import { Messages } from '../messages'; import { Messages } from '../messages';
import { CommandQuickPickItem, OpenRemoteCommandQuickPickItem, RemotesQuickPick } from '../quickpicks'; import { CommandQuickPickItem, OpenRemoteCommandQuickPickItem, RemotesQuickPick } from '../quickpicks';
@ -68,7 +68,7 @@ export class OpenInRemoteCommand extends ActiveEditorCommand {
break; break;
case RemoteResourceType.Revision: case RemoteResourceType.Revision:
if (args.resource.commit !== undefined && args.resource.commit instanceof GitLogCommit) {
if (args.resource.commit !== undefined && args.resource.commit.isFile) {
if (args.resource.commit.status === 'D') { if (args.resource.commit.status === 'D') {
args.resource.sha = args.resource.commit.previousSha; args.resource.sha = args.resource.commit.previousSha;
placeHolder = `${verb} ${args.resource.fileName} ${Strings.pad(GlyphChars.Dot, 1, 1)} ${ placeHolder = `${verb} ${args.resource.fileName} ${Strings.pad(GlyphChars.Dot, 1, 1)} ${

+ 2
- 3
src/quickpicks/remotesQuickPick.ts View File

@ -5,7 +5,6 @@ import { Commands, OpenInRemoteCommandArgs } from '../commands';
import { GlyphChars } from '../constants'; import { GlyphChars } from '../constants';
import { import {
getNameFromRemoteResource, getNameFromRemoteResource,
GitLogCommit,
GitRemote, GitRemote,
GitService, GitService,
RemoteResource, RemoteResource,
@ -70,7 +69,7 @@ export class OpenRemotesCommandQuickPickItem extends CommandQuickPickItem {
break; break;
case RemoteResourceType.Revision: case RemoteResourceType.Revision:
if (resource.commit !== undefined && resource.commit instanceof GitLogCommit) {
if (resource.commit !== undefined && resource.commit.isFile) {
if (resource.commit.status === 'D') { if (resource.commit.status === 'D') {
resource.sha = resource.commit.previousSha; resource.sha = resource.commit.previousSha;
description = `$(file-text) ${paths.basename(resource.fileName)} in ${ description = `$(file-text) ${paths.basename(resource.fileName)} in ${
@ -87,7 +86,7 @@ export class OpenRemotesCommandQuickPickItem extends CommandQuickPickItem {
} }
} }
else { else {
const shortFileSha = resource.sha === undefined ? '=' : GitService.shortenSha(resource.sha);
const shortFileSha = resource.sha === undefined ? '' : GitService.shortenSha(resource.sha);
description = `$(file-text) ${paths.basename(resource.fileName)}${ description = `$(file-text) ${paths.basename(resource.fileName)}${
shortFileSha ? ` in ${GlyphChars.Space}$(git-commit) ${shortFileSha}` : '' shortFileSha ? ` in ${GlyphChars.Space}$(git-commit) ${shortFileSha}` : ''
}`; }`;

Loading…
Cancel
Save