1 // TortoiseGit - a Windows shell extension for easy version control
3 // Copyright (C) 2008-2013 - TortoiseGit
4 // Copyright (C) 2003-2008 - TortoiseSVN
6 // This program is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU General Public License
8 // as published by the Free Software Foundation; either version 2
9 // of the License, or (at your option) any later version.
11 // This program is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 // GNU General Public License for more details.
16 // You should have received a copy of the GNU General Public License
17 // along with this program; if not, write to the Free Software Foundation,
18 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include "TortoiseProc.h"
22 #include "SysImageList.h"
23 #include "..\Utils\CrashReport.h"
24 #include "CmdLineParser.h"
27 #include "PathUtils.h"
28 #include "UnicodeUtils.h"
29 #include "MessageBox.h"
30 #include "DirFileEnum.h"
31 #include "GitAdminDir.h"
33 #include "SmartHandle.h"
34 #include "Commands\Command.h"
35 #include "..\version.h"
36 #include "JumpListHelpers.h"
37 #include "SinglePropSheetDlg.h"
38 #include "Settings\setmainpage.h"
39 #include "Libraries.h"
40 #include "TaskbarUUID.h"
41 #include "GitConfig.h"
42 #include "SoundUtils.h"
44 #define STRUCT_IOVEC_DEFINED
50 #pragma comment(linker, "\"/manifestdependency:type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
52 BEGIN_MESSAGE_MAP(CTortoiseProcApp
, CWinAppEx
)
53 ON_COMMAND(ID_HELP
, CWinAppEx::OnHelp
)
57 //CString CGit::m_MsysGitPath;
58 //////////////////////////////////////////////////////////////////////////
60 CTortoiseProcApp::CTortoiseProcApp()
63 // prevent from inheriting %GIT_DIR% from parent process by resetting it,
64 // use MSVC function instead of Windows API because MSVC runtime caches environment variables
65 _tputenv(_T("GIT_DIR="));
66 CCrashReport::Instance().AddUserInfoToReport(L
"CommandLine", GetCommandLine());
70 m_bLoadUserToolbars
= FALSE
;
73 m_gdiplusToken
= NULL
;
76 CTortoiseProcApp::~CTortoiseProcApp()
79 SYS_IMAGE_LIST().Cleanup();
82 // The one and only CTortoiseProcApp object
83 CTortoiseProcApp theApp
;
85 CString g_sGroupingUUID
;
88 BOOL
CTortoiseProcApp::CheckMsysGitDir()
90 return g_Git
.CheckMsysGitDir();
92 CCrashReportTGit
crasher(L
"TortoiseGit " _T(APP_X64_STRING
), TGIT_VERMAJOR
, TGIT_VERMINOR
, TGIT_VERMICRO
, TGIT_VERBUILD
, TGIT_VERDATE
);
94 // CTortoiseProcApp initialization
96 BOOL
CTortoiseProcApp::InitInstance()
99 CMFCVisualManager::SetDefaultManager(RUNTIME_CLASS(CMFCVisualManagerWindows
));
100 CMFCButton::EnableWindowsTheming();
102 Gdiplus::GdiplusStartupInput gdiplusStartupInput
;
103 Gdiplus::GdiplusStartup(&m_gdiplusToken
,&gdiplusStartupInput
,NULL
);
105 //set the resource dll for the required language
106 CRegDWORD loc
= CRegDWORD(_T("Software\\TortoiseGit\\LanguageID"), 1033);
109 CStringA langpath
= CStringA(CPathUtils::GetAppParentDirectory());
110 langpath
+= "Languages";
111 HINSTANCE hInst
= NULL
;
114 langDll
.Format(_T("%sLanguages\\TortoiseProc%d.dll"), (LPCTSTR
)CPathUtils::GetAppParentDirectory(), langId
);
116 hInst
= LoadLibrary(langDll
);
118 CString sVer
= _T(STRPRODUCTVER
);
119 CString sFileVer
= CPathUtils::GetVersionFromFile(langDll
);
120 if (sFileVer
.Compare(sVer
)!=0)
127 AfxSetResourceHandle(hInst
);
131 DWORD lid
= SUBLANGID(langId
);
135 langId
= MAKELANGID(PRIMARYLANGID(langId
), lid
);
140 } while ((hInst
== NULL
) && (langId
!= 0));
142 _tcscpy_s(buf
, _T("en"));
144 // MFC uses a help file with the same name as the application by default,
145 // which means we have to change that default to our language specific help files
146 CString sHelppath
= CPathUtils::GetAppDirectory() + _T("TortoiseGit_en.chm");
147 free((void*)m_pszHelpFilePath
);
148 m_pszHelpFilePath
=_tcsdup(sHelppath
);
149 sHelppath
= CPathUtils::GetAppParentDirectory() + _T("Languages\\TortoiseGit_en.chm");
152 CString sLang
= _T("_");
153 if (GetLocaleInfo(MAKELCID(langId
, SORT_DEFAULT
), LOCALE_SISO639LANGNAME
, buf
, _countof(buf
)))
156 sHelppath
.Replace(_T("_en"), sLang
);
157 if (PathFileExists(sHelppath
))
159 free((void*)m_pszHelpFilePath
);
160 m_pszHelpFilePath
=_tcsdup(sHelppath
);
164 sHelppath
.Replace(sLang
, _T("_en"));
165 if (GetLocaleInfo(MAKELCID(langId
, SORT_DEFAULT
), LOCALE_SISO3166CTRYNAME
, buf
, _countof(buf
)))
169 sHelppath
.Replace(_T("_en"), sLang
);
170 if (PathFileExists(sHelppath
))
172 free((void*)m_pszHelpFilePath
);
173 m_pszHelpFilePath
=_tcsdup(sHelppath
);
177 sHelppath
.Replace(sLang
, _T("_en"));
179 DWORD lid
= SUBLANGID(langId
);
183 langId
= MAKELANGID(PRIMARYLANGID(langId
), lid
);
188 setlocale(LC_ALL
, "");
190 if(!CheckMsysGitDir())
192 UINT ret
= CMessageBox::Show(NULL
, IDS_PROC_NOMSYSGIT
, IDS_APPNAME
, 3, IDI_HAND
, IDS_PROC_SETMSYSGITPATH
, IDS_PROC_GOTOMSYSGITWEBSITE
, IDS_ABORTBUTTON
);
195 ShellExecute(NULL
, NULL
, _T("http://code.google.com/p/msysgit/"), NULL
, NULL
, SW_SHOW
);
199 // open settings dialog
200 CSinglePropSheetDlg(CString(MAKEINTRESOURCE(IDS_PROC_SETTINGS_TITLE
)), new CSetMainPage(), this->GetMainWnd()).DoModal();
204 if (CAppUtils::GetMsysgitVersion() < 0x01070a00)
206 int ret
= CMessageBox::ShowCheck(NULL
, IDS_PROC_OLDMSYSGIT
, IDS_APPNAME
, 1, IDI_EXCLAMATION
, IDS_PROC_GOTOMSYSGITWEBSITE
, IDS_ABORTBUTTON
, IDS_IGNOREBUTTON
, _T("OldMsysgitVersionWarning"), IDS_PROC_NOTSHOWAGAINIGNORE
);
209 CMessageBox::RemoveRegistryKey(_T("OldMsysgitVersionWarning")); // only store answer if it is "Ignore"
210 ShellExecute(NULL
, NULL
, _T("http://code.google.com/p/msysgit/"), NULL
, NULL
, SW_SHOW
);
215 CMessageBox::RemoveRegistryKey(_T("OldMsysgitVersionWarning")); // only store answer if it is "Ignore"
220 // InitCommonControls() is required on Windows XP if an application
221 // manifest specifies use of ComCtl32.dll version 6 or later to enable
222 // visual styles. Otherwise, any window creation will fail.
224 INITCOMMONCONTROLSEX used
= {
225 sizeof(INITCOMMONCONTROLSEX
),
226 ICC_ANIMATE_CLASS
| ICC_BAR_CLASSES
| ICC_COOL_CLASSES
| ICC_DATE_CLASSES
|
227 ICC_HOTKEY_CLASS
| ICC_INTERNET_CLASSES
| ICC_LISTVIEW_CLASSES
|
228 ICC_NATIVEFNTCTL_CLASS
| ICC_PAGESCROLLER_CLASS
| ICC_PROGRESS_CLASS
|
229 ICC_TAB_CLASSES
| ICC_TREEVIEW_CLASSES
| ICC_UPDOWN_CLASS
|
230 ICC_USEREX_CLASSES
| ICC_WIN95_CLASSES
232 InitCommonControlsEx(&used
);
234 AfxEnableControlContainer();
236 CWinAppEx::InitInstance();
237 SetRegistryKey(_T("TortoiseGit"));
238 AfxGetApp()->m_pszProfileName
= _tcsdup(_T("TortoiseProc")); // w/o this ResizableLib will store data under TortoiseGitProc which is not compatible with older versions
240 CCmdLineParser
parser(AfxGetApp()->m_lpCmdLine
);
243 CString sVal
= parser
.GetVal(_T("hwnd"));
245 hWndExplorer
= (HWND
)_ttoi64(sVal
);
247 while (GetParent(hWndExplorer
)!=NULL
)
248 hWndExplorer
= GetParent(hWndExplorer
);
249 if (!IsWindow(hWndExplorer
))
254 // if HKCU\Software\TortoiseGit\Debug is not 0, show our command line
256 if (CRegDWORD(_T("Software\\TortoiseGit\\Debug"), FALSE
)==TRUE
)
257 AfxMessageBox(AfxGetApp()->m_lpCmdLine
, MB_OK
| MB_ICONINFORMATION
);
259 if ( parser
.HasKey(_T("path")) && parser
.HasKey(_T("pathfile")))
261 CMessageBox::Show(NULL
, IDS_ERR_INVALIDPATH
, IDS_APPNAME
, MB_ICONERROR
);
265 CTGitPath cmdLinePath
;
266 CTGitPathList pathList
;
267 if (g_sGroupingUUID
.IsEmpty())
268 g_sGroupingUUID
= parser
.GetVal(L
"groupuuid");
269 if ( parser
.HasKey(_T("pathfile")) )
272 CString sPathfileArgument
= CPathUtils::GetLongPathname(parser
.GetVal(_T("pathfile")));
274 cmdLinePath
.SetFromUnknown(sPathfileArgument
);
275 if (pathList
.LoadFromFile(cmdLinePath
)==false)
276 return FALSE
; // no path specified!
277 if ( parser
.HasKey(_T("deletepathfile")) )
279 // We can delete the temporary path file, now that we've loaded it
280 ::DeleteFile(cmdLinePath
.GetWinPath());
282 // This was a path to a temporary file - it's got no meaning now, and
283 // anybody who uses it again is in for a problem...
290 CString sPathArgument
= CPathUtils::GetLongPathname(parser
.GetVal(_T("path")));
291 if (parser
.HasKey(_T("expaths")))
293 // an /expaths param means we're started via the buttons in our Win7 library
294 // and that means the value of /expaths is the current directory, and
295 // the selected paths are then added as additional parameters but without a key, only a value
297 // because of the "strange treatment of quotation marks and backslashes by CommandLineToArgvW"
298 // we have to escape the backslashes first. Since we're only dealing with paths here, that's
300 // Without this, a command line like:
301 // /command:commit /expaths:"D:\" "D:\Utils"
302 // would fail because the "D:\" is treated as the backslash being the escape char for the quotation
303 // mark and we'd end up with:
304 // argv[1] = /command:commit
305 // argv[2] = /expaths:D:" D:\Utils
306 // See here for more details: http://blogs.msdn.com/b/oldnewthing/archive/2010/09/17/10063629.aspx
307 CString cmdLine
= GetCommandLineW();
308 cmdLine
.Replace(L
"\\", L
"\\\\");
310 LPWSTR
*szArglist
= CommandLineToArgvW(cmdLine
, &nArgs
);
313 // argument 0 is the process path, so start with 1
314 for (int i
= 1; i
< nArgs
; ++i
)
316 if (szArglist
[i
][0] != '/')
318 if (!sPathArgument
.IsEmpty())
319 sPathArgument
+= '*';
320 sPathArgument
+= szArglist
[i
];
323 sPathArgument
.Replace(L
"\\\\", L
"\\");
325 LocalFree(szArglist
);
327 if (sPathArgument
.IsEmpty() && parser
.HasKey(L
"path"))
329 CMessageBox::Show(hWndExplorer
, IDS_ERR_INVALIDPATH
, IDS_APPNAME
, MB_ICONERROR
);
332 int asterisk
= sPathArgument
.Find('*');
333 cmdLinePath
.SetFromUnknown(asterisk
>= 0 ? sPathArgument
.Left(asterisk
) : sPathArgument
);
334 pathList
.LoadFromAsteriskSeparatedString(sPathArgument
);
337 if (pathList
.GetCount() == 0) {
338 pathList
.AddPath(CTGitPath::CTGitPath(g_Git
.m_CurrentDir
));
341 // Subversion sometimes writes temp files to the current directory!
342 // Since TSVN doesn't need a specific CWD anyway, we just set it
343 // to the users temp folder: that way, Subversion is guaranteed to
344 // have write access to the CWD
346 DWORD len
= GetCurrentDirectory(0, NULL
);
349 std::unique_ptr
<TCHAR
[]> originalCurrentDirectory(new TCHAR
[len
]);
350 if (GetCurrentDirectory(len
, originalCurrentDirectory
.get()))
352 sOrigCWD
= originalCurrentDirectory
.get();
353 sOrigCWD
= CPathUtils::GetLongPathname(sOrigCWD
);
356 TCHAR pathbuf
[MAX_PATH
];
357 GetTortoiseGitTempPath(MAX_PATH
, pathbuf
);
358 SetCurrentDirectory(pathbuf
);
361 CheckForNewerVersion();
363 if (parser
.HasVal(_T("configdir")))
365 // the user can override the location of the Subversion config directory here
366 CString sConfigDir
= parser
.GetVal(_T("configdir"));
367 // g_GitGlobal.SetConfigDir(sConfigDir);
370 CAutoGeneralHandle TGitMutex
= ::CreateMutex(NULL
, FALSE
, _T("TortoiseGitProc.exe"));
371 if (!g_Git
.SetCurrentDir(cmdLinePath
.GetWinPathString(), parser
.HasKey(_T("submodule")) == TRUE
))
373 for (int i
= 0; i
< pathList
.GetCount(); ++i
)
374 if(g_Git
.SetCurrentDir(pathList
[i
].GetWinPath()))
378 if(!g_Git
.m_CurrentDir
.IsEmpty())
380 sOrigCWD
= g_Git
.m_CurrentDir
;
381 SetCurrentDirectory(g_Git
.m_CurrentDir
);
384 if (g_sGroupingUUID
.IsEmpty())
386 CRegStdDWORD groupSetting
= CRegStdDWORD(_T("Software\\TortoiseGit\\GroupTaskbarIconsPerRepo"), 3);
387 switch (DWORD(groupSetting
))
391 // implemented differently to TortoiseSVN atm
397 if (g_GitAdminDir
.HasAdminDir(g_Git
.m_CurrentDir
, true, &wcroot
))
400 CStringA
wcRootA(wcroot
);
401 if (!git_odb_hash(&oid
, wcRootA
.GetBuffer(), wcRootA
.GetLength(), GIT_OBJ_BLOB
))
404 git_oid_tostr(hash
.GetBufferSetLength(GIT_OID_HEXSZ
+ 1), GIT_OID_HEXSZ
+ 1, &oid
);
405 hash
.ReleaseBuffer();
406 g_sGroupingUUID
= hash
;
413 CString sAppID
= GetTaskIDPerUUID(g_sGroupingUUID
).c_str();
414 InitializeJumpList(sAppID
);
415 EnsureGitLibrary(false);
421 // requires CWD to be set
422 CGit::m_LogEncode
= CAppUtils::GetLogOutputEncode();
424 // make sure all config files are read in order to check that none contains an error
425 g_Git
.GetConfigValue(_T("doesnot.exist"));
434 UINT choice
= CMessageBox::Show(hWndExplorer
, err
, _T("TortoiseGit"), 1, IDI_ERROR
, CString(MAKEINTRESOURCE(IDS_PROC_EDITLOCALGITCONFIG
)), CString(MAKEINTRESOURCE(IDS_PROC_EDITGLOBALGITCONFIG
)), CString(MAKEINTRESOURCE(IDS_ABORTBUTTON
)));
437 // open the config file with alternative editor
438 CAppUtils::LaunchAlternativeEditor(g_Git
.GetGitLocalConfig());
440 else if (choice
== 2)
442 // open the global config file with alternative editor
443 CAppUtils::LaunchAlternativeEditor(g_Git
.GetGitGlobalConfig());
449 // execute the requested command
450 CommandServer server
;
451 Command
* cmd
= server
.GetCommand(parser
.GetVal(_T("command")));
454 cmd
->SetExplorerHwnd(hWndExplorer
);
456 cmd
->SetParser(parser
);
457 cmd
->SetPaths(pathList
, cmdLinePath
);
459 retSuccess
= cmd
->Execute();
463 // Look for temporary files left around by TortoiseSVN and
464 // remove them. But only delete 'old' files because some
465 // apps might still be needing the recent ones.
467 DWORD len
= GetTortoiseGitTempPath(0, NULL
);
468 std::unique_ptr
<TCHAR
[]> path(new TCHAR
[len
+ 100]);
469 len
= GetTortoiseGitTempPath (len
+ 100, path
.get());
472 CDirFileEnum
finder(path
.get());
474 ::GetSystemTimeAsFileTime(&systime_
);
475 __int64 systime
= (((_int64
)systime_
.dwHighDateTime
)<<32) | ((__int64
)systime_
.dwLowDateTime
);
478 while (finder
.NextFile(filepath
, &isDir
))
480 HANDLE hFile
= ::CreateFile(filepath
, GENERIC_READ
, FILE_SHARE_READ
, NULL
, OPEN_EXISTING
, isDir
? FILE_FLAG_BACKUP_SEMANTICS
: NULL
, NULL
);
481 if (hFile
!= INVALID_HANDLE_VALUE
)
483 FILETIME createtime_
;
484 if (::GetFileTime(hFile
, &createtime_
, NULL
, NULL
))
486 ::CloseHandle(hFile
);
487 __int64 createtime
= (((_int64
)createtime_
.dwHighDateTime
)<<32) | ((__int64
)createtime_
.dwLowDateTime
);
488 if ((createtime
+ 864000000000) < systime
) //only delete files older than a day
490 ::SetFileAttributes(filepath
, FILE_ATTRIBUTE_NORMAL
);
492 ::RemoveDirectory(filepath
);
494 ::DeleteFile(filepath
);
498 ::CloseHandle(hFile
);
504 // Since the dialog has been closed, return FALSE so that we exit the
505 // application, rather than start the application's message pump.
509 void CTortoiseProcApp::CheckUpgrade()
511 CRegString regVersion
= CRegString(_T("Software\\TortoiseGit\\CurrentVersion"));
512 CString sVersion
= regVersion
;
513 if (sVersion
.Compare(_T(STRPRODUCTVER
))==0)
515 // we're starting the first time with a new version!
518 int pos
= sVersion
.Find('.');
521 lVersion
= (_ttol(sVersion
.Left(pos
))<<24);
522 lVersion
|= (_ttol(sVersion
.Mid(pos
+1))<<16);
523 pos
= sVersion
.Find('.', pos
+1);
524 lVersion
|= (_ttol(sVersion
.Mid(pos
+1))<<8);
528 pos
= sVersion
.Find(',');
531 lVersion
= (_ttol(sVersion
.Left(pos
))<<24);
532 lVersion
|= (_ttol(sVersion
.Mid(pos
+1))<<16);
533 pos
= sVersion
.Find(',', pos
+1);
534 lVersion
|= (_ttol(sVersion
.Mid(pos
+1))<<8);
538 if (lVersion
<= 0x01080202)
540 CSoundUtils::RegisterTGitSounds();
541 // upgrade to 1.8.3: force recreation of all diff scripts.
542 CAppUtils::SetupDiffScripts(true, CString());
545 if (lVersion
<= 0x01080100)
547 if (CRegStdDWORD(_T("Software\\TortoiseGit\\LogTopoOrder"), TRUE
) == FALSE
)
548 CRegStdDWORD(_T("Software\\TortoiseGit\\LogOrderBy")) = 0;
550 // smoothly migrate broken msysgit path settings
551 CString oldmsysGitSetting
= CRegString(REG_MSYSGIT_PATH
);
552 oldmsysGitSetting
.TrimRight(_T("\\"));
553 CString right
= oldmsysGitSetting
.Right(4);
554 if (oldmsysGitSetting
.GetLength() > 4 && oldmsysGitSetting
.Right(4) == _T("\\cmd"))
556 CString newPath
= oldmsysGitSetting
.Mid(0, oldmsysGitSetting
.GetLength() - 3) + _T("bin");
557 if (PathFileExists(newPath
+ _T("\\git.exe")))
559 CRegString(REG_MSYSGIT_PATH
) = newPath
;
560 g_Git
.m_bInitialized
= FALSE
;
561 g_Git
.CheckMsysGitDir();
566 if (lVersion
<= 0x01040000)
568 CRegStdDWORD(_T("Software\\TortoiseGit\\OwnerdrawnMenus")).removeValue();
571 if (lVersion
<= 0x01070600)
576 CRegStdDWORD(_T("Software\\TortoiseGit\\ConvertBase")).removeValue();
577 CRegStdDWORD(_T("Software\\TortoiseGit\\DiffProps")).removeValue();
578 if (CRegStdDWORD(_T("Software\\TortoiseGit\\CheckNewer"), TRUE
) == FALSE
)
579 CRegStdDWORD(_T("Software\\TortoiseGit\\VersionCheck")) = FALSE
;
582 if (lVersion
<= 0x01070E00)
584 CRegStdDWORD(_T("Software\\TortoiseGit\\CheckNewer")).removeValue();
586 CAppUtils::SetupDiffScripts(false, CString());
588 // set the current version so we don't come here again until the next update!
589 regVersion
= _T(STRPRODUCTVER
);
592 void CTortoiseProcApp::InitializeJumpList(const CString
& appid
)
594 // for Win7 : use a custom jump list
597 DeleteJumpList(appid
);
598 DoInitializeJumpList(appid
);
602 void CTortoiseProcApp::DoInitializeJumpList(const CString
& appid
)
604 ATL::CComPtr
<ICustomDestinationList
> pcdl
;
605 HRESULT hr
= pcdl
.CoCreateInstance(CLSID_DestinationList
, NULL
, CLSCTX_INPROC_SERVER
);
609 hr
= pcdl
->SetAppID(appid
);
614 ATL::CComPtr
<IObjectArray
> poaRemoved
;
615 hr
= pcdl
->BeginList(&uMaxSlots
, IID_PPV_ARGS(&poaRemoved
));
619 ATL::CComPtr
<IObjectCollection
> poc
;
620 hr
= poc
.CoCreateInstance(CLSID_EnumerableObjectCollection
, NULL
, CLSCTX_INPROC_SERVER
);
624 CString sTemp
= CString(MAKEINTRESOURCE(IDS_MENUSETTINGS
));
627 ATL::CComPtr
<IShellLink
> psl
;
628 hr
= CreateShellLink(_T("/command:settings"), (LPCTSTR
)sTemp
, 20, &psl
);
632 sTemp
= CString(MAKEINTRESOURCE(IDS_MENUHELP
));
634 psl
.Release(); // Need to release the object before calling operator&()
635 hr
= CreateShellLink(_T("/command:help"), (LPCTSTR
)sTemp
, 19, &psl
);
640 ATL::CComPtr
<IObjectArray
> poa
;
641 hr
= poc
.QueryInterface(&poa
);
643 pcdl
->AppendCategory((LPCTSTR
)CString(MAKEINTRESOURCE(IDS_PROC_TASKS
)), poa
);
648 int CTortoiseProcApp::ExitInstance()
650 Gdiplus::GdiplusShutdown(m_gdiplusToken
);
652 CWinAppEx::ExitInstance();
658 void CTortoiseProcApp::CheckForNewerVersion()
660 // check for newer versions
661 if (CRegDWORD(_T("Software\\TortoiseGit\\VersionCheck"), TRUE
) != FALSE
)
667 if ((now
!= 0) && (localtime_s(&ptm
, &now
)==0))
670 // Check daily for new preview releases
671 CRegDWORD oldday
= CRegDWORD(_T("Software\\TortoiseGit\\CheckNewerDay"), (DWORD
)-1);
672 if (((DWORD
)oldday
) == -1)
673 oldday
= ptm
.tm_yday
;
676 if ((DWORD
)oldday
!= (DWORD
)ptm
.tm_yday
)
678 oldday
= ptm
.tm_yday
;
681 // we don't calculate the real 'week of the year' here
682 // because just to decide if we should check for an update
683 // that's not needed.
684 week
= ptm
.tm_yday
/ 7;
686 CRegDWORD oldweek
= CRegDWORD(_T("Software\\TortoiseGit\\CheckNewerWeek"), (DWORD
)-1);
687 if (((DWORD
)oldweek
) == -1)
688 oldweek
= week
; // first start of TortoiseProc, no update check needed
691 if ((DWORD
)week
!= oldweek
)
695 CAppUtils::RunTortoiseGitProc(_T("/command:updatecheck"), false, false);