lib/git_bundle/commands/push.rb in git-bundle-1.0.14 vs lib/git_bundle/commands/push.rb in git-bundle-1.0.15
- old
+ new
@@ -64,31 +64,45 @@
puts_error "Failed to push changes of #{main_repository.name}. Try pulling the latest changes or resolve conflicts first."
end
end
private
+
def prompt_confirm
if @project.main_repository.file_changed?('Gemfile')
puts_error 'Your Gemfile has uncommitted changes. Commit them first before pushing.'
return false
end
commits_to_push = false
upstream_branches_missing = []
+ diverged_repos = []
@project.repositories.each do |repo|
commits = repo.commits_not_pushed
puts_repo_heading(repo)
if repo.upstream_branch_exists?
if commits.empty?
puts 'No changes.'
else
commits_to_push = true
+ diverged_repos << repo if repo.branch != @project.main_repository.branch
puts commits
end
else
upstream_branches_missing << repo.name
puts 'Remote branch does not exist yet.'
+ end
+ end
+
+ if diverged_repos.any?
+ puts_prompt("\nThese repositories have changes and have diverged from the main application's branch (#{@project.main_repository.branch})")
+ puts_diverged_repos(diverged_repos)
+ puts_prompt("\nDo you want to continue? (Y/N)")
+ if STDIN.getch.upcase == 'Y'
+ puts ''
+ else
+ return false
end
end
if !upstream_branches_missing.empty?
puts_prompt("Missing upstream branches (#{upstream_branches_missing.join(', ')}) will be created and changes pushed.")