forked from qt-creator/qt-creator
Git: Expand commit template relative to repository directory
if it is a relative file specification. Task-number: QTCREATORBUG-451
This commit is contained in:
@@ -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());
|
||||||
|
|||||||
Reference in New Issue
Block a user