private void Branch_DropDown(object sender, EventArgs e) { string realWorkingDir = GitCommands.Settings.WorkingDir; GitCommands.Settings.WorkingDir = Directory.Text; List<GitCommands.GitHead> heads = GitCommands.GitCommands.GetHeads(false); GitCommands.GitHead noHead = new GitCommands.GitHead(); noHead.Name = ""; heads.Insert(0, noHead); Branch.DisplayMember = "Name"; Branch.DataSource = heads; GitCommands.Settings.WorkingDir = realWorkingDir; }
private void Branches_DropDown(object sender, EventArgs e) { if ((PullFromUrl.Checked && string.IsNullOrEmpty(PullSource.Text)) && (PullFromRemote.Checked && string.IsNullOrEmpty(Remotes.Text))) { Branches.DataSource = null; return; } string realWorkingDir = GitCommands.Settings.WorkingDir; try { if (PullFromUrl.Checked) { GitCommands.Settings.WorkingDir = PullSource.Text; } else { GitCommands.Settings.WorkingDir = GitCommands.GitCommands.GetSetting("remote." + Remotes.Text + ".url"); } Branches.DisplayMember = "Name"; List<GitCommands.GitHead> heads = GitCommands.GitCommands.GetHeads(false); GitCommands.GitHead allHead = new GitCommands.GitHead(); allHead.Name = "*"; heads.Insert(0, allHead); GitCommands.GitHead noHead = new GitCommands.GitHead(); noHead.Name = ""; heads.Insert(0, noHead); Branches.DataSource = heads; } finally { GitCommands.Settings.WorkingDir = realWorkingDir; } }