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/Lib.html | 709 +++++++++++++++++++++++++++++++---------------- 1 file changed, 465 insertions(+), 244 deletions(-) (limited to 'doc/classes/Git/Lib.html') diff --git a/doc/classes/Git/Lib.html b/doc/classes/Git/Lib.html index 9c4992e..5875189 100644 --- a/doc/classes/Git/Lib.html +++ b/doc/classes/Git/Lib.html @@ -88,45 +88,52 @@

Methods

- add   - branch_current   - branch_delete   - branch_new   - branches_all   - checkout   + add   + archive   + branch_current   + branch_delete   + branch_new   + branches_all   + checkout   + checkout_index   clone   - commit   - commit_data   - config_get   - config_list   - config_remote   - config_set   - diff_files   - diff_full   - diff_index   - diff_stats   - fetch   - grep   + commit   + commit_data   + commit_tree   + config_get   + config_list   + config_remote   + config_set   + diff_files   + diff_full   + diff_index   + diff_stats   + fetch   + grep   init   log_commits   - ls_files   - ls_tree   - merge   + ls_files   + ls_tree   + merge   + namerev   new   - object_contents   - object_size   - object_type   - push   - remote_add   - remote_remove   - remotes   - remove   - repack   - reset   + object_contents   + object_size   + object_type   + push   + read_tree   + remote_add   + remote_remove   + remotes   + remove   + repack   + reset   revparse   - tag   - tag_sha   - tags   + tag   + tag_sha   + tags   + update_ref   + write_tree  
@@ -162,12 +169,12 @@ onclick="toggleCode('M000025-source');return false;">[Source]

-# File lib/git/lib.rb, line 13
+# File lib/git/lib.rb, line 15
     def initialize(base = nil)
       if base.is_a?(Git::Base)
         @git_dir = base.repo.path
-        @git_index_file = base.index.path   
-        @git_work_dir = base.dir.path
+        @git_index_file = base.index.path if base.index
+        @git_work_dir = base.dir.path if base.dir
       elsif base.is_a?(Hash)
         @git_dir = base[:repository]
         @git_index_file = base[:index] 
@@ -181,21 +188,21 @@
 
       

Public Instance methods

-
- +
+

[Source]

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

+
-# File lib/git/lib.rb, line 251
+# File lib/git/lib.rb, line 257
     def add(path = '.')
       path = path.join(' ') if path.is_a?(Array)
       command('add', path)
@@ -205,21 +212,76 @@
         
-
- +
+ + +
+

+creates an archive file +

+

+options +

+
+ :format  (zip, tar)
+ :prefix
+ :remote
+ :path
+
+

[Source]

+
+
+# File lib/git/lib.rb, line 399
+    def archive(sha, file = nil, opts = {})
+      opts[:format] = 'zip' if !opts[:format]
+      
+      if opts[:format] == 'tgz'
+        opts[:format] = 'tar' 
+        opts[:add_gzip] = true
+      end
+      
+      if !file
+        file = Tempfile.new('archive').path
+      end
+      
+      arr_opts = []
+      arr_opts << "--format=#{opts[:format]}" if opts[:format]
+      arr_opts << "--prefix=#{opts[:prefix]}" if opts[:prefix]
+      arr_opts << "--remote=#{opts[:remote]}" if opts[:remote]
+      arr_opts << sha
+      arr_opts << opts[:path] if opts[:path]
+      arr_opts << '| gzip' if opts[:add_gzip]
+      arr_opts << "> #{file.to_s}"
+      command('archive', arr_opts)
+      return file
+    end
+
+
+
+
+ +
+ + +

[Source]

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

+
-# File lib/git/lib.rb, line 132
+# File lib/git/lib.rb, line 138
     def branch_current
       branches_all.select { |b| b[1] }.first[0] rescue nil
     end
@@ -228,21 +290,21 @@
         
-
- +
+

[Source]

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

+
-# File lib/git/lib.rb, line 284
+# File lib/git/lib.rb, line 290
     def branch_delete(branch)
       command('branch', ['-d', branch])
     end
@@ -251,21 +313,21 @@
         
-
- +
+

[Source]

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

+
-# File lib/git/lib.rb, line 280
+# File lib/git/lib.rb, line 286
     def branch_new(branch)
       command('branch', branch)
     end
@@ -274,21 +336,21 @@
         
-
- +
+

[Source]

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

+
-# File lib/git/lib.rb, line 122
+# File lib/git/lib.rb, line 128
     def branches_all
       arr = []
       command_lines('branch', '-a').each do |b| 
@@ -303,21 +365,21 @@
         
-
- +
+

[Source]

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

+
-# File lib/git/lib.rb, line 288
+# File lib/git/lib.rb, line 294
     def checkout(branch, opts = {})
       arr_opts = []
       arr_opts << '-f' if opts[:force]
@@ -330,6 +392,34 @@
         
+
+ + + + +
+

[Source]

+
+
+# File lib/git/lib.rb, line 383
+    def checkout_index(opts = {})
+      arr_opts = []
+      arr_opts << "--prefix=#{opts[:prefix]}" if opts[:prefix]
+      arr_opts << "--force" if opts[:force]
+      arr_opts << "--all" if opts[:all]
+      arr_opts << ('-- ' + opts[:path_limiter]) if opts[:path_limiter].is_a? String
+      command('checkout-index', arr_opts)
+    end
+
+
+
+
+
@@ -363,7 +453,7 @@ TODO - make this work with SSH password or auth_key onclick="toggleCode('M000027-source');return false;">[Source]

-# File lib/git/lib.rb, line 40
+# File lib/git/lib.rb, line 42
     def clone(repository, name, opts = {})
       @path = opts[:path] || '.'
       opts[:path] ? clone_dir = File.join(@path, name) : clone_dir = name
@@ -383,21 +473,21 @@ TODO - make this work with SSH password or auth_key
         
-
- +
+

[Source]

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

+
-# File lib/git/lib.rb, line 266
+# File lib/git/lib.rb, line 272
     def commit(message, opts = {})
       arr_opts = ["-m '#{message}'"]
       arr_opts << '-a' if opts[:add_all]
@@ -408,11 +498,11 @@ TODO - make this work with SSH password or auth_key
         
-
- +
+ @@ -422,10 +512,10 @@ TODO - make this work with SSH password or auth_key returns useful array of raw commit object data

[Source]

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

+
-# File lib/git/lib.rb, line 83
+# File lib/git/lib.rb, line 89
     def commit_data(sha)
       in_message = false
       
@@ -455,23 +545,33 @@ returns useful array of raw commit object data
         
-
- +
+

[Source]

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

+
-# File lib/git/lib.rb, line 232
-    def config_get(name)
-      command('config', ['--get', name])
+# File lib/git/lib.rb, line 365
+    def commit_tree(tree, opts = {})
+      opts[:message] = "commit tree #{tree}" if !opts[:message]
+      t = Tempfile.new('commit-message') do |t|
+        t.write(opts[:message])
+      end
+      
+      arr_opts = []
+      arr_opts << tree
+      arr_opts << "-p #{opts[:parent]}" if opts[:parent]
+      opts[:parents].each { |p| arr_opts << "-p #{p.to_s}" } if opts[:parents]
+      arr_opts << "< #{t.path}"
+      command('commit-tree', arr_opts)
     end
 
@@ -483,7 +583,7 @@ returns useful array of raw commit object data @@ -492,7 +592,30 @@ returns useful array of raw commit object data onclick="toggleCode('M000045-source');return false;">[Source]

-# File lib/git/lib.rb, line 236
+# File lib/git/lib.rb, line 238
+    def config_get(name)
+      command('config', ['--get', name])
+    end
+
+
+
+
+ +
+ + + + +
+

[Source]

+
+
+# File lib/git/lib.rb, line 242
     def config_list
       hsh = {}
       command_lines('config', ['--list']).each do |line|
@@ -506,21 +629,21 @@ returns useful array of raw commit object data
         
-
- +
+

[Source]

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

+
-# File lib/git/lib.rb, line 223
+# File lib/git/lib.rb, line 229
     def config_remote(name)
       hsh = {}
       command_lines('config', ['--get-regexp', "remote.#{name}"]).each do |line|
@@ -534,11 +657,11 @@ returns useful array of raw commit object data
         
-
- +
+ @@ -548,10 +671,10 @@ returns useful array of raw commit object data WRITE COMMANDS ##

[Source]

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

+
-# File lib/git/lib.rb, line 247
+# File lib/git/lib.rb, line 253
     def config_set(name, value)
       command('config', [name, "'#{value}'"])
     end
@@ -560,11 +683,11 @@ WRITE COMMANDS ##
         
-
- +
+ @@ -574,10 +697,10 @@ WRITE COMMANDS ## compares the index and the working directory

[Source]

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

+
-# File lib/git/lib.rb, line 189
+# File lib/git/lib.rb, line 195
     def diff_files
       hsh = {}
       command_lines('diff-files').each do |line|
@@ -593,21 +716,21 @@ compares the index and the working directory
         
-
- +
+

[Source]

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

+
-# File lib/git/lib.rb, line 159
+# File lib/git/lib.rb, line 165
     def diff_full(obj1 = 'HEAD', obj2 = nil, opts = {})
       diff_opts = ['-p']
       diff_opts << obj1
@@ -621,11 +744,11 @@ compares the index and the working directory
         
-
- +
+ @@ -635,10 +758,10 @@ compares the index and the working directory compares the index and the repository

[Source]

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

+
-# File lib/git/lib.rb, line 201
+# File lib/git/lib.rb, line 207
     def diff_index(treeish)
       hsh = {}
       command_lines('diff-index', treeish).each do |line|
@@ -654,21 +777,21 @@ compares the index and the repository
         
-
- +
+

[Source]

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

+
-# File lib/git/lib.rb, line 168
+# File lib/git/lib.rb, line 174
     def diff_stats(obj1 = 'HEAD', obj2 = nil, opts = {})
       diff_opts = ['--numstat']
       diff_opts << obj1
@@ -693,21 +816,21 @@ compares the index and the repository
         
-
- +
+

[Source]

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

+
-# File lib/git/lib.rb, line 331
+# File lib/git/lib.rb, line 337
     def fetch(remote)
       command('fetch', remote.to_s)
     end
@@ -716,11 +839,11 @@ compares the index and the repository
         
-
- +
+ @@ -738,10 +861,10 @@ returns hash

[Source]

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

+
-# File lib/git/lib.rb, line 140
+# File lib/git/lib.rb, line 146
     def grep(string, opts = {})
       opts[:object] = 'HEAD' if !opts[:object]
 
@@ -779,7 +902,7 @@ returns hash
             onclick="toggleCode('M000026-source');return false;">[Source]

-# File lib/git/lib.rb, line 25
+# File lib/git/lib.rb, line 27
     def init
       command('init')
     end
@@ -805,7 +928,7 @@ READ COMMANDS ##
             onclick="toggleCode('M000028-source');return false;">[Source]

-# File lib/git/lib.rb, line 59
+# File lib/git/lib.rb, line 61
     def log_commits(opts = {})
       arr_opts = ['--pretty=oneline']
       arr_opts << "-#{opts[:count]}" if opts[:count]
@@ -821,21 +944,21 @@ READ COMMANDS ##
         
-
- +
+

[Source]

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

+
-# File lib/git/lib.rb, line 212
+# File lib/git/lib.rb, line 218
     def ls_files
       hsh = {}
       command_lines('ls-files', '--stage').each do |line|
@@ -850,21 +973,21 @@ READ COMMANDS ##
         
-
- +
+

[Source]

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

+
-# File lib/git/lib.rb, line 112
+# File lib/git/lib.rb, line 118
     def ls_tree(sha)
       data = {'blob' => {}, 'tree' => {}}
       command_lines('ls-tree', sha.to_s).each do |line|
@@ -879,21 +1002,21 @@ READ COMMANDS ##
         
-
- +
+

[Source]

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

+
-# File lib/git/lib.rb, line 296
+# File lib/git/lib.rb, line 302
     def merge(branch, message = nil)      
       arr_opts = []
       arr_opts << ["-m '#{message}'"] if message
@@ -905,21 +1028,44 @@ READ COMMANDS ##
         
-
- +
+ + +
+

[Source]

+
+
+# File lib/git/lib.rb, line 76
+    def namerev(string)
+      command('name-rev', string).split[1]
+    end
+
+
+
+
+ +
+ + +

[Source]

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

+
-# File lib/git/lib.rb, line 108
+# File lib/git/lib.rb, line 114
     def object_contents(sha)
       command('cat-file', ['-p', sha])
     end
@@ -928,21 +1074,21 @@ READ COMMANDS ##
         
-
- +
+

[Source]

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

+
-# File lib/git/lib.rb, line 78
+# File lib/git/lib.rb, line 84
     def object_size(sha)
       command('cat-file', ['-s', sha]).to_i
     end
@@ -951,21 +1097,21 @@ READ COMMANDS ##
         
-
- +
+

[Source]

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

+
-# File lib/git/lib.rb, line 74
+# File lib/git/lib.rb, line 80
     def object_type(sha)
       command('cat-file', ['-t', sha])
     end
@@ -974,21 +1120,21 @@ READ COMMANDS ##
         
-
- +
+

[Source]

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

+
-# File lib/git/lib.rb, line 335
+# File lib/git/lib.rb, line 341
     def push(remote, branch = 'master')
       command('push', [remote.to_s, branch.to_s])
     end
@@ -997,21 +1143,50 @@ READ COMMANDS ##
         
-
- +
+ + +
+

+reads a tree into the current index file +

+

[Source]

+
+
+# File lib/git/lib.rb, line 354
+    def read_tree(treeish, opts = {})
+      arr_opts = []
+      arr_opts << "--prefix=#{opts[:prefix]}" if opts[:prefix]
+      arr_opts << treeish.to_a.join(' ')
+      command('read-tree', arr_opts)
+    end
+
+
+
+
+ +
+ + +

[Source]

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

+
-# File lib/git/lib.rb, line 303
+# File lib/git/lib.rb, line 309
     def remote_add(name, url, opts = {})
       arr_opts = ['add']
       arr_opts << '-f' if opts[:with_fetch]
@@ -1025,11 +1200,11 @@ READ COMMANDS ##
         
-
- +
+ @@ -1040,10 +1215,10 @@ this is documented as such, but seems broken for some reason i’ll try to get around it some other way later

[Source]

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

+
-# File lib/git/lib.rb, line 314
+# File lib/git/lib.rb, line 320
     def remote_remove(name)
       command('remote', ['rm', name])
     end
@@ -1052,21 +1227,21 @@ to get around it some other way later
         
-
- +
+

[Source]

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

+
-# File lib/git/lib.rb, line 318
+# File lib/git/lib.rb, line 324
     def remotes
       command_lines('remote')
     end
@@ -1075,21 +1250,21 @@ to get around it some other way later
         
-
- +
+

[Source]

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

+
-# File lib/git/lib.rb, line 256
+# File lib/git/lib.rb, line 262
     def remove(path = '.', opts = {})
       path = path.join(' ') if path.is_a?(Array)
 
@@ -1104,21 +1279,21 @@ to get around it some other way later
         
-
- +
+

[Source]

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

+
-# File lib/git/lib.rb, line 343
+# File lib/git/lib.rb, line 349
     def repack
       command('repack', ['-a', '-d'])
     end
@@ -1127,21 +1302,21 @@ to get around it some other way later
         
-
- +
+

[Source]

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

+
-# File lib/git/lib.rb, line 272
+# File lib/git/lib.rb, line 278
     def reset(commit, opts = {})
       arr_opts = []
       arr_opts << '--hard' if opts[:hard]
@@ -1167,7 +1342,7 @@ to get around it some other way later
             onclick="toggleCode('M000029-source');return false;">[Source]

-# File lib/git/lib.rb, line 70
+# File lib/git/lib.rb, line 72
     def revparse(string)
       command('rev-parse', string)
     end
@@ -1176,21 +1351,21 @@ to get around it some other way later
         
-
- +
+

[Source]

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

+
-# File lib/git/lib.rb, line 326
+# File lib/git/lib.rb, line 332
     def tag(tag)
       command('tag', tag)
     end
@@ -1199,21 +1374,21 @@ to get around it some other way later
         
-
- +
+

[Source]

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

+
-# File lib/git/lib.rb, line 339
+# File lib/git/lib.rb, line 345
     def tag_sha(tag_name)
       command('show-ref',  ['--tags', '-s', tag_name])
     end
@@ -1222,21 +1397,21 @@ to get around it some other way later
         
-
- +
+

[Source]

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

+
-# File lib/git/lib.rb, line 322
+# File lib/git/lib.rb, line 328
     def tags
       command_lines('tag')
     end
@@ -1245,6 +1420,52 @@ to get around it some other way later
         
+
+ + + + +
+

[Source]

+
+
+# File lib/git/lib.rb, line 379
+    def update_ref(branch, commit)
+      command('update-ref', [branch.to_s, commit.to_s])
+    end
+
+
+
+
+ +
+ + + + +
+

[Source]

+
+
+# File lib/git/lib.rb, line 361
+    def write_tree
+      command('write-tree')
+    end
+
+
+
+
+
-- cgit