Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Utilities
Kate
Commits
21c581d0
Commit
21c581d0
authored
Feb 16, 2021
by
Waqar Ahmed
Browse files
Fix show diff not working because of full path
parent
2d772f8d
Changes
1
Hide whitespace changes
Inline
Side-by-side
addons/project/gitwidget.cpp
View file @
21c581d0
...
...
@@ -12,6 +12,7 @@
#include <QDebug>
#include <QDialog>
#include <QEvent>
#include <QFileInfo>
#include <QInputMethodEvent>
#include <QLineEdit>
#include <QMenu>
...
...
@@ -229,6 +230,7 @@ void GitWidget::showDiff(const QString &file, bool staged)
if
(
staged
)
{
args
.
append
(
QStringLiteral
(
"--staged"
));
}
args
.
append
(
file
);
git
.
setWorkingDirectory
(
m_project
->
baseDir
());
...
...
@@ -242,9 +244,10 @@ void GitWidget::showDiff(const QString &file, bool staged)
sendMessage
(
i18n
(
"Failed to get Diff of file. Error:
\n
%1"
,
QString
::
fromUtf8
(
git
.
readAllStandardError
())),
true
);
}
else
{
std
::
unique_ptr
<
QTemporaryFile
>
f
(
new
QTemporaryFile
);
f
->
setFileTemplate
(
QString
(
QStringLiteral
(
"XXXXXX %1.diff"
).
arg
(
file
)));
QFileInfo
fi
(
file
);
f
->
setFileTemplate
(
QString
(
QStringLiteral
(
"XXXXXX %1.diff"
).
arg
(
fi
.
fileName
())));
if
(
f
->
open
())
{
f
->
write
(
git
.
readAll
());
f
->
write
(
git
.
readAll
StandardOutput
());
f
->
flush
();
const
QUrl
tempFileUrl
(
QUrl
::
fromLocalFile
(
f
->
fileName
()));
auto
v
=
m_mainWin
->
openUrl
(
tempFileUrl
);
...
...
@@ -495,7 +498,7 @@ void GitWidget::treeViewContextMenuEvent(QContextMenuEvent *e)
}
else
if
(
act
==
openAtHead
&&
!
untracked
)
{
openAtHEAD
(
idx
.
data
().
toString
());
}
else
if
(
act
==
showDiffAct
&&
!
untracked
)
{
showDiff
(
idx
.
data
().
toString
()
,
staged
);
showDiff
(
file
,
staged
);
}
else
if
(
act
==
launchDifftoolAct
)
{
launchExternalDiffTool
(
idx
.
data
().
toString
(),
staged
);
}
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment