Fixed issue #1750: Repository Browser fails for empty repository
authorSup Yut Sum <ch3cooli@gmail.com>
Sun, 21 Apr 2013 12:04:00 +0000 (21 20:04 +0800)
committerSup Yut Sum <ch3cooli@gmail.com>
Sun, 21 Apr 2013 12:04:00 +0000 (21 20:04 +0800)
Repository Browser should not say error if browsing orphan HEAD, just leave it empty like what Log Dialog does

Signed-off-by: Sup Yut Sum <ch3cooli@gmail.com>
src/Changelog.txt
src/TortoiseProc/RepositoryBrowser.cpp

index f8f6187..0aa743a 100644 (file)
@@ -15,6 +15,7 @@ Released: unreleased
  * Fixed issue #1728: TortoiseGitMerge show fake difference in the same lines if line end falls to 0x40000 byte\r
  * Fixed issue #1741: Push / Pull Dialog URL combo box should not be filled unless enabled\r
  * Fixed issue #1735: diff-xls.vbs not found\r
+ * Fixed issue #1750: Repository Browser fails for empty repository\r
 \r
 = Release 1.8.2.0 =\r
 Released: 2013-03-26\r
index b444944..e1abbd4 100644 (file)
@@ -377,6 +377,18 @@ int CRepositoryBrowser::ReadTree(CShadowFilesTree * treeroot)
                        break;\r
                }\r
 \r
+               if (m_sRevision == _T("HEAD"))\r
+               {\r
+                       ret = git_repository_head_orphan(repository);\r
+                       if (ret == 1)   // is orphan\r
+                               break;\r
+                       else if (ret != 0)\r
+                       {\r
+                               MessageBox(g_Git.GetGitLastErr(_T("Could not check HEAD.")), _T("TortoiseGit"), MB_ICONERROR);\r
+                               break;\r
+                       }\r
+               }\r
+\r
                CGitHash hash;\r
                if (g_Git.GetHash(hash, m_sRevision))\r
                {\r