From bc60052b519b8b991e50b8ccb30f2b76ad125996 Mon Sep 17 00:00:00 2001 From: scott Chacon Date: Fri, 16 Nov 2007 13:24:30 -0800 Subject: updated the docs --- doc/classes/Git/Base.html | 976 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 683 insertions(+), 293 deletions(-) (limited to 'doc/classes/Git/Base.html') diff --git a/doc/classes/Git/Base.html b/doc/classes/Git/Base.html index 9c994c6..d3dec3d 100644 --- a/doc/classes/Git/Base.html +++ b/doc/classes/Git/Base.html @@ -88,48 +88,62 @@

Methods

- add   - add_remote   - add_tag   - bare   - branch   - branches   - chdir   - checkout   - clone   - commit   - commit_all   - config   - current_branch   - diff   - dir   - fetch   - gblob   - gcommit   - grep   - gtree   - index   - init   - lib   - log   - merge   - new   - object   - open   - pull   - push   - remote   - remotes   - remove   - repack   - repo   - repo_size   - reset   - reset_hard   - revparse   - status   - tag   - tags   + add   + add_remote   + add_tag   + archive   + bare   + branch   + branches   + chdir   + checkout   + checkout_index   + clone   + commit   + commit_all   + commit_tree   + config   + current_branch   + diff   + dir   + fetch   + gblob   + gcommit   + grep   + gtree   + index   + init   + lib   + log   + ls_files   + merge   + new   + object   + open   + pull   + push   + read_tree   + remote   + remotes   + remove   + repack   + repo   + repo_size   + reset   + reset_hard   + revparse   + set_index   + set_working   + status   + tag   + tags   + update_ref   + with_index   + with_temp_index   + with_temp_working   + with_working   + write_and_commit_tree   + write_tree  
@@ -151,11 +165,11 @@

Public Class methods

-
- +
+ @@ -166,10 +180,10 @@ opens a bare Git Repository - no working directory options

[Source]

-
+ onclick="toggleCode('M000089-source');return false;">[Source]

+
-# File lib/git/base.rb, line 10
+# File lib/git/base.rb, line 12
     def self.bare(git_dir)
       self.new :repository => git_dir
     end
@@ -178,11 +192,11 @@ href="Repository.html">Repository - no working directory options
         
-
- +
+ @@ -207,10 +221,10 @@ options: :index_file

[Source]

-
+ onclick="toggleCode('M000092-source');return false;">[Source]

+
-# File lib/git/base.rb, line 58
+# File lib/git/base.rb, line 60
     def self.clone(repository, name, opts = {})
       # run git-clone 
       self.new(Git::Lib.new.clone(repository, name, opts))
@@ -220,11 +234,11 @@ options:
         
-
- +
+ @@ -241,10 +255,10 @@ options: :index_file

[Source]

-
+ onclick="toggleCode('M000091-source');return false;">[Source]

+
-# File lib/git/base.rb, line 29
+# File lib/git/base.rb, line 31
     def self.init(working_dir, opts = {})
       default = {:working_directory => working_dir,
                  :repository => File.join(working_dir, '.git')}
@@ -265,21 +279,21 @@ options:
         
-
- +
+

[Source]

-
+ onclick="toggleCode('M000093-source');return false;">[Source]

+
-# File lib/git/base.rb, line 63
+# File lib/git/base.rb, line 65
     def initialize(options = {})
       if working_dir = options[:working_directory]
         options[:repository] = File.join(working_dir, '.git') if !options[:repository]
@@ -295,11 +309,11 @@ options:
         
-
- +
+ @@ -310,10 +324,10 @@ opens a new Git Project from a working directory you can specify non-standard git_dir and index file in the options

[Source]

-
+ onclick="toggleCode('M000090-source');return false;">[Source]

+
-# File lib/git/base.rb, line 16
+# File lib/git/base.rb, line 18
     def self.open(working_dir, opts={})    
       default = {:working_directory => working_dir}
       git_options = default.merge(opts)
@@ -327,11 +341,11 @@ you can specify non-standard git_dir and index file in the options
 
       

Public Instance methods

-
- +
+ @@ -341,10 +355,10 @@ you can specify non-standard git_dir and index file in the options adds files from the working directory to the git repository

[Source]

-
+ onclick="toggleCode('M000114-source');return false;">[Source]

+
-# File lib/git/base.rb, line 212
+# File lib/git/base.rb, line 234
     def add(path = '.')
       self.lib.add(path)
     end
@@ -353,11 +367,11 @@ adds files from the working directory to the git repository
         
-
- +
+ @@ -373,10 +387,10 @@ href="Base.html">Git::Base object if it’s a local reference @git.merge('scotts_git/master')

[Source]

-
+ onclick="toggleCode('M000126-source');return false;">[Source]

+
-# File lib/git/base.rb, line 290
+# File lib/git/base.rb, line 312
     def add_remote(name, url, opts = {})
       if url.is_a?(Git::Base)
         url = url.repo.path
@@ -389,11 +403,11 @@ href="Base.html">Git::Base object if it’s a local reference
         
-
- +
+ @@ -403,10 +417,10 @@ href="Base.html">Git::Base object if it’s a local reference creates a new git tag (Git::Tag)

[Source]

-
+ onclick="toggleCode('M000129-source');return false;">[Source]

+
-# File lib/git/base.rb, line 309
+# File lib/git/base.rb, line 331
     def add_tag(tag_name)
       self.lib.tag(tag_name)
       tag(tag_name)
@@ -416,11 +430,37 @@ creates a new git tag (Git::Tag)
         
-
- +
+ + +
+

+creates an archive file of the given tree-ish +

+

[Source]

+
+
+# File lib/git/base.rb, line 337
+    def archive(treeish, file = nil, opts = {})
+      self.object(treeish).archive(file, opts)
+    end
+
+
+
+
+ +
+ + + @@ -430,10 +470,10 @@ creates a new git tag (Git::Tag) returns a Git::Branch object for branch_name

[Source]

-
+ onclick="toggleCode('M000109-source');return false;">[Source]

+
-# File lib/git/base.rb, line 167
+# File lib/git/base.rb, line 189
     def branch(branch_name = 'master')
       Git::Branch.new(self, branch_name)
     end
@@ -442,11 +482,11 @@ returns a Git::Branch object for branch_name
         
-
- +
+ @@ -457,10 +497,10 @@ returns a Git::Branches object of all the Git::Branch objects for this repo

[Source]

-
+ onclick="toggleCode('M000108-source');return false;">[Source]

+
-# File lib/git/base.rb, line 162
+# File lib/git/base.rb, line 184
     def branches
       Git::Branches.new(self)
     end
@@ -469,11 +509,11 @@ href="Branch.html">Git::Branch objects for this repo
         
-
- +
+ @@ -493,10 +533,10 @@ example end

[Source]

-
+ onclick="toggleCode('M000099-source');return false;">[Source]

+
-# File lib/git/base.rb, line 102
+# File lib/git/base.rb, line 115
     def chdir
       Dir.chdir(dir.path) do
         yield dir.path
@@ -507,11 +547,11 @@ example
         
-
- +
+ @@ -521,10 +561,10 @@ example checks out a branch as the new git working directory

[Source]

-
+ onclick="toggleCode('M000120-source');return false;">[Source]

+
-# File lib/git/base.rb, line 246
+# File lib/git/base.rb, line 268
     def checkout(branch = 'master', opts = {})
       self.lib.checkout(branch, opts)
     end
@@ -533,11 +573,34 @@ checks out a branch as the new git working directory
         
-
- +
+ + +
+

[Source]

+
+
+# File lib/git/base.rb, line 364
+    def checkout_index(opts = {})
+      self.lib.checkout_index(opts)
+    end
+
+
+
+
+ +
+ + + @@ -547,10 +610,10 @@ checks out a branch as the new git working directory commits all pending changes in the index file to the git repository

[Source]

-
+ onclick="toggleCode('M000118-source');return false;">[Source]

+
-# File lib/git/base.rb, line 233
+# File lib/git/base.rb, line 255
     def commit(message, opts = {})
       self.lib.commit(message, opts)
     end
@@ -559,11 +622,11 @@ commits all pending changes in the index file to the git repository
         
-
- +
+ @@ -575,10 +638,10 @@ automatically adds all modified files without having to explicitly calling @git.add() on them.

[Source]

-
+ onclick="toggleCode('M000119-source');return false;">[Source]

+
-# File lib/git/base.rb, line 240
+# File lib/git/base.rb, line 262
     def commit_all(message, opts = {})
       opts = {:add_all => true}.merge(opts)
       self.lib.commit(message, opts)
@@ -588,11 +651,34 @@ automatically adds all modified files without having to explicitly calling
         
-
- +
+ + +
+

[Source]

+
+
+# File lib/git/base.rb, line 376
+    def commit_tree(tree = nil, opts = {})
+      Git::Object::Commit.new(self, self.lib.commit_tree(tree, opts))
+    end
+
+
+
+
+ +
+ + + @@ -605,10 +691,10 @@ value g.config(‘user.name’) # returns ‘Scott Chacon’ g.config # returns whole config hash

[Source]

-
+ onclick="toggleCode('M000101-source');return false;">[Source]

+
-# File lib/git/base.rb, line 121
+# File lib/git/base.rb, line 134
     def config(name = nil, value = nil)
       if(name && value)
         # set value
@@ -626,11 +712,11 @@ Chacon’ g.config # returns whole config hash
         
-
- +
+ @@ -640,10 +726,10 @@ Chacon’ g.config # returns whole config hash returns the name of the branch the working directory is currently on

[Source]

-
+ onclick="toggleCode('M000144-source');return false;">[Source]

+
-# File lib/git/base.rb, line 330
+# File lib/git/base.rb, line 425
     def current_branch
       self.lib.branch_current
     end
@@ -652,11 +738,11 @@ returns the name of the branch the working directory is currently on
         
-
- +
+ @@ -666,10 +752,10 @@ returns the name of the branch the working directory is currently on returns a Git::Diff object

[Source]

-
+ onclick="toggleCode('M000113-source');return false;">[Source]

+
-# File lib/git/base.rb, line 207
+# File lib/git/base.rb, line 229
     def diff(objectish = 'HEAD', obj2 = nil)
       Git::Diff.new(self, objectish, obj2)
     end
@@ -678,11 +764,11 @@ returns a Git::Diff object
         
-
- +
+ @@ -696,10 +782,10 @@ returns a reference to the working directory @git.dir.writeable?

[Source]

-
+ onclick="toggleCode('M000094-source');return false;">[Source]

+
-# File lib/git/base.rb, line 78
+# File lib/git/base.rb, line 80
     def dir
       @working_directory
     end
@@ -708,11 +794,11 @@ returns a reference to the working directory
         
-
- +
+ @@ -723,10 +809,10 @@ fetches changes from a remote branch - this does not modify the working directory, it just gets the changes from the remote if there are any

[Source]

-
+ onclick="toggleCode('M000121-source');return false;">[Source]

+
-# File lib/git/base.rb, line 252
+# File lib/git/base.rb, line 274
     def fetch(remote = 'origin')
       self.lib.fetch(remote)
     end
@@ -735,39 +821,57 @@ directory, it just gets the changes from the remote if there are any
         
-
- +
+
-

-Alias for object -

+

[Source]

+
+
+# File lib/git/base.rb, line 169
+    def gblob(objectish)
+      Git::Object.new(self, objectish, 'blob')
+    end
+
+
-
- +
+
-

-Alias for object -

+

[Source]

+
+
+# File lib/git/base.rb, line 165
+    def gcommit(objectish)
+      Git::Object.new(self, objectish, 'commit')
+    end
+
+
-
- +
+ @@ -802,10 +906,10 @@ so you might use it like this: end

[Source]

-
+ onclick="toggleCode('M000112-source');return false;">[Source]

+
-# File lib/git/base.rb, line 202
+# File lib/git/base.rb, line 224
     def grep(string)
       self.object('HEAD').grep(string)
     end
@@ -814,25 +918,34 @@ so you might use it like this:
         
-
- +
+
-

-Alias for object -

+

[Source]

+
+
+# File lib/git/base.rb, line 161
+    def gtree(objectish)
+      Git::Object.new(self, objectish, 'tree')
+    end
+
+
-
- +
+ @@ -842,10 +955,10 @@ Alias for object returns reference to the git index file

[Source]

-
+ onclick="toggleCode('M000096-source');return false;">[Source]

+
-# File lib/git/base.rb, line 89
+# File lib/git/base.rb, line 91
     def index
       @index
     end
@@ -854,11 +967,11 @@ returns reference to the git index file
         
-
- +
+ @@ -871,23 +984,23 @@ replace the Git::Lib class with one that uses native methods or libgit C bindings

[Source]

-
+ onclick="toggleCode('M000111-source');return false;">[Source]

+
-# File lib/git/base.rb, line 179
+# File lib/git/base.rb, line 201
     def lib
-      Git::Lib.new(self)
+      @lib ||= Git::Lib.new(self)
     end
 
-
- +
+ @@ -897,10 +1010,10 @@ methods or libgit C bindings returns a Git::Log object with count commits

[Source]

-
+ onclick="toggleCode('M000106-source');return false;">[Source]

+
-# File lib/git/base.rb, line 152
+# File lib/git/base.rb, line 174
     def log(count = 30)
       Git::Log.new(self, count)
     end
@@ -909,11 +1022,34 @@ returns a Git::Log object with count commits
         
-
- +
+ + +
+

[Source]

+
+
+# File lib/git/base.rb, line 390
+    def ls_files
+      self.lib.ls_files
+    end
+
+
+
+
+ +
+ + + @@ -927,10 +1063,10 @@ you can specify more than one branch to merge by passing an array of branches

[Source]

-
+ onclick="toggleCode('M000123-source');return false;">[Source]

+
-# File lib/git/base.rb, line 268
+# File lib/git/base.rb, line 290
     def merge(branch, message = 'merge')
       self.lib.merge(branch, message)
     end
@@ -939,11 +1075,11 @@ branches
         
-
- +
+ @@ -961,10 +1097,10 @@ objectish and determine the type of the object and return an appropriate object for that type

[Source]

-
+ onclick="toggleCode('M000102-source');return false;">[Source]

+
-# File lib/git/base.rb, line 144
+# File lib/git/base.rb, line 157
     def object(objectish)
       Git::Object.new(self, objectish)
     end
@@ -973,11 +1109,11 @@ object for that type
         
-
- +
+ @@ -988,10 +1124,10 @@ fetches a branch from a remote and merges it into the current working branch

[Source]

-
+ onclick="toggleCode('M000124-source');return false;">[Source]

+
-# File lib/git/base.rb, line 273
+# File lib/git/base.rb, line 295
     def pull(remote = 'origin', branch = 'master', message = 'origin pull')
       fetch(remote)
       merge(branch, message)
@@ -1001,11 +1137,11 @@ branch
         
-
- +
+ @@ -1020,10 +1156,10 @@ setup the push parameters: @git.config('remote.remote-name.push', 'refs/heads/master:refs/heads/master')

[Source]

-
+ onclick="toggleCode('M000122-source');return false;">[Source]

+
-# File lib/git/base.rb, line 261
+# File lib/git/base.rb, line 283
     def push(remote = 'origin', branch = 'master')
       self.lib.push(remote, branch)
     end
@@ -1032,11 +1168,34 @@ setup the push parameters:
         
-
- +
+ + +
+

[Source]

+
+
+# File lib/git/base.rb, line 368
+    def read_tree(treeish, opts = {})
+      self.lib.read_tree(treeish, opts)
+    end
+
+
+
+
+ +
+ + + @@ -1046,10 +1205,10 @@ setup the push parameters: returns a Git::Remote object

[Source]

-
+ onclick="toggleCode('M000110-source');return false;">[Source]

+
-# File lib/git/base.rb, line 172
+# File lib/git/base.rb, line 194
     def remote(remote_name = 'origin')
       Git::Remote.new(self, remote_name)
     end
@@ -1058,11 +1217,11 @@ returns a Git::Remote object
         
-
- +
+ @@ -1073,10 +1232,10 @@ returns an array of Git:Remote objects

[Source]

-
+ onclick="toggleCode('M000125-source');return false;">[Source]

+
-# File lib/git/base.rb, line 279
+# File lib/git/base.rb, line 301
     def remotes
       self.lib.remotes.map { |r| Git::Remote.new(self, r) }
     end
@@ -1085,11 +1244,11 @@ href="Remote.html">Remote objects
         
-
- +
+ @@ -1099,10 +1258,10 @@ href="Remote.html">Remote objects removes file(s) from the git repository

[Source]

-
+ onclick="toggleCode('M000115-source');return false;">[Source]

+
-# File lib/git/base.rb, line 217
+# File lib/git/base.rb, line 239
     def remove(path = '.', opts = {})
       self.lib.remove(path, opts)
     end
@@ -1111,11 +1270,11 @@ removes file(s) from the git repository
         
-
- +
+ @@ -1125,10 +1284,10 @@ removes file(s) from the git repository repacks the repository

[Source]

-
+ onclick="toggleCode('M000131-source');return false;">[Source]

+
-# File lib/git/base.rb, line 315
+# File lib/git/base.rb, line 342
     def repack
       self.lib.repack
     end
@@ -1137,11 +1296,11 @@ repacks the repository
         
-
- +
+ @@ -1154,10 +1313,10 @@ returns reference to the git repository directory @git.dir.path

[Source]

-
+ onclick="toggleCode('M000095-source');return false;">[Source]

+
-# File lib/git/base.rb, line 84
+# File lib/git/base.rb, line 86
     def repo
       @repository
     end
@@ -1166,11 +1325,11 @@ returns reference to the git repository directory
         
-
- +
+ @@ -1180,10 +1339,10 @@ returns reference to the git repository directory returns the repository size in bytes

[Source]

-
+ onclick="toggleCode('M000100-source');return false;">[Source]

+
-# File lib/git/base.rb, line 109
+# File lib/git/base.rb, line 122
     def repo_size
       size = 0
       Dir.chdir(repo.path) do
@@ -1196,11 +1355,11 @@ returns the repository size in bytes
         
-
- +
+ @@ -1210,10 +1369,10 @@ returns the repository size in bytes resets the working directory to the provided commitish

[Source]

-
+ onclick="toggleCode('M000116-source');return false;">[Source]

+
-# File lib/git/base.rb, line 222
+# File lib/git/base.rb, line 244
     def reset(commitish = nil, opts = {})
       self.lib.reset(commitish, opts)
     end
@@ -1222,11 +1381,11 @@ resets the working directory to the provided commitish
         
-
- +
+ @@ -1237,10 +1396,10 @@ resets the working directory to the commitish with ’—hard’

[Source]

-
+ onclick="toggleCode('M000117-source');return false;">[Source]

+
-# File lib/git/base.rb, line 227
+# File lib/git/base.rb, line 249
     def reset_hard(commitish = nil, opts = {})
       opts = {:hard => true}.merge(opts)
       self.lib.reset(commitish, opts)
@@ -1250,11 +1409,11 @@ resets the working directory to the commitish with
         
-
- +
+ @@ -1269,10 +1428,10 @@ runs git rev-parse to convert the objectish to a full sha @git.revparse('v2.4:/doc/index.html')

[Source]

-
+ onclick="toggleCode('M000143-source');return false;">[Source]

+
-# File lib/git/base.rb, line 325
+# File lib/git/base.rb, line 420
     def revparse(objectish)
       self.lib.revparse(objectish)
     end
@@ -1281,11 +1440,59 @@ runs git rev-parse to convert the objectish to a full sha
         
-
- +
+ + +
+

[Source]

+
+
+# File lib/git/base.rb, line 101
+    def set_index(index_file, check = true)
+      @lib = nil
+      @index = Git::Index.new(index_file.to_s, check)
+    end
+
+
+
+
+ +
+ + + + +
+

[Source]

+
+
+# File lib/git/base.rb, line 96
+    def set_working(work_dir, check = true)
+      @lib = nil
+      @working_directory = Git::WorkingDirectory.new(work_dir.to_s, check)
+    end
+
+
+
+
+ +
+ + + @@ -1295,10 +1502,10 @@ runs git rev-parse to convert the objectish to a full sha returns a Git::Status object

[Source]

-
+ onclick="toggleCode('M000107-source');return false;">[Source]

+
-# File lib/git/base.rb, line 157
+# File lib/git/base.rb, line 179
     def status
       Git::Status.new(self)
     end
@@ -1307,11 +1514,11 @@ returns a Git::Status object
         
-
- +
+ @@ -1321,23 +1528,23 @@ returns a Git::Status object returns a Git::Tag object

[Source]

-
+ onclick="toggleCode('M000128-source');return false;">[Source]

+
-# File lib/git/base.rb, line 304
+# File lib/git/base.rb, line 326
     def tag(tag_name)
-      Git::Object.new(self, tag_name, true)
+      Git::Object.new(self, tag_name, 'tag', true)
     end
 
-
- +
+ @@ -1347,10 +1554,10 @@ returns a Git::Tag object returns an array of all Git::Tag objects for this repository

[Source]

-
+ onclick="toggleCode('M000127-source');return false;">[Source]

+
-# File lib/git/base.rb, line 299
+# File lib/git/base.rb, line 321
     def tags
       self.lib.tags.map { |r| tag(r) }
     end
@@ -1359,6 +1566,189 @@ returns an array of all Git::Tag objects for this repository
         
+
+ + + + +
+

[Source]

+
+
+# File lib/git/base.rb, line 385
+    def update_ref(branch, commit)
+      branch(branch).update_ref(commit)
+    end
+
+
+
+
+ +
+ + + + +
+

+LOWER LEVEL INDEX OPERATIONS ## +

+

[Source]

+
+
+# File lib/git/base.rb, line 349
+    def with_index(new_index)
+      old_index = @index
+      set_index(new_index, false)
+      return_value = yield @index
+      set_index(old_index)
+      return_value
+    end
+
+
+
+
+ +
+ + + + +
+

[Source]

+
+
+# File lib/git/base.rb, line 357
+    def with_temp_index &blk
+      tempfile = Tempfile.new('temp-index')
+      temp_path = tempfile.path
+      tempfile.unlink
+      with_index(temp_path, &blk)
+    end
+
+
+
+
+ +
+ + + + +
+

[Source]

+
+
+# File lib/git/base.rb, line 405
+    def with_temp_working &blk
+      tempfile = Tempfile.new("temp-workdir")
+      temp_dir = tempfile.path
+      tempfile.unlink
+      Dir.mkdir(temp_dir, 0700)
+      with_working(temp_dir, &blk)
+    end
+
+
+
+
+ +
+ + + + +
+

[Source]

+
+
+# File lib/git/base.rb, line 394
+    def with_working(work_dir)
+      return_value = false
+      old_working = @working_directory
+      set_working(work_dir) 
+      Dir.chdir work_dir do
+        return_value = yield @working_directory
+      end
+      set_working(old_working)
+      return_value
+    end
+
+
+
+
+ +
+ + + + +
+

[Source]

+
+
+# File lib/git/base.rb, line 380
+    def write_and_commit_tree(opts = {})
+      tree = write_tree
+      commit_tree(tree, opts)
+    end
+
+
+
+
+ +
+ + + + +
+

[Source]

+
+
+# File lib/git/base.rb, line 372
+    def write_tree
+      self.lib.write_tree
+    end
+
+
+
+
+
-- cgit