From c23a0b08f7b46a1888d959f36ac2287882f06075 Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Mon, 21 May 2012 16:54:53 +0200 Subject: [PATCH] Fixed issue #1193: Not properly handling submodule meta information (.git-file contains relative path) Signed-off-by: Sven Strickroth --- src/Changelog.txt | 1 + src/Git/GitAdminDir.cpp | 9 ++++++++- src/Git/gitindex.h | 15 ++++++++++++--- 3 files changed, 21 insertions(+), 4 deletions(-) diff --git a/src/Changelog.txt b/src/Changelog.txt index ba49ae0ae..46b1f405f 100644 --- a/src/Changelog.txt +++ b/src/Changelog.txt @@ -12,6 +12,7 @@ Released: unreleased * Fixed issue #1162: Sync dialog should use same font as progress dialog (use log font for both) * Fixed issue #1174: Clone Dialog incorrectly extracts name from URL that contains ".git" in the middle * Fixed issue #1184: diff of "Working dir changes" uses incorrect line endings (AutoCrLf=true) + * Fixed issue #1193: Not properly handling submodule meta information (.git-file contains relative path) = Release 1.7.9.0 = Released: 2012-05-05 diff --git a/src/Git/GitAdminDir.cpp b/src/Git/GitAdminDir.cpp index 917802e80..d790c4f7d 100644 --- a/src/Git/GitAdminDir.cpp +++ b/src/Git/GitAdminDir.cpp @@ -206,8 +206,15 @@ bool GitAdminDir::GetAdminDirPath(const CString &projectTopDir, CString &adminDi gitPath = gitPath.Trim().Mid(8); // 8 = len("gitdir: ") gitPath.Replace('/', '\\'); gitPath.TrimRight('\\'); - gitPath.TrimRight(); gitPath.Append(_T("\\")); + if (gitPath.GetLength() > 0 && gitPath[0] == _T('.')) + { + gitPath = projectTopDir + _T("\\") + gitPath; + PathCanonicalize(adminDir.GetBuffer(MAX_PATH), gitPath.GetBuffer()); + adminDir.ReleaseBuffer(); + gitPath.ReleaseBuffer(); + return true; + } adminDir = gitPath; return true; } diff --git a/src/Git/gitindex.h b/src/Git/gitindex.h index e77c4f42b..a6bc7e117 100644 --- a/src/Git/gitindex.h +++ b/src/Git/gitindex.h @@ -614,11 +614,20 @@ public: CString str = CString(buffer); if (str.Left(8) == _T("gitdir: ")) { + str = str.TrimRight().Mid(8); str.Replace(_T("/"), _T("\\")); - str.TrimRight(); str.TrimRight(_T("\\")); - (*this)[thePath] = str.Mid(8) + _T("\\"); - m_reverseLookup[str.Mid(8).MakeLower()] = path; + if (str.GetLength() > 0 && str[0] == _T('.')) + { + str = thePath + _T("\\") + str; + CString newPath; + PathCanonicalize(newPath.GetBuffer(MAX_PATH), str.GetBuffer()); + newPath.ReleaseBuffer(); + str.ReleaseBuffer(); + str = newPath; + } + (*this)[thePath] = str + _T("\\"); + m_reverseLookup[str.MakeLower()] = path; return (*this)[thePath]; } } -- 2.11.4.GIT