Skip to content
Snippets Groups Projects
Commit 304d3983 authored by Friedemann Kleint's avatar Friedemann Kleint
Browse files

Git: Expand commit template relative to repository directory

if it is a relative file specification.
Task-number: QTCREATORBUG-451
parent 6cdb58aa
No related branches found
No related tags found
No related merge requests found
...@@ -749,8 +749,12 @@ bool GitClient::getCommitData(const QString &workingDirectory, ...@@ -749,8 +749,12 @@ bool GitClient::getCommitData(const QString &workingDirectory,
d->panelData.email = readConfigValue(workingDirectory, QLatin1String("user.email")); d->panelData.email = readConfigValue(workingDirectory, QLatin1String("user.email"));
// Get the commit template // Get the commit template
const QString templateFilename = readConfigValue(workingDirectory, QLatin1String("commit.template")); QString templateFilename = readConfigValue(workingDirectory, QLatin1String("commit.template"));
if (!templateFilename.isEmpty()) { if (!templateFilename.isEmpty()) {
// Make relative to repository
const QFileInfo templateFileInfo(templateFilename);
if (templateFileInfo.isRelative())
templateFilename = repoDirectory + QLatin1Char('/') + templateFilename;
QFile templateFile(templateFilename); QFile templateFile(templateFilename);
if (templateFile.open(QIODevice::ReadOnly|QIODevice::Text)) { if (templateFile.open(QIODevice::ReadOnly|QIODevice::Text)) {
*commitTemplate = QString::fromLocal8Bit(templateFile.readAll()); *commitTemplate = QString::fromLocal8Bit(templateFile.readAll());
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment