Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Consolidate submodule functions and combine commands

  • Loading branch information...
commit b4c9b659c8ffd59f28174a284f7c7637294505f7 1 parent e8000d3
@timothyasp timothyasp authored
Showing with 7 additions and 14 deletions.
  1. +2 −2 feature.rb
  2. +3 −10 git.rb
  3. +2 −2 hotfix.rb
View
4 feature.rb
@@ -23,7 +23,7 @@
Git::run_safe("git branch \"#{feature}\" #{Git::development_branch}")
Git::run_safe("git checkout \"#{feature}\"")
- Git::init_submodules
+ Git::submodules_update
# Automatically setup remote tracking branch
Git::run_safe("git config branch.#{feature}.remote origin")
@@ -161,7 +161,7 @@
old_branch_hash = Git::branch_hash(current)
Git::run_safe("git rebase --preserve-merges origin/#{current}")
- Git::init_submodules
+ Git::submodules_update
if Git::branch_hash(current) == old_branch_hash
die "No changes in the remote branch. Your branch is up to date."
View
13 git.rb
@@ -148,24 +148,17 @@ def self.stashes
def self.switch_branch(branch)
self.run_safe("git checkout \"#{branch}\"")
- self.init_submodules
+ self.submodules_update
self.run_safe("git clean -ffd") if ARGV.include?('--clean')
self.show_stashes_saved_on(branch)
end
- def self.init_submodules
+ def self.submodules_update
# capture only the path, not the newline
basedir = `git rev-parse --show-toplevel`.split("\n").first
- # change directory to base dir
- Dir.chdir(basedir)
-
- self.submodules_update
- end
-
- def self.submodules_update
- Git::run_safe("git submodule --quiet update --init --rebase --recursive")
+ Git::run_safe("cd #{basedir} && git submodule --quiet update --init --rebase --recursive")
end
##
View
4 hotfix.rb
@@ -17,7 +17,7 @@
Git::run_safe("git branch \"#{hotfix}\" stable")
Git::run_safe("git checkout \"#{hotfix}\"")
- Git::init_submodules
+ Git::submodules_update
# Automatically setup remote tracking branch
Git::run_safe("git config branch.#{hotfix}.remote origin")
@@ -91,7 +91,7 @@
Git::run_safe("git merge --no-ff --edit -m #{description.shellescape} \"#{hotfix}\"")
# init any submodules in the stable branch
- Git::init_submodules
+ Git::submodules_update
# push the the merge to our origin
# Git::run_safe("git push origin")
Please sign in to comment.
Something went wrong with that request. Please try again.