From 2cc416a0d34e8c81595319569c06d3c3fcd3840e Mon Sep 17 00:00:00 2001 From: Sven Strickroth Date: Sat, 28 Sep 2013 01:37:08 +0200 Subject: [PATCH] Add optional support for github-windows and smartgit protocol handlers Signed-off-by: Sven Strickroth --- src/Changelog.txt | 2 ++ src/TortoiseGitSetup/FeaturesFragment.wxi | 12 ++++++++++-- src/TortoiseGitSetup/Includes.wxi | 4 ++++ src/TortoiseGitSetup/StructureFragment.wxi | 12 ++++++++++++ src/TortoiseProc/TortoiseProc.cpp | 24 ++++++++++++++++++++++++ 5 files changed, 52 insertions(+), 2 deletions(-) diff --git a/src/Changelog.txt b/src/Changelog.txt index e0bac36b0..adfe92641 100644 --- a/src/Changelog.txt +++ b/src/Changelog.txt @@ -13,6 +13,8 @@ Released: Unreleased * Add setting to confirm to kill running git process in progress dialog * Added support for tgit://-links to start cloning from browser * Added optional support for git://-links to start cloning from browser + * Added optional support for smartgit:// and github-windows://-links to start cloning from browser + In order to use github-windows://-links from Github, you have to enable them by installing and registering the Github client first == Bug Fixes == * Fixed issue #1859: Log too long when using Switch to New Branch option in Create Branch dialog diff --git a/src/TortoiseGitSetup/FeaturesFragment.wxi b/src/TortoiseGitSetup/FeaturesFragment.wxi index a45bd39d9..dc24e792a 100644 --- a/src/TortoiseGitSetup/FeaturesFragment.wxi +++ b/src/TortoiseGitSetup/FeaturesFragment.wxi @@ -87,8 +87,16 @@ - - + + + + + + + + + + diff --git a/src/TortoiseGitSetup/Includes.wxi b/src/TortoiseGitSetup/Includes.wxi index e599684c0..e93a2790f 100644 --- a/src/TortoiseGitSetup/Includes.wxi +++ b/src/TortoiseGitSetup/Includes.wxi @@ -94,6 +94,8 @@ + + @@ -163,6 +165,8 @@ + + diff --git a/src/TortoiseGitSetup/StructureFragment.wxi b/src/TortoiseGitSetup/StructureFragment.wxi index d88d9f55e..482173887 100644 --- a/src/TortoiseGitSetup/StructureFragment.wxi +++ b/src/TortoiseGitSetup/StructureFragment.wxi @@ -623,6 +623,18 @@ + + + + + + + + + + + + diff --git a/src/TortoiseProc/TortoiseProc.cpp b/src/TortoiseProc/TortoiseProc.cpp index 8e16751ea..b386bf902 100644 --- a/src/TortoiseProc/TortoiseProc.cpp +++ b/src/TortoiseProc/TortoiseProc.cpp @@ -266,6 +266,30 @@ BOOL CTortoiseProcApp::InitInstance() if (CRegDWORD(_T("Software\\TortoiseGit\\Debug"), FALSE)==TRUE) AfxMessageBox(AfxGetApp()->m_lpCmdLine, MB_OK | MB_ICONINFORMATION); + if (parser.HasKey(_T("urlhandler"))) + { + CString url = parser.GetVal(_T("urlhandler")); + if (url.Find(_T("github-windows://openRepo/")) == 0) + { + url = url.Mid(26); // 26 = "github-windows://openRepo/".GetLength() + int questioMark = url.Find('?'); + if (questioMark > 0) + url = url.Left(questioMark); + } + else if (url.Find(_T("smartgit://cloneRepo/")) == 0) + { + url = url.Mid(21); // 21 = "smartgit://cloneRepo/".GetLength() + } + else + { + CMessageBox::Show(NULL, IDS_ERR_INVALIDPATH, IDS_APPNAME, MB_ICONERROR); + return FALSE; + } + CString newCmd; + newCmd.Format(_T("/command:clone /url:\"%s\""), url); + parser = CCmdLineParser(newCmd); + } + if ( parser.HasKey(_T("path")) && parser.HasKey(_T("pathfile"))) { CMessageBox::Show(NULL, IDS_ERR_INVALIDPATH, IDS_APPNAME, MB_ICONERROR); -- 2.11.4.GIT