class
Agate::Refspec
- Agate::Refspec
- Reference
- Object
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.crConstructors
-
.parse(input : String, fetch : Bool = true) : Refspec
Parses a refspec string.
Class Method Summary
-
.parse?(input : String, fetch : Bool = true) : Refspec | Nil
Parses a refspec string, returning nil on failure.
Instance Method Summary
-
#dst : String
Returns the destination specifier (e.g., "refs/remotes/origin/*").
-
#dst_matches?(refname : String) : Bool
Returns true if the destination pattern matches the given reference name.
-
#fetch? : Bool
Returns true if this is a fetch refspec.
-
#force? : Bool
Returns true if this is a force-update refspec (prefixed with +).
-
#push? : Bool
Returns true if this is a push refspec.
-
#rtransform(name : String) : String
Transforms a destination reference name back to its source according to this refspec's rules (reverse transform).
-
#src : String
Returns the source specifier (e.g., "refs/heads/*").
-
#src_matches?(refname : String) : Bool
Returns true if the source pattern matches the given reference name.
-
#to_s : String
Returns the original refspec string.
-
#transform(name : String) : String
Transforms a source reference name to its destination according to this refspec's rules.
Constructor Detail
Parses a refspec string. Set fetch to true for a fetch refspec, false for a push refspec.
Class Method Detail
Parses a refspec string, returning nil on failure.
Instance Method Detail
Returns true if the destination pattern matches the given reference name.
Transforms a destination reference name back to its source according to this refspec's rules (reverse transform).
Returns true if the source pattern matches the given reference name.
Transforms a source reference name to its destination according to this refspec's rules.