class Agate::Refspec

Overview

A parsed refspec mapping local references to remote references.

rs = Refspec.parse("+refs/heads/*:refs/remotes/origin/*")
rs.src    # => "refs/heads/*"
rs.dst    # => "refs/remotes/origin/*"
rs.force? # => true
rs.fetch? # => true

rs.src_matches?("refs/heads/main") # => true
rs.transform("refs/heads/main")    # => "refs/remotes/origin/main"

Defined in:

agate/refspec.cr

Constructors

Class Method Summary

Instance Method Summary

Constructor Detail

def self.parse(input : String, fetch : Bool = true) : Refspec #

Parses a refspec string. Set fetch to true for a fetch refspec, false for a push refspec.


[View source]

Class Method Detail

def self.parse?(input : String, fetch : Bool = true) : Refspec | Nil #

Parses a refspec string, returning nil on failure.


[View source]

Instance Method Detail

def dst : String #

Returns the destination specifier (e.g., "refs/remotes/origin/*").


[View source]
def dst_matches?(refname : String) : Bool #

Returns true if the destination pattern matches the given reference name.


[View source]
def fetch? : Bool #

Returns true if this is a fetch refspec.


[View source]
def force? : Bool #

Returns true if this is a force-update refspec (prefixed with +).


[View source]
def push? : Bool #

Returns true if this is a push refspec.


[View source]
def rtransform(name : String) : String #

Transforms a destination reference name back to its source according to this refspec's rules (reverse transform).


[View source]
def src : String #

Returns the source specifier (e.g., "refs/heads/*").


[View source]
def src_matches?(refname : String) : Bool #

Returns true if the source pattern matches the given reference name.


[View source]
def to_s : String #

Returns the original refspec string.


[View source]
def transform(name : String) : String #

Transforms a source reference name to its destination according to this refspec's rules.


[View source]