diff mbox series

[v3,3/4] git-gui: return early when patch fails to apply

Message ID 20190828215725.13376-4-me@yadavpratyush.com (mailing list archive)
State New, archived
Headers show
Series git-gui: Add ability to revert selected hunks and lines | expand

Commit Message

Pratyush Yadav Aug. 28, 2019, 9:57 p.m. UTC
In the procedure apply_or_revert_range_or_line, if the patch does not
apply successfully, a dialog is shown, but execution proceeds after
that. Instead, return early on error so the parts that come after this
don't work on top of an error state.

Signed-off-by: Pratyush Yadav <me@yadavpratyush.com>
---
 lib/diff.tcl | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/lib/diff.tcl b/lib/diff.tcl
index ffca788..0659029 100644
--- a/lib/diff.tcl
+++ b/lib/diff.tcl
@@ -848,6 +848,8 @@  proc apply_or_revert_range_or_line {x y revert} {
 		puts -nonewline $p $wholepatch
 		close $p} err]} {
 		error_popup "$failed_msg\n\n$err"
+		unlock_index
+		return
 	}
 
 	unlock_index