pub enum RefsHint {
    PreferObjectOnFullLengthHexShaUseRefOtherwise,
    PreferObject,
    PreferRef,
    Fail,
}
Expand description

A hint to know what to do if refs and object names are equal.

Variants

PreferObjectOnFullLengthHexShaUseRefOtherwise

This is the default, and leads to specs that look like objects identified by full hex sha and are objets to be used instead of similarly named references. The latter is not typical but can absolutely happen by accident. If the object prefix is shorter than the maximum hash length of the repository, use the reference instead, which is preferred as there are many valid object names like beef and cafe that are short and both valid and typical prefixes for objects. Git chooses this as default as well, even though it means that every object prefix is also looked up as ref.

PreferObject

No matter what, if it looks like an object prefix and has an object, use it. Note that no ref-lookup is made here which is the fastest option.

PreferRef

When an object is found for a given prefix, also check if a reference exists with that name and if it does, use that moving forward.

Fail

If there is an ambiguous situation, instead of silently choosing one over the other, fail instead.

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The alignment of pointer.
The type for initializers.
Initializes a with the given initializer. Read more
Dereferences the given pointer. Read more
Mutably dereferences the given pointer. Read more
Drops the object pointed to by the given pointer. Read more
Should always be Self
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.