Module OID_Shorten

Class "OID_Shorten".

Functions

OID_Shorten.new (min_length) Create a new OID_Shorten object.
OID_Shorten:add (text_oid) object method.


Functions

OID_Shorten.new (min_length)
Create a new OID_Shorten object.

Calls git_oid_shorten_new:

The OID shortener is used to process a list of OIDs in text form and return the shortest length that would uniquely identify all of them.

E.g. look at the result of `git log --abbrev`.

Parameters

  • min_length: The minimal length for all identifiers, which will be used even if shorter OIDs would still be unique.. Must be of type integer.

Return value:

OID_Shorten.
OID_Shorten:add (text_oid)
object method.

Calls git_oid_shorten_add:

The OID is expected to be a 40-char hexadecimal string. The OID is owned by the user and will not be modified or freed.

For performance reasons, there is a hard-limit of how many OIDs can be added to a single set (around ~22000, assuming a mostly randomized distribution), which should be enough for any kind of program, and keeps the algorithm fast and memory-efficient.

Attempting to add more than those OIDs will result in a GIT_ENOMEM error

Parameters

  • text_oid: an OID in text form. Must be of type string.

Return values:

  1. true if no error.
  2. Error string.

Valid XHTML 1.0!