Struct git2::Reference [] [src]

pub struct Reference<'repo> { /* fields omitted */ }

A structure to represent a git reference.

Methods

impl<'repo> Reference<'repo>
[src]

[src]

Ensure the reference name is well-formed.

[src]

Get access to the underlying raw pointer.

[src]

Delete an existing reference.

This method works for both direct and symbolic references. The reference will be immediately removed on disk.

This function will return an error if the reference has changed from the time it was looked up.

[src]

Check if a reference is a local branch.

[src]

Check if a reference is a note.

[src]

Check if a reference is a remote tracking branch

[src]

Check if a reference is a tag

[src]

Get the reference type of a reference.

If the type is unknown, then None is returned.

[src]

Get the full name of a reference.

Returns None if the name is not valid utf-8.

[src]

Get the full name of a reference.

[src]

Get the full shorthand of a reference.

This will transform the reference name into a name "human-readable" version. If no shortname is appropriate, it will return the full name.

Returns None if the shorthand is not valid utf-8.

[src]

Get the full shorthand of a reference.

[src]

Get the OID pointed to by a direct reference.

Only available if the reference is direct (i.e. an object id reference, not a symbolic one).

[src]

Return the peeled OID target of this reference.

This peeled OID only applies to direct references that point to a hard Tag object: it is the result of peeling such Tag.

[src]

Get full name to the reference pointed to by a symbolic reference.

May return None if the reference is either not symbolic or not a valid utf-8 string.

[src]

Get full name to the reference pointed to by a symbolic reference.

Only available if the reference is symbolic.

[src]

Resolve a symbolic reference to a direct reference.

This method iteratively peels a symbolic reference until it resolves to a direct reference to an OID.

If a direct reference is passed as an argument, a copy of that reference is returned.

[src]

Peel a reference to an object

This method recursively peels the reference until it reaches an object of the specified type.

[src]

Peel a reference to a blob

This method recursively peels the reference until it reaches a blob.

[src]

Peel a reference to a commit

This method recursively peels the reference until it reaches a blob.

[src]

Peel a reference to a tree

This method recursively peels the reference until it reaches a blob.

[src]

Peel a reference to a tag

This method recursively peels the reference until it reaches a tag.

[src]

Rename an existing reference.

This method works for both direct and symbolic references.

If the force flag is not enabled, and there's already a reference with the given name, the renaming will fail.

[src]

Conditionally create a new reference with the same name as the given reference but a different OID target. The reference must be a direct reference, otherwise this will fail.

The new reference will be written to disk, overwriting the given reference.

Trait Implementations

impl<'repo> PartialOrd for Reference<'repo>
[src]

[src]

This method returns an ordering between self and other values if one exists. Read more

1.0.0
[src]

This method tests less than (for self and other) and is used by the < operator. Read more

1.0.0
[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

1.0.0
[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

1.0.0
[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<'repo> Ord for Reference<'repo>
[src]

[src]

This method returns an Ordering between self and other. Read more

1.22.0
[src]

Compares and returns the maximum of two values. Read more

1.22.0
[src]

Compares and returns the minimum of two values. Read more

impl<'repo> PartialEq for Reference<'repo>
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

1.0.0
[src]

This method tests for !=.

impl<'repo> Eq for Reference<'repo>
[src]

impl<'repo> Drop for Reference<'repo>
[src]

[src]

Executes the destructor for this type. Read more