VCS: Fix issues with clicking on links in output view

Amends cb6a2da372

that started clearing the static repository information from the output
view. The issue with that is that it clears that information even for
asynchronous vcs commands that do not have anything to do with the
output view at all. The code before was mostly wrong already, but the
information was never cleared it mostly worked out.

It would be good to get rid of the static information about the
repository from the output view, and instead provid the repository
information for each output that is added. But this patch is a band aid
for Qt Creator 15:

- set the repository information again before appending messages from a
vcs command to the output view
- set the repository information also for runBlocking, which also broke
in the above commit

Task-number: QTCREATORBUG-31894
Change-Id: I0823b53e0fbecc14961be905f5279eb5a461ab93
Reviewed-by: André Hartmann <aha_1980@gmx.de>
This commit is contained in:
Eike Ziller
2024-11-25 11:36:25 +01:00
parent f5c55885d4
commit 0eb99f5498

View File

@@ -128,6 +128,7 @@ void VcsCommandPrivate::installStdCallbacks(Process *process)
|| m_progressParser || !(m_flags & RunFlags::SuppressStdErr))) {
process->setTextChannelMode(Channel::Error, TextChannelMode::MultiLine);
connect(process, &Process::textOnStandardError, this, [this](const QString &text) {
VcsOutputWindow::setRepository(m_defaultWorkingDirectory);
if (!(m_flags & RunFlags::SuppressStdErr))
VcsOutputWindow::appendError(text);
if (m_flags & RunFlags::ProgressiveOutput)
@@ -138,6 +139,7 @@ void VcsCommandPrivate::installStdCallbacks(Process *process)
|| m_flags & RunFlags::ShowStdOut) {
process->setTextChannelMode(Channel::Output, TextChannelMode::MultiLine);
connect(process, &Process::textOnStandardOutput, this, [this](const QString &text) {
VcsOutputWindow::setRepository(m_defaultWorkingDirectory);
if (m_flags & RunFlags::ShowStdOut)
VcsOutputWindow::append(text);
if (m_flags & RunFlags::ProgressiveOutput)
@@ -305,6 +307,7 @@ CommandResult VcsCommand::runBlockingHelper(const CommandLine &command, int time
return {};
const Internal::VcsCommandPrivate::Job job{command, timeoutS, d->m_defaultWorkingDirectory};
VcsOutputWindow::setRepository(d->m_defaultWorkingDirectory);
d->setupProcess(&process, job);
const EventLoopMode eventLoopMode = d->eventLoopMode();