Browse Source

Normalizes to fileName casing

main
Eric Amodio 3 years ago
parent
commit
148bb9c9e5
12 changed files with 19 additions and 19 deletions
  1. +1
    -1
      src/commands/diffWithRevision.ts
  2. +1
    -1
      src/commands/diffWithRevisionFrom.ts
  3. +1
    -1
      src/commands/git/log.ts
  4. +3
    -3
      src/commands/git/stash.ts
  5. +1
    -1
      src/commands/openFileAtRevision.ts
  6. +1
    -1
      src/commands/openFileAtRevisionFrom.ts
  7. +2
    -2
      src/commands/quickCommand.steps.ts
  8. +2
    -2
      src/git/git.ts
  9. +3
    -3
      src/git/gitUri.ts
  10. +1
    -1
      src/webviews/settingsWebview.ts
  11. +2
    -2
      src/webviews/webviewBase.ts
  12. +1
    -1
      src/webviews/welcomeWebview.ts

+ 1
- 1
src/commands/diffWithRevision.ts View File

@ -47,7 +47,7 @@ export class DiffWithRevisionCommand extends ActiveEditorCommand {
const title = `Open Changes with Revision${Strings.pad(GlyphChars.Dot, 2, 2)}`;
const pick = await CommitPicker.show(
log,
`${title}${gitUri.getFormattedFilename({
`${title}${gitUri.getFormattedFileName({
suffix: gitUri.sha ? `:${GitRevision.shorten(gitUri.sha)}` : undefined,
truncateTo: quickPickTitleMaxChars - title.length,
})}`,

+ 1
- 1
src/commands/diffWithRevisionFrom.ts View File

@ -41,7 +41,7 @@ export class DiffWithRevisionFromCommand extends ActiveEditorCommand {
const title = `Open Changes with Branch or Tag${Strings.pad(GlyphChars.Dot, 2, 2)}`;
const pick = await ReferencePicker.show(
gitUri.repoPath,
`${title}${gitUri.getFormattedFilename({ truncateTo: quickPickTitleMaxChars - title.length })}`,
`${title}${gitUri.getFormattedFileName({ truncateTo: quickPickTitleMaxChars - title.length })}`,
'Choose a branch or tag to compare with',
{
allowEnteringRefs: true,

+ 1
- 1
src/commands/git/log.ts View File

@ -140,7 +140,7 @@ export class LogGitCommand extends QuickCommand {
)}`;
if (state.fileName) {
context.title += `${Strings.pad(GlyphChars.Dot, 2, 2)}${GitUri.getFormattedFilename(state.fileName, {
context.title += `${Strings.pad(GlyphChars.Dot, 2, 2)}${GitUri.getFormattedFileName(state.fileName, {
truncateTo: quickPickTitleMaxChars - context.title.length - 3,
})}`;
}

+ 3
- 3
src/commands/git/stash.ts View File

@ -523,7 +523,7 @@ export class StashGitCommand extends QuickCommand {
state.uris != null
? `${Strings.pad(GlyphChars.Dot, 2, 2)}${
state.uris.length === 1
? GitUri.getFormattedFilename(state.uris[0])
? GitUri.getFormattedFileName(state.uris[0])
: `${state.uris.length} files`
}`
: undefined,
@ -569,7 +569,7 @@ export class StashGitCommand extends QuickCommand {
label: context.title,
detail: `Will stash changes from ${
state.uris.length === 1
? GitUri.getFormattedFilename(state.uris[0])
? GitUri.getFormattedFileName(state.uris[0])
: `${state.uris.length} files`
}`,
}),
@ -577,7 +577,7 @@ export class StashGitCommand extends QuickCommand {
label: `${context.title} & Keep Staged`,
detail: `Will stash changes from ${
state.uris.length === 1
? GitUri.getFormattedFilename(state.uris[0])
? GitUri.getFormattedFileName(state.uris[0])
: `${state.uris.length} files`
}, but will keep staged files intact`,
}),

+ 1
- 1
src/commands/openFileAtRevision.ts View File

@ -97,7 +97,7 @@ export class OpenFileAtRevisionCommand extends ActiveEditorCommand {
} at Revision${Strings.pad(GlyphChars.Dot, 2, 2)}`;
const pick = await CommitPicker.show(
log,
`${title}${gitUri.getFormattedFilename({
`${title}${gitUri.getFormattedFileName({
suffix: gitUri.sha ? `:${GitRevision.shorten(gitUri.sha)}` : undefined,
truncateTo: quickPickTitleMaxChars - title.length,
})}`,

+ 1
- 1
src/commands/openFileAtRevisionFrom.ts View File

@ -43,7 +43,7 @@ export class OpenFileAtRevisionFromCommand extends ActiveEditorCommand {
const title = `Open File at Branch or Tag${Strings.pad(GlyphChars.Dot, 2, 2)}`;
const pick = await ReferencePicker.show(
gitUri.repoPath,
`${title}${gitUri.getFormattedFilename({ truncateTo: quickPickTitleMaxChars - title.length })}`,
`${title}${gitUri.getFormattedFileName({ truncateTo: quickPickTitleMaxChars - title.length })}`,
'Choose a branch or tag to open the file revision from',
{
allowEnteringRefs: true,

+ 2
- 2
src/commands/quickCommand.steps.ts View File

@ -1689,7 +1689,7 @@ export async function* showCommitOrStashFileStep<
}),
state,
context,
`${Strings.pad(GlyphChars.Dot, 2, 2)}${GitUri.getFormattedFilename(state.fileName)}`,
`${Strings.pad(GlyphChars.Dot, 2, 2)}${GitUri.getFormattedFileName(state.fileName)}`,
),
placeholder: `${GitUri.getFormattedPath(state.fileName, {
relativeTo: state.repo.path,
@ -1756,7 +1756,7 @@ async function getShowCommitOrStashFileStepItems<
if (file == null) return [];
const items: CommandQuickPickItem[] = [
new CommitFilesQuickPickItem(state.reference, undefined, GitUri.getFormattedFilename(state.fileName)),
new CommitFilesQuickPickItem(state.reference, undefined, GitUri.getFormattedFileName(state.fileName)),
];
let remotes: GitRemote<RemoteProvider>[] | undefined;

+ 2
- 2
src/git/git.ts View File

@ -1291,13 +1291,13 @@ export namespace Git {
export async function rev_parse__verify(
repoPath: string,
ref: string,
filename?: string,
fileName?: string,
): Promise<string | undefined> {
const data = await git<string>(
{ cwd: repoPath, errors: GitErrorHandling.Ignore },
'rev-parse',
'--verify',
filename ? `${ref}:./${filename}` : `${ref}^{commit}`,
fileName ? `${ref}:./${fileName}` : `${ref}^{commit}`,
);
return data.length === 0 ? undefined : data.trim();
}

+ 3
- 3
src/git/gitUri.ts View File

@ -184,8 +184,8 @@ export class GitUri extends (Uri as any as UriEx) {
return this.sha === (GitUri.is(uri) ? uri.sha : undefined);
}
getFormattedFilename(options: { suffix?: string; truncateTo?: number } = {}): string {
return GitUri.getFormattedFilename(this.fsPath, options);
getFormattedFileName(options: { suffix?: string; truncateTo?: number } = {}): string {
return GitUri.getFormattedFileName(this.fsPath, options);
}
getFormattedPath(options: { relativeTo?: string; suffix?: string; truncateTo?: number } = {}): string {
@ -330,7 +330,7 @@ export class GitUri extends (Uri as any as UriEx) {
return directory == null || directory.length === 0 || directory === '.' ? emptyStr : directory;
}
static getFormattedFilename(
static getFormattedFileName(
fileNameOrUri: string | Uri,
options: {
suffix?: string;

+ 1
- 1
src/webviews/settingsWebview.ts View File

@ -75,7 +75,7 @@ export class SettingsWebview extends WebviewBase {
}
}
get filename(): string {
get fileName(): string {
return 'settings.html';
}

+ 2
- 2
src/webviews/webviewBase.ts View File

@ -61,7 +61,7 @@ export abstract class WebviewBase implements Disposable {
);
}
abstract get filename(): string;
abstract get fileName(): string;
abstract get id(): string;
abstract get title(): string;
@ -322,7 +322,7 @@ export abstract class WebviewBase implements Disposable {
}
private async getHtml(webview: Webview): Promise<string> {
const uri = Uri.joinPath(this.container.context.extensionUri, 'dist', 'webviews', this.filename);
const uri = Uri.joinPath(this.container.context.extensionUri, 'dist', 'webviews', this.fileName);
const content = new TextDecoder('utf8').decode(await workspace.fs.readFile(uri));
const [head, body, endOfBody] = await Promise.all([

+ 1
- 1
src/webviews/welcomeWebview.ts View File

@ -9,7 +9,7 @@ export class WelcomeWebview extends WebviewBase {
super(Commands.ShowWelcomePage, container);
}
get filename(): string {
get fileName(): string {
return 'welcome.html';
}

Loading…
Cancel
Save