Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
SDK
Dolphin Plugins
Commits
a3e1bb78
Commit
a3e1bb78
authored
Sep 13, 2020
by
Alexander Lohnau
💬
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Port deprecated QProces::start method
parent
5b7ad6b9
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
13 deletions
+18
-13
git/fileviewgitplugin.cpp
git/fileviewgitplugin.cpp
+11
-6
git/gitwrapper.cpp
git/gitwrapper.cpp
+7
-7
No files found.
git/fileviewgitplugin.cpp
View file @
a3e1bb78
...
...
@@ -165,7 +165,7 @@ bool FileViewGitPlugin::beginRetrieval(const QString& directory)
// ----- find path below git base dir -----
QProcess
process
;
process
.
setWorkingDirectory
(
directory
);
process
.
start
(
QLatin1String
(
"git
rev-parse
--show-prefix"
)
);
process
.
start
(
"git"
,
{
"
rev-parse
"
,
"
--show-prefix"
}
);
QString
dirBelowBaseDir
=
""
;
while
(
process
.
waitForReadyRead
())
{
char
buffer
[
512
];
...
...
@@ -177,7 +177,7 @@ bool FileViewGitPlugin::beginRetrieval(const QString& directory)
m_versionInfoHash
.
clear
();
// ----- find files with special status -----
process
.
start
(
QLatin1String
(
"git
status
--porcelain
-z -u
--ignored"
)
);
process
.
start
(
"git"
,
{
"
status
"
,
"
--porcelain
"
,
"-z"
,
"-u"
,
"
--ignored"
}
);
while
(
process
.
waitForReadyRead
())
{
char
buffer
[
1024
];
while
(
readUntilZeroChar
(
&
process
,
buffer
,
sizeof
(
buffer
))
>
0
)
{
...
...
@@ -592,7 +592,13 @@ void FileViewGitPlugin::commit()
tmpCommitMessageFile
.
close
();
QProcess
process
;
process
.
setWorkingDirectory
(
m_contextDir
);
process
.
start
(
QString
(
"git commit"
)
+
(
dialog
.
amend
()
?
" --amend"
:
""
)
+
" -F "
+
tmpCommitMessageFile
.
fileName
());
QStringList
args
=
{
"commit"
};
if
(
dialog
.
amend
())
{
args
<<
"--amend"
;
}
args
<<
"-F"
;
args
<<
tmpCommitMessageFile
.
fileName
();
process
.
start
(
"git"
,
args
);
QString
completedMessage
;
while
(
process
.
waitForReadyRead
()){
char
buffer
[
512
];
...
...
@@ -621,8 +627,7 @@ void FileViewGitPlugin::createTag()
QProcess
process
;
process
.
setWorkingDirectory
(
m_contextDir
);
process
.
setReadChannel
(
QProcess
::
StandardError
);
process
.
start
(
QString
(
"git tag -a -F %1 %2 %3"
).
arg
(
tempTagMessageFile
.
fileName
()).
arg
(
dialog
.
tagName
()).
arg
(
dialog
.
baseBranch
()));
process
.
start
(
"git"
,
{
"tag"
,
"-a"
,
"-F"
,
tempTagMessageFile
.
fileName
(),
dialog
.
tagName
(),
dialog
.
baseBranch
()});
QString
completedMessage
;
bool
gotTagAlreadyExistsMessage
=
false
;
while
(
process
.
waitForReadyRead
())
{
...
...
@@ -684,7 +689,7 @@ void FileViewGitPlugin::pull()
m_command
=
"pull"
;
m_pendingOperation
=
true
;
m_process
.
start
(
QString
(
"git pull %1 %2"
).
arg
(
dialog
.
source
()
).
arg
(
dialog
.
remoteBranch
()
)
);
m_process
.
start
(
"git"
,
{
"pull"
,
dialog
.
source
()
,
dialog
.
remoteBranch
()
}
);
}
}
...
...
git/gitwrapper.cpp
View file @
a3e1bb78
...
...
@@ -49,7 +49,7 @@ QString GitWrapper::userName()
{
QString
result
(
""
);
char
buffer
[
SMALL_BUFFER_SIZE
];
m_process
.
start
(
"git
config
--get
user.name"
);
m_process
.
start
(
"git
"
,
{
"
config
"
,
"
--get
"
,
"
user.name"
}
);
while
(
m_process
.
waitForReadyRead
())
{
if
(
m_process
.
readLine
(
buffer
,
sizeof
(
buffer
))
>
0
)
{
result
=
m_localCodec
->
toUnicode
(
buffer
).
trimmed
();
...
...
@@ -62,7 +62,7 @@ QString GitWrapper::userEmail()
{
QString
result
(
""
);
char
buffer
[
SMALL_BUFFER_SIZE
];
m_process
.
start
(
"git
config
--get
user.email"
);
m_process
.
start
(
"git
"
,
{
"
config
"
,
"
--get
"
,
"
user.email"
}
);
while
(
m_process
.
waitForReadyRead
())
{
if
(
m_process
.
readLine
(
buffer
,
sizeof
(
buffer
))
>
0
)
{
result
=
m_localCodec
->
toUnicode
(
buffer
).
trimmed
();
...
...
@@ -78,7 +78,7 @@ QStringList GitWrapper::branches(int* currentBranchIndex)
if
(
currentBranchIndex
!=
0
)
{
*
currentBranchIndex
=
-
1
;
}
m_process
.
start
(
QLatin1String
(
"git
branch
-a"
)
);
m_process
.
start
(
"git"
,
{
"
branch
"
,
"
-a"
}
);
while
(
m_process
.
waitForReadyRead
())
{
char
buffer
[
BUFFER_SIZE
];
while
(
m_process
.
readLine
(
buffer
,
sizeof
(
buffer
))
>
0
){
...
...
@@ -97,7 +97,7 @@ QStringList GitWrapper::branches(int* currentBranchIndex)
void
GitWrapper
::
tagSet
(
QSet
<
QString
>&
result
)
{
m_process
.
start
(
QLatin1String
(
"git
tag"
)
);
m_process
.
start
(
"git"
,
{
"
tag"
}
);
while
(
m_process
.
waitForReadyRead
())
{
char
buffer
[
BUFFER_SIZE
];
while
(
m_process
.
readLine
(
buffer
,
sizeof
(
buffer
))
>
0
){
...
...
@@ -110,7 +110,7 @@ void GitWrapper::tagSet(QSet<QString>& result)
QStringList
GitWrapper
::
tags
()
{
QStringList
result
;
m_process
.
start
(
QLatin1String
(
"git
tag"
)
);
m_process
.
start
(
"git"
,
{
"
tag"
}
);
while
(
m_process
.
waitForReadyRead
())
{
char
buffer
[
BUFFER_SIZE
];
while
(
m_process
.
readLine
(
buffer
,
sizeof
(
buffer
))
>
0
){
...
...
@@ -124,7 +124,7 @@ QStringList GitWrapper::tags()
inline
QStringList
GitWrapper
::
remotes
(
QLatin1String
lineEnd
)
{
QStringList
result
;
m_process
.
start
(
QLatin1String
(
"git
remote
-v"
)
);
m_process
.
start
(
"git"
,
{
"
remote
"
,
"
-v"
}
);
while
(
m_process
.
waitForReadyRead
())
{
char
buffer
[
BUFFER_SIZE
];
while
(
m_process
.
readLine
(
buffer
,
sizeof
(
buffer
))
>
0
){
...
...
@@ -151,7 +151,7 @@ QString GitWrapper::lastCommitMessage()
{
QString
result
;
char
buffer
[
BUFFER_SIZE
];
m_process
.
start
(
"git
log
-1"
);
m_process
.
start
(
"git
"
,
{
"log"
,
"
-1"
}
);
while
(
m_process
.
waitForReadyRead
())
{
bool
inMessage
=
false
;
QStringList
message
;
...
...
Write
Preview
Markdown
is supported
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