Skip to content

Commit

Permalink
Add confirmation for force push
Browse files Browse the repository at this point in the history
  • Loading branch information
gdsmith committed Aug 31, 2017
1 parent 51a2fda commit ef762a6
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Support/app/controllers/remote_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@

class RemoteController < ApplicationController
ALL_REMOTES = "...all remotes..."
FORCE_PUSH_YES = 'Yes, force push'
FORCE_PUSH_NO = 'No, just push normally'
FORCE_PUSH_CANCEL = 'Cancel'

include SubmoduleHelper::Update
include SubmoduleHelper
Expand Down Expand Up @@ -81,6 +84,14 @@ def push
output_show_html and return
end

case TextMate::UI.alert(:warning, "Force push this branch?", "Force pushing to #{branch.name} branch will OVERWRITE the remote branch, are you sure you want to continue?", FORCE_PUSH_YES, FORCE_PUSH_NO, FORCE_PUSH_CANCEL)
when FORCE_PUSH_CANCEL
puts '<h1>Push aborted</h1><p>That was a close one!</p>'
output_show_html and return
when FORCE_PUSH_NO
force = false
end if force

title = "Push"
title = "Force "+title if force

Expand Down

0 comments on commit ef762a6

Please sign in to comment.