Method: Git::Base.open
- Defined in:
- lib/git/base.rb
.open(working_dir, options = {}) ⇒ Git::Base
Open a an existing Git working directory
Git.open will most likely be the most common way to create a git reference, referring to an existing working directory.
If not provided in the options, the library will assume
the repository and index are in the default places (.git/, .git/index).
124 125 126 127 128 129 130 131 132 |
# File 'lib/git/base.rb', line 124 def self.open(working_dir, = {}) raise ArgumentError, "'#{working_dir}' is not a directory" unless Dir.exist?(working_dir) working_dir = root_of_worktree(working_dir) unless [:repository] normalize_paths(, default_working_directory: working_dir) new() end |