class Agate::Remote

Overview

Represents a git remote.

Defined in:

agate/remote.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.lookup(repo : Repository, name : String) : Remote #

Looks up a remote by name. Raises on failure.


[View source]

Class Method Detail

def self.lookup?(repo : Repository, name : String) : Remote | Nil #

Looks up a remote by name, returning nil if not found.


[View source]
def self.valid_name?(name : String) : Bool #

Returns true if the given name is valid for a remote.


[View source]

Instance Method Detail

def check_connection(direction : Direction = Direction::Fetch, credentials : Credentials::Provider | Nil = nil) : Bool #

Checks if a connection to the remote can be established.


[View source]
def fetch(refspecs : Array(String) | Nil = nil, credentials : Credentials::Provider | Nil = nil, reflog_message : String | Nil = nil, &block : String, String | Nil, UInt32 -> Credentials::Credential | Nil) : Nil #

Fetches from this remote. Accepts an optional credential provider or a block for dynamic credential resolution.


[View source]
def fetch(refspecs : Array(String) | Nil = nil, credentials : Credentials::Provider | Nil = nil, reflog_message : String | Nil = nil) : Nil #

Fetches from this remote. Accepts an optional credential provider or a block for dynamic credential resolution.


[View source]
def fetch_refspecs : Array(String) #

Returns the fetch refspecs.


[View source]
def ls : Array(Tuple(OID, String)) #

Lists the remote references after connecting. The remote must already be connected (via #fetch, #push, or #check_connection).

Returns an array of {oid, name} pairs.

remote.check_connection
remote.ls.each do |oid, name|
  puts "#{name} -> #{oid}"
end

[View source]
def name : String | Nil #

Returns the remote name, or nil for anonymous remotes.


[View source]
def push(refspecs : Array(String) | Nil = nil, credentials : Credentials::Provider | Nil = nil, &block : String, String | Nil, UInt32 -> Credentials::Credential | Nil) : Nil #

Pushes to this remote. Accepts an optional credential provider or a block for dynamic credential resolution.


[View source]
def push(refspecs : Array(String) | Nil = nil, credentials : Credentials::Provider | Nil = nil) : Nil #

Pushes to this remote. Accepts an optional credential provider or a block for dynamic credential resolution.


[View source]
def push_refspecs : Array(String) #

Returns the push refspecs.


[View source]
def push_url : String | Nil #

Returns the push URL, or nil if not set (uses fetch URL).


[View source]
def url : String #

Returns the fetch URL.


[View source]