From 572519ce22cc264622a859a893d4b71bf7f35a72 Mon Sep 17 00:00:00 2001 From: Shun Tsukamoto Date: Sun, 29 Nov 2020 15:18:34 +0100 Subject: [PATCH] Fixed issue #3517 Revision graph filter does not work Signed-off-by: Shun Tsukamoto Signed-off-by: Sven Strickroth --- src/Changelog.txt | 1 + src/Git/Git.cpp | 9 ++++++--- src/Git/Git.h | 1 + .../RevisionGraph/RevisionGraphDlgFunc.cpp | 22 ++++++++++++++++++---- 4 files changed, 26 insertions(+), 7 deletions(-) diff --git a/src/Changelog.txt b/src/Changelog.txt index 96a5920c9..1b833765c 100644 --- a/src/Changelog.txt +++ b/src/Changelog.txt @@ -21,6 +21,7 @@ Released: unreleased * Fixed issue #3668: "Revert to revision" fails for added files * Fixed issue #3678: Remove deprecated git lfs clone option from clone dialog * Fixed issue #3674: Missing "Add to ignore list" menu on the "Show Log" dialog + * Fixed issue #3517: Revision graph filter does not work = Release 2.11.0 = Released: 2020-10-10 diff --git a/src/Git/Git.cpp b/src/Git/Git.cpp index d05d10cac..8242342e1 100644 --- a/src/Git/Git.cpp +++ b/src/Git/Git.cpp @@ -987,7 +987,8 @@ CString CGit::GetLogCmd(CString range, const CTGitPath* path, int mask, CFilterD if(mask& CGit::LOG_INFO_ALL_BRANCH) { param += L" --all"; - range.Empty(); + if ((mask & LOG_INFO_ALWAYS_APPLY_RANGE) != 0) + range.Empty(); } if (mask& CGit::LOG_INFO_BASIC_REFS) @@ -997,13 +998,15 @@ CString CGit::GetLogCmd(CString range, const CTGitPath* path, int mask, CFilterD param += L" --remotes"; param += L" --glob=stas[h]"; // require at least one glob operator param += L" --glob=bisect"; - range.Empty(); + if ((mask & LOG_INFO_ALWAYS_APPLY_RANGE) != 0) + range.Empty(); } if(mask & CGit::LOG_INFO_LOCAL_BRANCHES) { param += L" --branches"; - range.Empty(); + if ((mask & LOG_INFO_ALWAYS_APPLY_RANGE) != 0) + range.Empty(); } if(mask& CGit::LOG_INFO_DETECT_COPYRENAME) diff --git a/src/Git/Git.h b/src/Git/Git.h index 103c148c0..c65357641 100644 --- a/src/Git/Git.h +++ b/src/Git/Git.h @@ -372,6 +372,7 @@ public: LOG_INFO_LOCAL_BRANCHES = 0x8000, LOG_INFO_BASIC_REFS = 0x10000, LOG_INFO_SPARSE = 0x20000, + LOG_INFO_ALWAYS_APPLY_RANGE = 0x40000, }LOG_INFO_MASK; typedef enum diff --git a/src/TortoiseProc/RevisionGraph/RevisionGraphDlgFunc.cpp b/src/TortoiseProc/RevisionGraph/RevisionGraphDlgFunc.cpp index 79f7e54a0..2b349c245 100644 --- a/src/TortoiseProc/RevisionGraph/RevisionGraphDlgFunc.cpp +++ b/src/TortoiseProc/RevisionGraph/RevisionGraphDlgFunc.cpp @@ -1,7 +1,7 @@ // TortoiseGit - a Windows shell extension for easy version control // Copyright (C) 2003-2011 - TortoiseSVN -// Copyright (C) 2012-2019 - TortoiseGit +// Copyright (C) 2012-2020 - TortoiseGit // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -190,13 +190,27 @@ bool CRevisionGraphWnd::FetchRevisionData this->m_LogCache.ClearAllParent(); this->m_logEntries.ClearAll(); CString range; + DWORD infomask = CGit::LOG_INFO_SIMPILFY_BY_DECORATION | (m_bShowBranchingsMerges ? CGit::LOG_ORDER_TOPOORDER | CGit::LOG_INFO_SPARSE : 0); if (!m_ToRev.IsEmpty() && !m_FromRev.IsEmpty()) range.Format(L"%s..%s", static_cast(g_Git.FixBranchName(m_FromRev)), static_cast(g_Git.FixBranchName(m_ToRev))); else if (!m_ToRev.IsEmpty()) - range = m_ToRev; + range = g_Git.FixBranchName(m_ToRev); else if (!m_FromRev.IsEmpty()) - range = m_FromRev; - DWORD infomask = CGit::LOG_INFO_SIMPILFY_BY_DECORATION | (m_bCurrentBranch ? 0 : m_bLocalBranches ? CGit::LOG_INFO_LOCAL_BRANCHES : CGit::LOG_INFO_ALL_BRANCH) | (m_bShowBranchingsMerges ? CGit::LOG_ORDER_TOPOORDER | CGit::LOG_INFO_SPARSE : 0); + { + if (m_bCurrentBranch) + range.Format(L"^%s HEAD", static_cast(g_Git.FixBranchName(m_FromRev))); + else + { + range.Format(L"^%s", static_cast(g_Git.FixBranchName(m_FromRev))); + if (m_bLocalBranches) + infomask |= CGit::LOG_INFO_ALWAYS_APPLY_RANGE | CGit::LOG_INFO_LOCAL_BRANCHES; + else + infomask |= CGit::LOG_INFO_ALWAYS_APPLY_RANGE | CGit::LOG_INFO_ALL_BRANCH; + } + } + else if (m_ToRev.IsEmpty() && m_FromRev.IsEmpty()) + infomask |= m_bCurrentBranch ? 0 : m_bLocalBranches ? CGit::LOG_INFO_LOCAL_BRANCHES : CGit::LOG_INFO_ALL_BRANCH; + m_logEntries.ParserFromLog(nullptr, 0, infomask, &range); ReloadHashMap(); -- 2.11.4.GIT