diff --git a/GitUI/ApplyPatch.cs b/GitUI/ApplyPatch.cs index 3d13bdcbc..41c8b6083 100644 --- a/GitUI/ApplyPatch.cs +++ b/GitUI/ApplyPatch.cs @@ -226,31 +226,31 @@ namespace PatchApply private void toolStripButton3_Click(object sender, EventArgs e) { - if (MessageBox.Show("Are you sure you want to apply this patch?", "Save", MessageBoxButtons.YesNo) == DialogResult.Yes) - { - patchManager.SavePatch(); - MessageBox.Show("Patch applied!"); - Clear(); - } + //if (MessageBox.Show("Are you sure you want to apply this patch?", "Save", MessageBoxButtons.YesNo) == DialogResult.Yes) + //{ + // patchManager.SavePatch(); + // MessageBox.Show("Patch applied!"); + // Clear(); + //} } private void ApplyPatch_FormClosing(object sender, FormClosingEventArgs e) { - if (patchManager.patches.Count > 0) - { - DialogResult result = MessageBox.Show("There is a patch loaded. Do you want to apply this patch before exit?", "Close", MessageBoxButtons.YesNoCancel); - if (result == DialogResult.Yes) - { - patchManager.SavePatch(); - MessageBox.Show("Patch applied!"); - Clear(); - } - else - if (result == DialogResult.Cancel) - { - e.Cancel = true; - } - } + //if (patchManager.patches.Count > 0) + //{ + // DialogResult result = MessageBox.Show("There is a patch loaded. Do you want to apply this patch before exit?", "Close", MessageBoxButtons.YesNoCancel); + // if (result == DialogResult.Yes) + // { + // patchManager.SavePatch(); + // MessageBox.Show("Patch applied!"); + // Clear(); + // } + // else + // if (result == DialogResult.Cancel) + // { + // e.Cancel = true; + // } + //} } private void ApplyPatch_Load(object sender, EventArgs e) diff --git a/GitUI/MergePatch.Designer.cs b/GitUI/MergePatch.Designer.cs index fe0dee8ed..eb826b960 100644 --- a/GitUI/MergePatch.Designer.cs +++ b/GitUI/MergePatch.Designer.cs @@ -152,6 +152,8 @@ this.Controls.Add(this.BrowsePatch); this.Name = "MergePatch"; this.Text = "Apply patch"; + this.Load += new System.EventHandler(this.MergePatch_Load); + this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MergePatch_FormClosing); this.ResumeLayout(false); this.PerformLayout(); diff --git a/GitUI/MergePatch.cs b/GitUI/MergePatch.cs index d37827eaf..bd27fa37c 100644 --- a/GitUI/MergePatch.cs +++ b/GitUI/MergePatch.cs @@ -78,8 +78,8 @@ namespace GitUI Output.Text = result; if (result.Contains("Patch failed")) { - EnableButtons(); } + EnableButtons(); } private void Mergetool_Click(object sender, EventArgs e) @@ -120,5 +120,21 @@ namespace GitUI FormAddFiles form = new FormAddFiles(); form.Show(); } + + private void MergePatch_Load(object sender, EventArgs e) + { + + } + + private void MergePatch_FormClosing(object sender, FormClosingEventArgs e) + { + if (Directory.Exists(GitCommands.Settings.WorkingDir + ".git\\rebase-apply\\")) + { + if (MessageBox.Show("You are in the middle of a patch apply. You need to resolve, skip or abort this patch.\nAre you sure to exit now?", "Exit", MessageBoxButtons.YesNo) == DialogResult.Yes) + { + e.Cancel = true; + } + } + } } }