From 2b0660e685242da6ef3b27acd08ca576e53f3d1e Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Sun, 26 Jun 2016 14:53:53 +0200 Subject: [PATCH] Fixed issue #2736: stash list/ pop missing when refs are packed This reuses the fix from commit cad6f37576f02b1070534b8f1857300496934fb6. Signed-off-by: Sven Strickroth --- src/Changelog.txt | 1 + src/Git/TGitPath.cpp | 31 +++++++++++++++++-------------- src/Git/TGitPath.h | 2 +- 3 files changed, 19 insertions(+), 15 deletions(-) diff --git a/src/Changelog.txt b/src/Changelog.txt index dde14da46..ee6de73f8 100644 --- a/src/Changelog.txt +++ b/src/Changelog.txt @@ -18,6 +18,7 @@ Released: unreleased * Fixed issue #2785: Rebase/Cherry-pick with conflict in renamed file fails * Fixed issue #2714: TortoiseGitMerge should redraw if font is changed * Fixed issue #2756: TortoiseGitMerge: Regex Filter doesn't filter from "Previous diff", "Next diff" operation + * Fixed issue #2736: stash list/ pop missing when refs are packed = Release 2.1.0 = Released: 2016-03-26 diff --git a/src/Git/TGitPath.cpp b/src/Git/TGitPath.cpp index e01345dab..3360be854 100644 --- a/src/Git/TGitPath.cpp +++ b/src/Git/TGitPath.cpp @@ -773,7 +773,7 @@ int CTGitPath::GetAdminDirMask() const if (PathFileExists(dotGitPath + _T("MERGE_HEAD"))) status |= ITEMIS_MERGEACTIVE; - if (PathFileExists(dotGitPath + _T("refs\\stash"))) + if (HasStashDir(dotGitPath)) status |= ITEMIS_STASH; if (PathFileExists(dotGitPath + _T("svn"))) @@ -785,22 +785,12 @@ int CTGitPath::GetAdminDirMask() const return status; } -bool CTGitPath::HasStashDir() const +bool CTGitPath::HasStashDir(const CString& dotGitPath) const { - CString topdir; - if(!GitAdminDir::HasAdminDir(GetWinPathString(),&topdir)) - { - return false; - } - - CString dotGitPath; - GitAdminDir::GetAdminDirPath(topdir, dotGitPath); - - if (!!PathFileExists(dotGitPath + _T("refs\\stash"))) + if (PathFileExists(dotGitPath + L"refs\\stash")) return true; - CAutoFile hfile = CreateFile(dotGitPath + _T("packed-refs"), GENERIC_READ, - FILE_SHARE_READ | FILE_SHARE_DELETE | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); + CAutoFile hfile = CreateFile(dotGitPath + L"packed-refs", GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_DELETE | FILE_SHARE_WRITE, nullptr, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, nullptr); if (!hfile) return false; @@ -861,6 +851,19 @@ bool CTGitPath::HasStashDir() const } return false; } + +bool CTGitPath::HasStashDir() const +{ + CString topdir; + if (!GitAdminDir::HasAdminDir(GetWinPathString(), &topdir)) + return false; + + CString dotGitPath; + GitAdminDir::GetAdminDirPath(topdir, dotGitPath); + + return HasStashDir(dotGitPath); +} + bool CTGitPath::HasGitSVNDir() const { CString topdir; diff --git a/src/Git/TGitPath.h b/src/Git/TGitPath.h index 94a00a152..3b89b818a 100644 --- a/src/Git/TGitPath.h +++ b/src/Git/TGitPath.h @@ -287,7 +287,7 @@ private: void UpdateAttributes() const; - + bool HasStashDir(const CString& adminDirPath) const; private: mutable CString m_sBackslashPath; -- 2.11.4.GIT