Skip to content

Commit 597caa8

Browse files
committed
Add ability to cleanup a partial pull check
1 parent 12ce451 commit 597caa8

File tree

2 files changed

+27
-1
lines changed

2 files changed

+27
-1
lines changed

bin/gx-pull-check

+26
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,26 @@ current_branch = head.name
1616
url = ARGV.shift
1717
cmd = ARGV.shift || "rake"
1818

19+
if current_branch == "gx-pull-check" and url == "done"
20+
puts "Cleaning up pull-check..."
21+
current_branch = File.read(".git/pull-check-origin").strip
22+
23+
repo.git.checkout({}, current_branch)
24+
repo.git.branch({:D => true}, "gx-pull-check")
25+
26+
File.unlink ".git/pull-check-origin"
27+
28+
exit 0
29+
elsif current_branch == "gx-pull-check"
30+
puts "Currently handling a pull check already, please finish it first."
31+
exit 1
32+
end
33+
34+
unless url
35+
puts "Usage: gx-pull-check URL [command to test]"
36+
exit 1
37+
end
38+
1939
puts "Performing pull check on '#{url}'"
2040

2141
url += ".patch"
@@ -30,6 +50,10 @@ if $?.exitstatus != 0
3050
exit 1
3151
end
3252

53+
File.open ".git/pull-check-origin", "w" do |f|
54+
f.puts current_branch
55+
end
56+
3357
puts "Step 2: Apply the pull request..."
3458
repo.git.branch({}, "gx-pull-check")
3559
repo.git.checkout({}, "gx-pull-check")
@@ -58,4 +82,6 @@ puts "Everything ran fine, feel free to merge the pull request!"
5882
repo.git.checkout({}, current_branch)
5983
repo.git.branch({:D => true}, "gx-pull-check")
6084

85+
File.unlink ".git/pull-check-origin"
86+
6187
File.unlink patch

lib/gx.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
class Gx
2-
VERSION = '1.3.0'
2+
VERSION = '1.3.1'
33
end

0 commit comments

Comments
 (0)