diff --git a/src/env/node/git/localGitProvider.ts b/src/env/node/git/localGitProvider.ts index eeee780..e49f9dd 100644 --- a/src/env/node/git/localGitProvider.ts +++ b/src/env/node/git/localGitProvider.ts @@ -2,6 +2,7 @@ import { readdir, realpath } from 'fs'; import { homedir, hostname, userInfo } from 'os'; import { resolve as resolvePath } from 'path'; import { env as process_env } from 'process'; +import { encodingExists } from 'iconv-lite'; import type { CancellationToken, Event, TextDocument, WorkspaceFolder } from 'vscode'; import { Disposable, env, EventEmitter, extensions, FileType, Range, Uri, window, workspace } from 'vscode'; import { fetch, getProxyAgent } from '@env/fetch'; @@ -44,7 +45,6 @@ import type { ScmRepository, } from '../../../git/gitProvider'; import { GitProviderId, RepositoryVisibility } from '../../../git/gitProvider'; -import { GitProviderService } from '../../../git/gitProviderService'; import { encodeGitLensRevisionUriAuthority, GitUri } from '../../../git/gitUri'; import type { GitBlame, GitBlameAuthor, GitBlameLine, GitBlameLines } from '../../../git/models/blame'; import type { BranchSortOptions } from '../../../git/models/branch'; @@ -2336,7 +2336,7 @@ export class LocalGitProvider implements GitProvider, Disposable { uri.fsPath, ref1, ref2, - { encoding: GitProviderService.getEncoding(uri) }, + { encoding: getEncoding(uri) }, doc, key, scope, @@ -2424,7 +2424,7 @@ export class LocalGitProvider implements GitProvider, Disposable { uri.fsPath, ref, contents, - { encoding: GitProviderService.getEncoding(uri) }, + { encoding: getEncoding(uri) }, doc, key, scope, @@ -4838,3 +4838,8 @@ export class LocalGitProvider implements GitProvider, Disposable { ); } } + +function getEncoding(uri: Uri): string { + const encoding = configuration.getAny('files.encoding', uri); + return encoding != null && encodingExists(encoding) ? encoding : 'utf8'; +} diff --git a/src/git/gitProviderService.ts b/src/git/gitProviderService.ts index ef10b45..72c374b 100644 --- a/src/git/gitProviderService.ts +++ b/src/git/gitProviderService.ts @@ -1,4 +1,3 @@ -import { encodingExists } from 'iconv-lite'; import type { CancellationToken, ConfigurationChangeEvent, @@ -2515,9 +2514,4 @@ export class GitProviderService implements Disposable { const { provider, path } = this.getProvider(repoPath); return provider.getOrOpenScmRepository(path); } - - static getEncoding(uri: Uri): string { - const encoding = configuration.getAny('files.encoding', uri); - return encoding != null && encodingExists(encoding) ? encoding : 'utf8'; - } }