diff options
author | scott Chacon <schacon@agadorsparticus.(none)> | 2007-11-11 16:01:23 -0800 |
---|---|---|
committer | scott Chacon <schacon@agadorsparticus.(none)> | 2007-11-11 16:01:23 -0800 |
commit | 907b03949bab53e2f7d55094100a71abd22f23e7 (patch) | |
tree | 51b7fca355ac7007957d966cbebbcbf331c57d7d /lib/git/lib.rb | |
parent | b81ee9305f418209ba0d77fbb7b47b23d4b121ca (diff) | |
download | third_party-ruby-git-907b03949bab53e2f7d55094100a71abd22f23e7.tar.gz third_party-ruby-git-907b03949bab53e2f7d55094100a71abd22f23e7.tar.xz third_party-ruby-git-907b03949bab53e2f7d55094100a71abd22f23e7.zip |
added tagging
Diffstat (limited to 'lib/git/lib.rb')
-rw-r--r-- | lib/git/lib.rb | 42 |
1 files changed, 40 insertions, 2 deletions
diff --git a/lib/git/lib.rb b/lib/git/lib.rb index 9b3922e..93490db 100644 --- a/lib/git/lib.rb +++ b/lib/git/lib.rb @@ -264,6 +264,43 @@ module Git command('merge', arr_opts) end + def remote_add(name, url, opts = {}) + arr_opts = ['add'] + arr_opts << '-f' if opts[:with_fetch] + arr_opts << name + arr_opts << url + + command('remote', arr_opts) + end + + # this is documented as such, but seems broken for some reason + # i'll try to get around it some other way later + def remote_remove(name) + command('remote', ['rm', name]) + end + + def remotes + command_lines('remote') + end + + def tags + command_lines('tag') + end + + def tag(tag) + command('tag', tag) + end + + + def fetch(remote) + command('fetch', remote.to_s) + end + + def tag_sha(tag_name) + command('show-ref', ['--tags', '-s', tag_name]) + end + + private @@ -278,19 +315,20 @@ module Git path = @git_work_dir || @git_dir || @path Dir.chdir(path) do opts = opts.to_a.join(' ') + git_cmd = "git #{cmd} #{opts}" out = `git #{cmd} #{opts} 2>&1`.chomp #puts path #puts "gd: #{@git_work_dir}" #puts "gi: #{@git_index_file}" #puts "pp: #{@path}" - #puts "git #{cmd} #{opts}" + #puts git_cmd #puts out #puts if $?.exitstatus > 0 if $?.exitstatus == 1 && out == '' return '' end - raise Git::GitExecuteError.new(out) + raise Git::GitExecuteError.new(git_cmd + out.to_s) end out end |