Module: Capistrano::Scm::Strategy::Git::Shallow
- Defined in:
- lib/capistrano/scm/strategy/git/shallow.rb
Instance Method Summary collapse
- #check ⇒ Object
- #clone ⇒ Object
- #fetch_revision ⇒ Object
- #release ⇒ Object
- #test ⇒ Object
- #update ⇒ Object
Instance Method Details
#check ⇒ Object
16 17 18 |
# File 'lib/capistrano/scm/strategy/git/shallow.rb', line 16 def check test! :git, :'ls-remote -h', repo_url end |
#clone ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/capistrano/scm/strategy/git/shallow.rb', line 20 def clone # clone bare repo, but only latest commit of some branch git( :clone, '--bare', '--depth 1', "--branch #{fetch(:branch)}", repo_url, repo_path ) end |
#fetch_revision ⇒ Object
52 53 54 |
# File 'lib/capistrano/scm/strategy/git/shallow.rb', line 52 def fetch_revision context.capture(:git, "rev-parse #{fetch(:branch)}") end |
#release ⇒ Object
48 49 50 |
# File 'lib/capistrano/scm/strategy/git/shallow.rb', line 48 def release git :archive, fetch(:branch), '| tar -x -C', release_path end |
#test ⇒ Object
12 13 14 |
# File 'lib/capistrano/scm/strategy/git/shallow.rb', line 12 def test test! " [ -f #{repo_path}/HEAD ] " end |
#update ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/capistrano/scm/strategy/git/shallow.rb', line 32 def update # update branch, checking out a new branch if :branch changed # --force is used to skip inheritance check when new commits git( :fetch, '--depth 1', '--force', 'origin', "#{fetch(:branch)}:#{fetch(:branch)}" ) # update HEAD to reflect correct branch for manual inspection # shouldn't strictly be needed as branch is explicit elsewhere git(:'symbolic-ref', 'HEAD', "refs/heads/#{fetch(:branch)}") end |