Created
July 28, 2010 14:47
-
-
Save jkraemer/494750 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git.rb | 22 +++++++++++++++++++--- | |
1 file changed, 19 insertions(+), 3 deletions(-) | |
--- ./capistrano/recipes/deploy/scm/git.rb.orig | |
+++ ./capistrano/recipes/deploy/scm/git.rb | |
@@ -157,10 +157,26 @@ | |
execute.join(" && ") | |
end | |
- # An expensive export. Performs a checkout as above, then | |
- # removes the repo. | |
+ # use git archive to export repository | |
def export(revision, destination) | |
- checkout(revision, destination) << " && rm -Rf #{destination}/.git" | |
+ git = command | |
+ execute = [] | |
+ args = [] | |
+ | |
+ args << '--format=tar' | |
+ args << "--remote=#{configuration[:repository]}" | |
+ if project = configuration[:project] | |
+ args << "#{revision}:#{project}" | |
+ else | |
+ args << revision | |
+ end | |
+ | |
+ # export (using git archive) | |
+ execute << "mkdir -p #{destination}" | |
+ execute << "cd #{destination}" | |
+ execute << "#{git} archive #{args.join(' ')} | tar xf -" | |
+ | |
+ execute.join(" && ") | |
end | |
# Merges the changes to 'head' since the last fetch, for remote_cache |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment