diff options
| author | hjk <hjk@qt.io> | 2025-04-24 09:53:54 +0200 |
|---|---|---|
| committer | hjk <hjk@qt.io> | 2025-04-24 10:17:44 +0000 |
| commit | 6e552e43416df72299194831e158ca86da3d89d6 (patch) | |
| tree | 3ec187640c87c28ad5b539ab987c4dfcec0e07b9 /src/plugins/git/gitplugin.cpp | |
| parent | 472134a39f818d1ac78ca6354a4780d14d28548f (diff) | |
Git: Return Result<CommitData> from GitClient::getCommitData()
... and make the template part of CommitData to remove the need
of "out" parameters.
Change-Id: I1d28e71392bd08e13970fc6c1c8cefac0079b094
Reviewed-by: David Schulz <david.schulz@qt.io>
Diffstat (limited to 'src/plugins/git/gitplugin.cpp')
| -rw-r--r-- | src/plugins/git/gitplugin.cpp | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/plugins/git/gitplugin.cpp b/src/plugins/git/gitplugin.cpp index 5aa849647dd..05bf7016857 100644 --- a/src/plugins/git/gitplugin.cpp +++ b/src/plugins/git/gitplugin.cpp @@ -1376,12 +1376,12 @@ void GitPluginPrivate::startCommit(CommitType commitType) const VcsBasePluginState state = currentState(); QTC_ASSERT(state.hasTopLevel(), return); - QString errorMessage, commitTemplate; - CommitData data(commitType); - if (!gitClient().getCommitData(state.topLevel(), &commitTemplate, data, &errorMessage)) { - VcsOutputWindow::appendError(errorMessage); + const Result<CommitData> res = gitClient().getCommitData(commitType, state.topLevel()); + if (!res) { + VcsOutputWindow::appendError(res.error()); return; } + const CommitData data = res.value(); // Store repository for diff and the original list of // files to be able to unstage files the user unchecks @@ -1393,7 +1393,7 @@ void GitPluginPrivate::startCommit(CommitType commitType) / "commit-msg.XXXXXX"); // Keep the file alive, else it removes self and forgets its name saver.setAutoRemove(false); - saver.write(commitTemplate.toLocal8Bit()); + saver.write(data.commitTemplate.toLocal8Bit()); if (const Result<> res = saver.finalize(); !res) { VcsOutputWindow::appendError(res.error()); return; |
