Git: Expand commit template relative to repository directory

if it is a relative file specification.
Task-number: QTCREATORBUG-451
This commit is contained in:
Friedemann Kleint
2009-12-14 15:15:45 +01:00
parent 6cdb58aac2
commit 304d398357

View File

@@ -749,8 +749,12 @@ bool GitClient::getCommitData(const QString &workingDirectory,
d->panelData.email = readConfigValue(workingDirectory, QLatin1String("user.email"));
// Get the commit template
const QString templateFilename = readConfigValue(workingDirectory, QLatin1String("commit.template"));
QString templateFilename = readConfigValue(workingDirectory, QLatin1String("commit.template"));
if (!templateFilename.isEmpty()) {
// Make relative to repository
const QFileInfo templateFileInfo(templateFilename);
if (templateFileInfo.isRelative())
templateFilename = repoDirectory + QLatin1Char('/') + templateFilename;
QFile templateFile(templateFilename);
if (templateFile.open(QIODevice::ReadOnly|QIODevice::Text)) {
*commitTemplate = QString::fromLocal8Bit(templateFile.readAll());