2 # Add the directory containing this file to the start of the load path if it
4 $:.unshift(File.dirname(__FILE__)) unless
5 $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
11 require 'git/repository'
13 require 'git/working_directory'
18 require 'git/branches'
28 # This provides bindings for working with git in complex
29 # interactions, including branching and merging, object
30 # inspection and manipulation, history, patch generation
31 # and more. You should be able to do most fundamental git
32 # operations with this library.
34 # This module provides the basic functions to open a git
35 # reference to work with. You can open a working directory,
36 # open a bare repository, initialize a new repo or clone an
37 # existing remote repository.
39 # Author:: Scott Chacon (mailto:schacon@gmail.com)
40 # License:: MIT License
45 # open a bare repository
47 # this takes the path to a bare git repo
48 # it expects not to be able to use a working directory
49 # so you can't checkout stuff, commit things, etc.
50 # but you can do most read operations
51 def self.bare(git_dir)
55 # open an existing git working directory
57 # this will most likely be the most common way to create
58 # a git reference, referring to a working directory.
59 # if not provided in the options, the library will assume
60 # your git_dir and index are in the default place (.git/, .git/index)
63 # :repository => '/path/to/alt_git_dir'
64 # :index => '/path/to/alt_index_file'
65 def self.open(working_dir, options = {})
66 Base.open(working_dir, options)
69 # initialize a new git repository, defaults to the current working directory
72 # :repository => '/path/to/alt_git_dir'
73 # :index => '/path/to/alt_index_file'
74 def self.init(working_dir = '.', options = {})
75 Base.init(working_dir, options)
78 # clones a remote repository
81 # :bare => true (does a bare clone)
82 # :repository => '/path/to/alt_git_dir'
83 # :index => '/path/to/alt_index_file'
86 # Git.clone('git://repo.or.cz/rubygit.git', 'clone.git', :bare => true)
88 def self.clone(repository, name, options = {})
89 Base.clone(repository, name, options)