From 355b28ba400e817419cc859b90c21b980f60acfa Mon Sep 17 00:00:00 2001 From: Gerhard Hoffmann Date: Mon, 9 Oct 2023 15:53:35 +0200 Subject: [PATCH] Use current branch name in gitShowReason(), not just master --- git/git_client.cpp | 8 +++----- git/git_client.h | 2 +- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/git/git_client.cpp b/git/git_client.cpp index 49df30c..d551183 100644 --- a/git/git_client.cpp +++ b/git/git_client.cpp @@ -114,16 +114,14 @@ bool GitClient::gitCloneAndCheckoutBranch() { return false; } -QStringList GitClient::gitShowReason() { +QStringList GitClient::gitShowReason(QString branchName) { QStringList lst; if (QDir(m_customerRepository).exists()) { // %h: commit (short form) // %s: commit message // %cI: commit date, strict ISO 8601 format - // Note: use master branch. By convention, there is a ChangeLog file - // in the root of the repository, which has to be always the last file - // to be checked in when the customer repository somehow changed. - Command c("git show origin/master -s --format=\"c=%h m=%s d=%cI\""); + // Note: branch with branchName has to exist: format zg1/zone1 + Command c(QString("git show origin/%1 -s --format=\"c=%h m=%s d=%cI\"").arg(branchName)); if (c.execute(m_customerRepository)) { QString const s = c.getCommandResult().trimmed(); int const c = s.indexOf("c="); diff --git a/git/git_client.h b/git/git_client.h index 63d83e4..18230d4 100644 --- a/git/git_client.h +++ b/git/git_client.h @@ -50,7 +50,7 @@ class GitClient : public QObject { std::optional gitMerge(); QString gitLastCommit(QString fileName); - QStringList gitShowReason(); + QStringList gitShowReason(QString branchName); static QString gitBlob(QString fileName); QString gitCommitForBlob(QString blob); bool gitIsFileTracked(QString file2name);