File tree Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Expand file tree Collapse file tree 1 file changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -92,5 +92,19 @@ def self.init(working_dir = '.', options = {})
92
92
def self . clone ( repository , name , options = { } )
93
93
Base . clone ( repository , name , options )
94
94
end
95
+
96
+ # Export the current HEAD (or a branch, if <tt>options[:branch]</tt>
97
+ # is specified) into the +name+ directory, then remove all traces of git from the
98
+ # directory.
99
+ #
100
+ # See +clone+ for options. Does not obey the <tt>:remote</tt> option,
101
+ # since the .git info will be deleted anyway; always uses the default
102
+ # remote, 'origin.'
103
+ def self . export ( repository , name , options = { } )
104
+ options . delete ( :remote )
105
+ repo = clone ( repository , name , { :depth => 1 } . merge ( options ) )
106
+ repo . checkout ( "origin/#{ options [ :branch ] } " ) if options [ :branch ]
107
+ Dir . chdir ( repo . dir . to_s ) { FileUtils . rm_r '.git' }
108
+ end
95
109
96
110
end
You can’t perform that action at this time.
0 commit comments