Skip to main content

Module refspec

Module refspec 

Source
Expand description

Refspec parsing and validation — a port of git/refspec.c.

A refspec describes how references map between a local and a remote repository. It has the general form [+|^]<src>[:<dst>]. This module parses a single refspec string and validates it according to the same rules as Git’s parse_refspec(), distinguishing fetch refspecs from push refspecs (the two have slightly different validity rules).

The primary entry points are parse_fetch_refspec and parse_push_refspec, which return RefspecItem on success or RefspecError::Invalid when the refspec is malformed. Callers that only care about validity (for example loading remote.<name>.fetch / remote.<name>.push config) can use valid_fetch_refspec and valid_push_refspec.

Structs§

RefspecItem
A parsed refspec item.

Enums§

RefspecError
Error returned when a refspec cannot be parsed.

Functions§

parse_fetch_refspec
Parse a fetch refspec, returning the parsed item or an error.
parse_push_refspec
Parse a push refspec, returning the parsed item or an error.
valid_fetch_refspec
Returns true when refspec is a valid fetch refspec.
valid_push_refspec
Returns true when refspec is a valid push refspec.