6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# File 'lib/gt/commands/modify.rb', line 6
def self.run(argv)
msg_idx = argv.index("-m")
message = msg_idx ? argv[msg_idx + 1] : nil
raise GT::UserError, "Usage: gt modify [-m <message>] [-p]" if msg_idx && message.nil?
patch = argv.include?("-p")
branch = GT::Git.current_branch
raise GT::UserError, "Cannot modify the main branch." if branch == GT::Git.main_branch
if patch
GT::Git.add_patch
elsif !message
end
GT::UI.spinner("Modifying #{branch}") do
GT::Git.add_all if !patch && !message
GT::Git.amend(message: message)
GT::Git.push(branch, force: true)
end
GT::Commands::Restack.run([])
end
|