We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 26e6242 commit 4ee3e34Copy full SHA for 4ee3e34
lib/git/base.rb
@@ -24,9 +24,18 @@ def self.init(working_dir, opts = {})
24
:working_directory => working_dir,
25
:repository => File.join(working_dir, '.git')
26
}.merge(opts)
27
-
+
28
FileUtils.mkdir_p(opts[:working_directory]) if opts[:working_directory] && !File.directory?(opts[:working_directory])
29
30
+ # Submodules have a .git *file* not a .git folder.
31
+ # This file's contents point to the location of
32
+ # where the git refs are held (In the parent repo)
33
+ if File.file?('.git')
34
+ git_file = File.open('.git').read[8..-1].strip
35
+ opts[:repository] = git_file
36
+ opts[:index] = git_file + '/index'
37
+ end
38
39
# run git_init there
40
Git::Lib.new(opts).init
41
0 commit comments