From 304d39835707824b5837754749721bbd1109e21c Mon Sep 17 00:00:00 2001
From: Friedemann Kleint <Friedemann.Kleint@nokia.com>
Date: Mon, 14 Dec 2009 15:15:45 +0100
Subject: [PATCH] Git: Expand commit template relative to repository directory

if it is a relative file specification.
Task-number: QTCREATORBUG-451
---
 src/plugins/git/gitclient.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/src/plugins/git/gitclient.cpp b/src/plugins/git/gitclient.cpp
index cc1f2bdfa9d..cca432cbabc 100644
--- a/src/plugins/git/gitclient.cpp
+++ b/src/plugins/git/gitclient.cpp
@@ -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());
-- 
GitLab