From dac6d91bb968707cf263fd58f2a252be86b9ef6f Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Fri, 5 Oct 2018 11:47:27 +0200 Subject: [PATCH] Use GetShortHASHLength instead of hard coded number Signed-off-by: Sven Strickroth --- src/TortoiseGitBlame/PropertiesWnd.cpp | 6 +++--- src/TortoiseProc/CommitIsOnRefsDlg.cpp | 4 ++-- src/TortoiseProc/FileDiffDlg.cpp | 4 ++-- src/TortoiseShell/ContextMenu.cpp | 2 +- src/Utils/TempFile.cpp | 6 +++--- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/TortoiseGitBlame/PropertiesWnd.cpp b/src/TortoiseGitBlame/PropertiesWnd.cpp index d81494289..0710c38ca 100644 --- a/src/TortoiseGitBlame/PropertiesWnd.cpp +++ b/src/TortoiseGitBlame/PropertiesWnd.cpp @@ -1,6 +1,6 @@ -// TortoiseGit - a Windows shell extension for easy version control +// TortoiseGit - a Windows shell extension for easy version control -// Copyright (C) 2008-2013, 2015-2016 - TortoiseGit +// Copyright (C) 2008-2013, 2015-2016, 2018 - TortoiseGit // Copyright (C) 2011-2013 Sven Strickroth // This program is free software; you can redistribute it and/or @@ -275,7 +275,7 @@ void CPropertiesWnd::UpdateProperties(GitRevLoglist* pRev) str.Format(L"%u - %s\n%s", i, (LPCTSTR)pRev->m_ParentHash[i].ToString(), (LPCTSTR)parentsubject); - CMFCPropertyGridProperty *pProperty = new CMFCPropertyGridProperty(pRev->m_ParentHash[i].ToString().Left(8), parentsubject, str); + auto pProperty = new CMFCPropertyGridProperty(pRev->m_ParentHash[i].ToString().Left(g_Git.GetShortHASHLength()), parentsubject, str); pProperty->AllowEdit(FALSE); m_ParentGroup->AddSubItem(pProperty); } diff --git a/src/TortoiseProc/CommitIsOnRefsDlg.cpp b/src/TortoiseProc/CommitIsOnRefsDlg.cpp index c1094f67a..728821492 100644 --- a/src/TortoiseProc/CommitIsOnRefsDlg.cpp +++ b/src/TortoiseProc/CommitIsOnRefsDlg.cpp @@ -1,6 +1,6 @@ // TortoiseGit - a Windows shell extension for easy version control -// Copyright (C) 2016-2017 - TortoiseGit +// Copyright (C) 2016-2018 - TortoiseGit // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -515,7 +515,7 @@ LRESULT CCommitIsOnRefsDlg::OnGettingRefsFinished(WPARAM, LPARAM) return 0; } - SetDlgItemText(IDC_STATIC_SUBJECT, m_gitrev.m_CommitHash.ToString().Left(8) + L": " + m_gitrev.GetSubject()); + SetDlgItemText(IDC_STATIC_SUBJECT, m_gitrev.m_CommitHash.ToString().Left(g_Git.GetShortHASHLength()) + L": " + m_gitrev.GetSubject()); if (!m_gitrev.m_CommitHash.IsEmpty()) m_tooltips.AddTool(IDC_STATIC_SUBJECT, CLoglistUtils::FormatDateAndTime(m_gitrev.GetAuthorDate(), DATE_SHORTDATE) + L" " + m_gitrev.GetAuthorName()); diff --git a/src/TortoiseProc/FileDiffDlg.cpp b/src/TortoiseProc/FileDiffDlg.cpp index c0813d943..a00477362 100644 --- a/src/TortoiseProc/FileDiffDlg.cpp +++ b/src/TortoiseProc/FileDiffDlg.cpp @@ -835,7 +835,7 @@ void CFileDiffDlg::SetURLLabels(int mask) { if(mask &0x1) { - SetDlgItemText(IDC_FIRSTURL, m_rev1.m_CommitHash.ToString().Left(8) + L": " + m_rev1.GetSubject()); + SetDlgItemText(IDC_FIRSTURL, m_rev1.m_CommitHash.ToString().Left(g_Git.GetShortHASHLength()) + L": " + m_rev1.GetSubject()); if (!m_rev1.m_CommitHash.IsEmpty()) m_tooltips.AddTool(IDC_FIRSTURL, CLoglistUtils::FormatDateAndTime(m_rev1.GetAuthorDate(), DATE_SHORTDATE) + L" " + m_rev1.GetAuthorName()); @@ -843,7 +843,7 @@ void CFileDiffDlg::SetURLLabels(int mask) if(mask &0x2) { - SetDlgItemText(IDC_SECONDURL,m_rev2.m_CommitHash.ToString().Left(8) + L": " + m_rev2.GetSubject()); + SetDlgItemText(IDC_SECONDURL, m_rev2.m_CommitHash.ToString().Left(g_Git.GetShortHASHLength()) + L": " + m_rev2.GetSubject()); if (!m_rev2.m_CommitHash.IsEmpty()) m_tooltips.AddTool(IDC_SECONDURL, CLoglistUtils::FormatDateAndTime(m_rev2.GetAuthorDate(), DATE_SHORTDATE) + L" " + m_rev2.GetAuthorName()); diff --git a/src/TortoiseShell/ContextMenu.cpp b/src/TortoiseShell/ContextMenu.cpp index 6070930b6..51a56d402 100644 --- a/src/TortoiseShell/ContextMenu.cpp +++ b/src/TortoiseShell/ContextMenu.cpp @@ -567,7 +567,7 @@ void CShellExt::InsertGitMenu(BOOL istop, HMENU menu, UINT pos, UINT_PTR id, UIN break; } if (bIsSha1) - sBranchName = sBranchName.Left(8) + L"..."; + sBranchName = sBranchName.Left(g_Git.GetShortHASHLength()) + L"..."; } // sanity check diff --git a/src/Utils/TempFile.cpp b/src/Utils/TempFile.cpp index 0e913d85a..beacad38b 100644 --- a/src/Utils/TempFile.cpp +++ b/src/Utils/TempFile.cpp @@ -1,6 +1,6 @@ -// TortoiseGit - a Windows shell extension for easy version control +// TortoiseGit - a Windows shell extension for easy version control -// Copyright (C) 2009, 2011-2013, 2015-2016 - TortoiseGit +// Copyright (C) 2009, 2011-2013, 2015-2016, 2018 - TortoiseGit // Copyright (C) 2003-2008 - TortoiseSVN // This program is free software; you can redistribute it and/or @@ -59,7 +59,7 @@ CTGitPath CTempFiles::GetTempFilePath(bool bRemoveAtEnd, const CTGitPath& path / do { if (!hash.IsEmpty()) - possibletempfile.Format(L"%s%s-%s.%3.3x%s", temppath.get(), (LPCTSTR)path.GetBaseFilename(), (LPCTSTR)hash.ToString().Left(7), i, (LPCTSTR)path.GetFileExtension()); + possibletempfile.Format(L"%s%s-%s.%3.3x%s", temppath.get(), (LPCTSTR)path.GetBaseFilename(), (LPCTSTR)hash.ToString().Left(g_Git.GetShortHASHLength()), i, (LPCTSTR)path.GetFileExtension()); else possibletempfile.Format(L"%s%s.%3.3x%s", temppath.get(), (LPCTSTR)path.GetBaseFilename(), i, (LPCTSTR)path.GetFileExtension()); tempfile.SetFromWin(possibletempfile); -- 2.11.4.GIT