mirror of
https://github.com/kahole/edamagit.git
synced 2024-09-11 07:15:31 +03:00
Properly dispose "Running git" status bar messages
This fixes issue #279 meaning messages won't get stuck in the status bar any longer. This commit also disables status messages for magit status, to reduce noise.
This commit is contained in:
parent
53d8f64ae1
commit
a0c21e7fee
@ -91,7 +91,7 @@ export async function internalMagitStatus(repository: Repository): Promise<Magit
|
||||
|
||||
const untrackedFiles: MagitChange[] =
|
||||
repository.state.workingTreeChanges.length > workingTreeChanges_NoUntracked.length ?
|
||||
(await gitRun(repository, ['ls-files', '--others', '--exclude-standard', '--directory', '--no-empty-directory'], {}, LogLevel.None))
|
||||
(await gitRun(repository, ['ls-files', '--others', '--exclude-standard', '--directory', '--no-empty-directory'], {}, LogLevel.None, false))
|
||||
.stdout
|
||||
.replace(Constants.FinalLineBreakRegex, '')
|
||||
.split(Constants.LineSplitterRegex)
|
||||
@ -211,7 +211,7 @@ async function getCommitRange(repository: Repository, from: string, to: string,
|
||||
const args = ['log', '--format=format:%H', `${from}..${to}`, '-n', `${Math.trunc(maxResults) + 1}`];
|
||||
let result;
|
||||
try {
|
||||
result = await gitRun(repository, args, {}, LogLevel.Error);
|
||||
result = await gitRun(repository, args, {}, LogLevel.Error, false);
|
||||
} catch (error) {
|
||||
return {commits: [], truncated: false};
|
||||
}
|
||||
@ -265,7 +265,7 @@ async function mergingStatus(repository: Repository, dotGitPath: string): Promis
|
||||
if (parsedMergeState) {
|
||||
const [mergeHeadCommit, mergingBranches] = parsedMergeState;
|
||||
|
||||
const mergeCommitsText = (await gitRun(repository, ['rev-list', `HEAD..${mergeHeadCommit}`], {}, LogLevel.None)).stdout;
|
||||
const mergeCommitsText = (await gitRun(repository, ['rev-list', `HEAD..${mergeHeadCommit}`], {}, LogLevel.None, false)).stdout;
|
||||
const mergeCommits = mergeCommitsText
|
||||
.replace(Constants.FinalLineBreakRegex, '')
|
||||
.split(Constants.LineSplitterRegex);
|
||||
@ -417,7 +417,7 @@ async function getStashes(repository: Repository): Promise<Stash[]> {
|
||||
let args = ['stash', 'list'];
|
||||
|
||||
try {
|
||||
let stashesList = await gitRun(repository, args, {}, LogLevel.None);
|
||||
let stashesList = await gitRun(repository, args, {}, LogLevel.None, false);
|
||||
let stashOut = stashesList.stdout;
|
||||
|
||||
if (stashOut.length === 0) {
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { Repository } from '../typings/git';
|
||||
import { run, SpawnOptions } from './commandRunner/command';
|
||||
import { window } from 'vscode';
|
||||
import { Disposable, window } from 'vscode';
|
||||
import GitProcessLogger from './gitProcessLogger';
|
||||
import * as Constants from '../common/constants';
|
||||
|
||||
@ -11,8 +11,9 @@ export enum LogLevel {
|
||||
}
|
||||
|
||||
export async function gitRun(repository: Repository, args: string[], spawnOptions?: SpawnOptions, logLevel = LogLevel.Detailed, showStatus: boolean = true) {
|
||||
let runningStatus: Disposable | undefined = undefined;
|
||||
if (showStatus) {
|
||||
window.setStatusBarMessage(`Running git ${args.join(' ')}...`);
|
||||
runningStatus = window.setStatusBarMessage(`Running git ${args.join(' ')}...`);
|
||||
}
|
||||
|
||||
let logEntry;
|
||||
@ -41,8 +42,12 @@ export async function gitRun(repository: Repository, args: string[], spawnOption
|
||||
}
|
||||
|
||||
if (showStatus) {
|
||||
window.setStatusBarMessage(error.message);
|
||||
window.setStatusBarMessage(error.message, Constants.StatusMessageDisplayTimeout);
|
||||
}
|
||||
throw error;
|
||||
} finally {
|
||||
if (runningStatus) {
|
||||
runningStatus.dispose();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user