Git: Respect author and mail mapping

Git allows mapping authors and mail addresses:
https://git-scm.com/docs/gitmailmap

While using this file already worked for (instant)
blame, log and show still used the original values
from the repo. This patch makes the display within
Creator consistent.

Change-Id: I3c0e764c435a505e285941f4fdc91131f85af590
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
This commit is contained in:
Andre Hartmann
2024-02-22 09:19:04 +01:00
committed by André Hartmann
parent faa6ad50c4
commit 1117954950

View File

@@ -69,8 +69,8 @@ const char graphOption[] = "--graph";
const char decorateOption[] = "--decorate";
const char showFormatC[] =
"--pretty=format:commit %H%d%n"
"Author: %an <%ae>, %ad (%ar)%n"
"Committer: %cn <%ce>, %cd (%cr)%n"
"Author: %aN <%aE>, %ad (%ar)%n"
"Committer: %cN <%cE>, %cd (%cr)%n"
"%n"
"%B";
@@ -686,7 +686,7 @@ public:
"--pretty=format:"
"%C(%1)%h%Creset "
"%C(%2)%d%Creset "
"%C(%3)%an%Creset "
"%C(%3)%aN%Creset "
"%C(%4)%s%Creset "
"%C(%5)%ci%Creset"
).arg(commitHash, decoration, authorName, commitSubject, commitDate);
@@ -696,7 +696,7 @@ public:
if (gitHasRgbColors())
graphArgs << formatArg;
else
graphArgs << "--pretty=format:%h %d %an %s %ci";
graphArgs << "--pretty=format:%h %d %aN %s %ci";
return graphArgs;
}
@@ -1021,7 +1021,7 @@ static QStringList normalLogArguments()
const QString logArgs = QStringLiteral(
"--pretty=format:"
"commit %C(%1)%H%Creset %C(%2)%d%Creset%n"
"Author: %C(%3)%an <%ae>%Creset%n"
"Author: %C(%3)%aN <%aE>%Creset%n"
"Date: %C(%4)%cD %Creset%n%n"
"%C(%5)%w(0,4,4)%s%Creset%n%n%b"
).arg(commitHash, decoration, authorName, commitDate, commitSubject);
@@ -1593,7 +1593,7 @@ QString GitClient::synchronousShortDescription(const FilePath &workingDirectory,
const QString quoteReplacement = "_-_";
// Short SHA1, author, subject
const QString defaultShortLogFormat = "%h (%an " + quoteReplacement + "%s";
const QString defaultShortLogFormat = "%h (%aN " + quoteReplacement + "%s";
const int maxShortLogLength = 120;
// Short SHA 1, author, subject
@@ -2569,7 +2569,7 @@ bool GitClient::readDataFromCommit(const FilePath &repoDirectory, const QString
QString *commitTemplate)
{
// Get commit data as "SHA1<lf>author<lf>email<lf>message".
const QStringList arguments = {"log", "--max-count=1", "--pretty=format:%h\n%an\n%ae\n%B", commit};
const QStringList arguments = {"log", "--max-count=1", "--pretty=format:%h\n%aN\n%aE\n%B", commit};
const CommandResult result = vcsSynchronousExec(repoDirectory, arguments, RunFlags::NoOutput);
if (result.result() != ProcessResult::FinishedWithSuccess) {