Skip to content

Commit

Permalink
View effective config
Browse files Browse the repository at this point in the history
Signed-off-by: Sup Yut Sum <ch3cooli@gmail.com>
  • Loading branch information
ch3cooli committed Nov 2, 2019
1 parent cd728e5 commit 3ec7b9d
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 2 deletions.
4 changes: 4 additions & 0 deletions Languages/Tortoise.pot
Original file line number Diff line number Diff line change
Expand Up @@ -1255,6 +1255,10 @@ msgstr ""
msgid "&View"
msgstr ""

#. Resource IDs: (Dialog IDD_SETTINGIT_CONFIG: Control id 1851)
msgid "&View effective config"
msgstr ""

#. Resource IDs: (Dialog IDD_SETTINGSDIALOGS3: Control id 65535)
msgid "&Warn on missing Signed-Off-By on commit"
msgstr ""
Expand Down
1 change: 1 addition & 0 deletions src/Resources/TortoiseProcENG.rc
Original file line number Diff line number Diff line change
Expand Up @@ -1577,6 +1577,7 @@ BEGIN
COMBOBOX IDC_COMBO_SETTINGS_SAFETO,113,156,105,15,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
PUSHBUTTON "Edit &local .git/config",IDC_EDITLOCALGITCONFIG,14,178,90,14
PUSHBUTTON "Edit .tgitconfig",IDC_EDITTGITCONFIG,14,196,90,14
PUSHBUTTON "&View effective config",IDC_VIEWEFFECTIVEGITCONFIG,14,214,90,14
PUSHBUTTON "Edit gl&obal .gitconfig",IDC_EDITGLOBALGITCONFIG,109,178,90,14
PUSHBUTTON "Edit global &XDG git/config",IDC_EDITGLOBALXDGGITCONFIG,109,196,90,14,NOT WS_VISIBLE
PUSHBUTTON "Edit s&ystemwide gitconfig",IDC_EDITSYSTEMGITCONFIG,203,178,90,14
Expand Down
16 changes: 16 additions & 0 deletions src/TortoiseProc/Settings/SettingGitConfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ BEGIN_MESSAGE_MAP(CSettingGitConfig, CPropertyPage)
ON_BN_CLICKED(IDC_EDITGLOBALXDGGITCONFIG, &CSettingGitConfig::OnBnClickedEditglobalxdggitconfig)
ON_BN_CLICKED(IDC_EDITLOCALGITCONFIG, &CSettingGitConfig::OnBnClickedEditlocalgitconfig)
ON_BN_CLICKED(IDC_EDITTGITCONFIG, &CSettingGitConfig::OnBnClickedEdittgitconfig)
ON_BN_CLICKED(IDC_VIEWEFFECTIVEGITCONFIG, &CSettingGitConfig::OnBnClickedVieweffectivegitconfig)
ON_BN_CLICKED(IDC_EDITSYSTEMGITCONFIG, &CSettingGitConfig::OnBnClickedEditsystemgitconfig)
ON_BN_CLICKED(IDC_VIEWSYSTEMGITCONFIG, &CSettingGitConfig::OnBnClickedViewsystemgitconfig)
GITSETTINGS_RADIO_EVENT
Expand Down Expand Up @@ -314,6 +315,21 @@ void CSettingGitConfig::OnBnClickedEdittgitconfig()
}
}

void CSettingGitConfig::OnBnClickedVieweffectivegitconfig()
{
CString err;
CString tempfile = ::GetTempFile();

CString cmd = L"git config -l";
if (g_Git.RunLogFile(cmd, tempfile, &err))
{
CMessageBox::Show(GetSafeHwnd(), L"Could not get effective git config:\n" + err, L"TortoiseGit", MB_OK);
return;
}
::SetFileAttributes(tempfile, FILE_ATTRIBUTE_READONLY);
CAppUtils::LaunchAlternativeEditor(tempfile);
}

void CSettingGitConfig::OnBnClickedEditsystemgitconfig()
{
CString filename = g_Git.GetGitSystemConfig();
Expand Down
1 change: 1 addition & 0 deletions src/TortoiseProc/Settings/SettingGitConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class CSettingGitConfig : public ISettingsPropPage, public CGitSettings
afx_msg void OnBnClickedEditglobalxdggitconfig();
afx_msg void OnBnClickedEditlocalgitconfig();
afx_msg void OnBnClickedEdittgitconfig();
afx_msg void OnBnClickedVieweffectivegitconfig();
GITSETTINGS_RADIO_EVENT_HANDLE;

bool m_bNeedSave;
Expand Down
5 changes: 3 additions & 2 deletions src/TortoiseProc/resource.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//{{NO_DEPENDENCIES}}
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
// Used by d:\TortoiseGit\src\Resources\TortoiseProcENG.rc
//
Expand Down Expand Up @@ -1614,6 +1614,7 @@
#define IDS_LOG_FILTER_BY 1850
#define IDC_STATICELEVATIONNEEDED 1850
#define IDS_LOG_FILTER_PATHS 1851
#define IDC_VIEWEFFECTIVEGITCONFIG 1851
#define IDS_LOG_FILTER_AUTHORS 1852
#define IDS_LOG_FILTER_MESSAGES 1853
#define IDS_LOG_FILTER_REVS 1854
Expand Down Expand Up @@ -2067,7 +2068,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 363
#define _APS_NEXT_COMMAND_VALUE 32875
#define _APS_NEXT_CONTROL_VALUE 1851
#define _APS_NEXT_CONTROL_VALUE 1852
#define _APS_NEXT_SYMED_VALUE 201
#endif
#endif

0 comments on commit 3ec7b9d

Please sign in to comment.