applied a patch by mateusz jedruch <mateusz.jedruch@gmail.com> for iterating through...
[rubygit.git] / lib / git.rb
blob49a61ea91779e78f608da9e791258e6f5e3ac77b
2 # Add the directory containing this file to the start of the load path if it
3 # isn't there already.
4 $:.unshift(File.dirname(__FILE__)) unless
5   $:.include?(File.dirname(__FILE__)) || $:.include?(File.expand_path(File.dirname(__FILE__)))
7 require 'git/base'
8 require 'git/path'
9 require 'git/lib'
11 require 'git/repository'
12 require 'git/index'
13 require 'git/working_directory'
15 require 'git/log'
16 require 'git/object'
18 require 'git/branches'
19 require 'git/branch'
20 require 'git/remote'
22 require 'git/diff'
23 require 'git/status'
24 require 'git/author'
26 require 'git/raw/repository'
29 # Git/Ruby Library
31 # This provides bindings for working with git in complex
32 # interactions, including branching and merging, object
33 # inspection and manipulation, history, patch generation
34 # and more.  You should be able to do most fundamental git
35 # operations with this library.
37 # This module provides the basic functions to open a git 
38 # reference to work with. You can open a working directory,
39 # open a bare repository, initialize a new repo or clone an
40 # existing remote repository.
42 # Author::    Scott Chacon (mailto:schacon@gmail.com)
43 # License::   MIT License
44 module Git
46   VERSION = '1.0.4'
47   
48   # open a bare repository
49   #
50   # this takes the path to a bare git repo
51   # it expects not to be able to use a working directory
52   # so you can't checkout stuff, commit things, etc.
53   # but you can do most read operations
54   def self.bare(git_dir, options = {})
55     Base.bare(git_dir, options)
56   end
57     
58   # open an existing git working directory
59   # 
60   # this will most likely be the most common way to create
61   # a git reference, referring to a working directory.
62   # if not provided in the options, the library will assume
63   # your git_dir and index are in the default place (.git/, .git/index)
64   #
65   # options
66   #   :repository => '/path/to/alt_git_dir'
67   #   :index => '/path/to/alt_index_file'
68   def self.open(working_dir, options = {})
69     Base.open(working_dir, options)
70   end
72   # initialize a new git repository, defaults to the current working directory
73   #
74   # options
75   #   :repository => '/path/to/alt_git_dir'
76   #   :index => '/path/to/alt_index_file'
77   def self.init(working_dir = '.', options = {})
78     Base.init(working_dir, options)
79   end
81   # clones a remote repository
82   #
83   # options
84   #   :bare => true (does a bare clone)
85   #   :repository => '/path/to/alt_git_dir'
86   #   :index => '/path/to/alt_index_file'
87   #
88   # example
89   #  Git.clone('git://repo.or.cz/rubygit.git', 'clone.git', :bare => true)
90   #
91   def self.clone(repository, name, options = {})
92     Base.clone(repository, name, options)
93   end
94     
95 end