|
@ -21,6 +21,7 @@ import { emojify } from '../../../emojis'; |
|
|
import { Features } from '../../../features'; |
|
|
import { Features } from '../../../features'; |
|
|
import { GitErrorHandling } from '../../../git/commandOptions'; |
|
|
import { GitErrorHandling } from '../../../git/commandOptions'; |
|
|
import { |
|
|
import { |
|
|
|
|
|
BlameIgnoreRevsFileError, |
|
|
FetchError, |
|
|
FetchError, |
|
|
GitSearchError, |
|
|
GitSearchError, |
|
|
PullError, |
|
|
PullError, |
|
@ -1463,19 +1464,24 @@ export class LocalGitProvider implements GitProvider, Disposable { |
|
|
const blame = parseGitBlame(this.container, data, root, await this.getCurrentUser(root)); |
|
|
const blame = parseGitBlame(this.container, data, root, await this.getCurrentUser(root)); |
|
|
return blame; |
|
|
return blame; |
|
|
} catch (ex) { |
|
|
} catch (ex) { |
|
|
|
|
|
Logger.error(ex, scope); |
|
|
|
|
|
|
|
|
// Trap and cache expected blame errors
|
|
|
// Trap and cache expected blame errors
|
|
|
if (document.state != null) { |
|
|
if (document.state != null) { |
|
|
const msg = ex?.toString() ?? ''; |
|
|
const msg = ex?.toString() ?? ''; |
|
|
Logger.debug(scope, `Cache replace (with empty promise): '${key}'`); |
|
|
|
|
|
|
|
|
Logger.debug(scope, `Cache replace (with empty promise): '${key}'; reason=${msg}`); |
|
|
|
|
|
|
|
|
const value: CachedBlame = { |
|
|
const value: CachedBlame = { |
|
|
item: emptyPromise as Promise<GitBlame>, |
|
|
item: emptyPromise as Promise<GitBlame>, |
|
|
errorMessage: msg, |
|
|
errorMessage: msg, |
|
|
}; |
|
|
}; |
|
|
document.state.setBlame(key, value); |
|
|
document.state.setBlame(key, value); |
|
|
|
|
|
|
|
|
document.setBlameFailure(); |
|
|
document.setBlameFailure(); |
|
|
|
|
|
|
|
|
|
|
|
if (ex instanceof BlameIgnoreRevsFileError) { |
|
|
|
|
|
void window.showErrorMessage(ex.friendlyMessage); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return emptyPromise as Promise<GitBlame>; |
|
|
return emptyPromise as Promise<GitBlame>; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -1544,18 +1550,24 @@ export class LocalGitProvider implements GitProvider, Disposable { |
|
|
const blame = parseGitBlame(this.container, data, root, await this.getCurrentUser(root)); |
|
|
const blame = parseGitBlame(this.container, data, root, await this.getCurrentUser(root)); |
|
|
return blame; |
|
|
return blame; |
|
|
} catch (ex) { |
|
|
} catch (ex) { |
|
|
|
|
|
Logger.error(ex, scope); |
|
|
|
|
|
|
|
|
// Trap and cache expected blame errors
|
|
|
// Trap and cache expected blame errors
|
|
|
if (document.state != null) { |
|
|
if (document.state != null) { |
|
|
const msg = ex?.toString() ?? ''; |
|
|
const msg = ex?.toString() ?? ''; |
|
|
Logger.debug(scope, `Cache replace (with empty promise): '${key}'`); |
|
|
|
|
|
|
|
|
Logger.debug(scope, `Cache replace (with empty promise): '${key}'; reason=${msg}`); |
|
|
|
|
|
|
|
|
const value: CachedBlame = { |
|
|
const value: CachedBlame = { |
|
|
item: emptyPromise as Promise<GitBlame>, |
|
|
item: emptyPromise as Promise<GitBlame>, |
|
|
errorMessage: msg, |
|
|
errorMessage: msg, |
|
|
}; |
|
|
}; |
|
|
document.state.setBlame(key, value); |
|
|
document.state.setBlame(key, value); |
|
|
|
|
|
|
|
|
document.setBlameFailure(); |
|
|
document.setBlameFailure(); |
|
|
|
|
|
|
|
|
|
|
|
if (ex instanceof BlameIgnoreRevsFileError) { |
|
|
|
|
|
void window.showErrorMessage(ex.friendlyMessage); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return emptyPromise as Promise<GitBlame>; |
|
|
return emptyPromise as Promise<GitBlame>; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -1575,6 +1587,8 @@ export class LocalGitProvider implements GitProvider, Disposable { |
|
|
): Promise<GitBlameLine | undefined> { |
|
|
): Promise<GitBlameLine | undefined> { |
|
|
if (document?.isDirty) return this.getBlameForLineContents(uri, editorLine, document.getText(), options); |
|
|
if (document?.isDirty) return this.getBlameForLineContents(uri, editorLine, document.getText(), options); |
|
|
|
|
|
|
|
|
|
|
|
const scope = getLogScope(); |
|
|
|
|
|
|
|
|
if (!options?.forceSingleLine && this.useCaching) { |
|
|
if (!options?.forceSingleLine && this.useCaching) { |
|
|
const blame = await this.getBlame(uri, document); |
|
|
const blame = await this.getBlame(uri, document); |
|
|
if (blame == null) return undefined; |
|
|
if (blame == null) return undefined; |
|
@ -1614,7 +1628,12 @@ export class LocalGitProvider implements GitProvider, Disposable { |
|
|
commit: first(blame.commits.values())!, |
|
|
commit: first(blame.commits.values())!, |
|
|
line: blame.lines[editorLine], |
|
|
line: blame.lines[editorLine], |
|
|
}; |
|
|
}; |
|
|
} catch { |
|
|
|
|
|
|
|
|
} catch (ex) { |
|
|
|
|
|
Logger.error(ex, scope); |
|
|
|
|
|
if (ex instanceof BlameIgnoreRevsFileError) { |
|
|
|
|
|
void window.showErrorMessage(ex.friendlyMessage); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
return undefined; |
|
|
return undefined; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|