private void DiffToolFix_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(CheckSettingsLogic.GetGlobalDiffToolFromConfig())) { if (MessageBox.Show(this, _noDiffToolConfigured.Text, _noDiffToolConfiguredCaption.Text, MessageBoxButtons.YesNo) == DialogResult.Yes) { _checkSettingsLogic.SolveDiffToolForKDiff(); _settingsPageHost.LoadAll(); // apply settings to dialog controls (otherwise the later called SaveAndRescan_Click would overwrite settings again) } else { GotoPageGlobalSettings(); return; } } if (CheckSettingsLogic.GetGlobalDiffToolFromConfig().Equals("kdiff3", StringComparison.CurrentCultureIgnoreCase)) { _checkSettingsLogic.SolveDiffToolPathForKDiff(); } if (CheckSettingsLogic.GetGlobalDiffToolFromConfig().Equals("kdiff3", StringComparison.CurrentCultureIgnoreCase) && string.IsNullOrEmpty(_gitModule.GetGlobalSetting("difftool.kdiff3.path"))) { MessageBox.Show(this, _kdiff3NotFoundAuto.Text); GotoPageGlobalSettings(); return; } SaveAndRescan_Click(null, null); }
private bool CheckDiffToolConfiguration() { DiffTool.Visible = true; if (string.IsNullOrEmpty(CheckSettingsLogic.GetGlobalDiffToolFromConfig())) { DiffTool.BackColor = Color.LightSalmon; DiffTool_Fix.Visible = true; DiffTool.Text = _adviceDiffToolConfiguration.Text; return(false); } if (EnvUtils.RunningOnWindows()) { if (CheckSettingsLogic.GetGlobalDiffToolFromConfig().Equals("kdiff3", StringComparison.CurrentCultureIgnoreCase)) { string p = _gitModule.GetGlobalSetting("difftool.kdiff3.path"); if (string.IsNullOrEmpty(p) || !File.Exists(p)) { DiffTool.BackColor = Color.LightSalmon; DiffTool.Text = _kdiffAsDiffConfiguredButNotFound.Text; DiffTool_Fix.Visible = true; return(false); } DiffTool.BackColor = Color.LightGreen; DiffTool.Text = _kdiffAsDiffConfigured.Text; DiffTool_Fix.Visible = false; return(true); } } string difftool = CheckSettingsLogic.GetGlobalDiffToolFromConfig(); DiffTool.BackColor = Color.LightGreen; DiffTool.Text = String.Format(_diffToolXConfigured.Text, difftool); DiffTool_Fix.Visible = false; return(true); }
protected override void OnLoadSettings() { ConfigFile globalConfig = GitCommandHelpers.GetGlobalConfig(); _commonLogic.EncodingToCombo(_gitModule.GetFilesEncoding(false), Global_FilesEncoding); GlobalUserName.Text = globalConfig.GetValue("user.name"); GlobalUserEmail.Text = globalConfig.GetValue("user.email"); GlobalEditor.Text = globalConfig.GetPathValue("core.editor"); GlobalMergeTool.Text = globalConfig.GetValue("merge.tool"); CommitTemplatePath.Text = globalConfig.GetValue("commit.template"); if (!string.IsNullOrEmpty(GlobalMergeTool.Text)) { MergetoolPath.Text = globalConfig.GetPathValue(string.Format("mergetool.{0}.path", GlobalMergeTool.Text)); } if (!string.IsNullOrEmpty(GlobalMergeTool.Text)) { MergeToolCmd.Text = globalConfig.GetPathValue(string.Format("mergetool.{0}.cmd", GlobalMergeTool.Text)); } GlobalDiffTool.Text = CheckSettingsLogic.GetGlobalDiffToolFromConfig(); if (!string.IsNullOrEmpty(GlobalDiffTool.Text)) { DifftoolPath.Text = globalConfig.GetPathValue(string.Format("difftool.{0}.path", GlobalDiffTool.Text)); } if (!string.IsNullOrEmpty(GlobalDiffTool.Text)) { DifftoolCmd.Text = globalConfig.GetPathValue(string.Format("difftool.{0}.cmd", GlobalDiffTool.Text)); } CommonLogic.SetCheckboxFromString(GlobalKeepMergeBackup, globalConfig.GetValue("mergetool.keepBackup")); string globalAutocrlf = string.Empty; if (globalConfig.HasValue("core.autocrlf")) { globalAutocrlf = globalConfig.GetValue("core.autocrlf").ToLower(); } else if (!string.IsNullOrEmpty(Settings.GitBinDir)) { try { //the following lines only work for msysgit (i think). MSysgit has a config file //in the etc directory which is checked after the local and global config. In //practice this is only used to core.autocrlf. If there are more cases, we might //need to consider a better solution. var configFile = new ConfigFile(Path.GetDirectoryName(Settings.GitBinDir).Replace("bin", "etc\\gitconfig"), false); globalAutocrlf = configFile.GetValue("core.autocrlf").ToLower(); } catch { } } globalAutoCrlfFalse.Checked = globalAutocrlf == "false"; globalAutoCrlfInput.Checked = globalAutocrlf == "input"; globalAutoCrlfTrue.Checked = globalAutocrlf == "true"; }