Skip to content

Commit

Permalink
Uncache the remote host & path each time 'pushed.push' is invoked, so…
Browse files Browse the repository at this point in the history
… multiple separate pushes can be done at once.
  • Loading branch information
benhoskings committed Jan 17, 2013
1 parent e81fc3f commit 097e660
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions push.rb
Expand Up @@ -12,8 +12,9 @@ def self.remote_head remote
def remote_host; self.class.remote_host_and_path(remote).first end
def remote_path; self.class.remote_host_and_path(remote).last end
def remote_head; self.class.remote_head(remote) end
def self.uncache_remote_head!
def self.uncache!
@remote_head = nil
@remote_host_and_path = nil
end
def git_log from, to
if from[/^0+$/]
Expand Down Expand Up @@ -46,6 +47,7 @@ def git_log from, to
end

dep 'pushed.push', :ref, :remote do
self.class.uncache!
ref.ask("What would you like to push?").default('HEAD')
remote.ask("Where would you like to push to?").choose(repo.repo_shell('git remote').split("\n"))
requires [
Expand All @@ -62,7 +64,7 @@ def git_log from, to
confirm "OK to push #{ref} to #{remote} (#{repo.repo_shell("git config remote.#{remote}.url")})?" do
push_cmd = "git push #{remote} #{ref}:master -f"
log push_cmd.colorize("on grey") do
self.class.uncache_remote_head!
self.class.uncache!
shell push_cmd, :log => true
end
end
Expand Down

0 comments on commit 097e660

Please sign in to comment.