gi-ggit-1.0.1: libgit2-glib bindings

CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (garetxe@gmail.com)
Safe HaskellNone
LanguageHaskell2010

GI.Ggit.Objects.Ref

Contents

Description

Reprensents a git reference.

Synopsis

Exported types

toRef :: (MonadIO m, IsRef o) => o -> m Ref Source #

Methods

delete

refDelete Source #

Arguments

:: (HasCallStack, MonadIO m, IsRef a) 
=> a

ref: a Ref.

-> m ()

(Can throw GError)

Deletes ref.

This method works for both direct and symbolic references.

The reference will be immediately removed on disk and from memory. The given reference pointer will no longer be valid.

deleteLog

refDeleteLog Source #

Arguments

:: (HasCallStack, MonadIO m, IsRef a) 
=> a

ref: a Ref.

-> m ()

(Can throw GError)

Deletes the log for ref, on error error is set.

getLog

refGetLog Source #

Arguments

:: (HasCallStack, MonadIO m, IsRef a) 
=> a

ref: a Ref.

-> m Reflog

Returns: the reflog. (Can throw GError)

Gets the Reflog for ref. The reflog will be created if it doesn't exist yet.

getName

refGetName Source #

Arguments

:: (HasCallStack, MonadIO m, IsRef a) 
=> a

ref: a Ref.

-> m Text

Returns: the full name of a reference.

Gets the full name of ref.

getOwner

refGetOwner Source #

Arguments

:: (HasCallStack, MonadIO m, IsRef a) 
=> a

ref: a Ref.

-> m Repository

Returns: the repository where a reference resides.

Gets the repository where ref resides.

getReferenceType

refGetReferenceType Source #

Arguments

:: (HasCallStack, MonadIO m, IsRef a) 
=> a

ref: a Ref.

-> m RefType

Returns: the type of a reference.

Gets the type of ref. Either direct (GGIT_REF_OID) or symbolic (GGIT_REF_SYMBOLIC).

getShorthand

refGetShorthand Source #

Arguments

:: (HasCallStack, MonadIO m, IsRef a) 
=> a

ref: a Ref

-> m Text

Returns: the shorthand name of a reference.

Gets the shorthand name of ref.

getSymbolicTarget

refGetSymbolicTarget Source #

Arguments

:: (HasCallStack, MonadIO m, IsRef a) 
=> a

ref: a Ref.

-> m Text

Returns: the name if available, Nothing otherwise.

Get full name to the reference pointed to by a symbolic reference. Only available if the reference is symbolic.

getTarget

refGetTarget Source #

Arguments

:: (HasCallStack, MonadIO m, IsRef a) 
=> a

ref: a Ref.

-> m OId

Returns: a new oid if available, Nothing otherwise.

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).

hasLog

refHasLog Source #

Arguments

:: (HasCallStack, MonadIO m, IsRef a) 
=> a

ref: a Ref.

-> m Bool

Returns: True if ref has a log, False otherwise.

Get whether ref has an existing log.

isBranch

refIsBranch Source #

Arguments

:: (HasCallStack, MonadIO m, IsRef a) 
=> a

ref: a Ref.

-> m Bool

Returns: True if the reference is a branch, False otherwise.

Check whether the reference is a branch.

isNote

refIsNote Source #

Arguments

:: (HasCallStack, MonadIO m, IsRef a) 
=> a

ref: a Ref.

-> m Bool

Returns: True if the reference is a note, False otherwise.

Check whether the reference is a note.

isRemote

refIsRemote Source #

Arguments

:: (HasCallStack, MonadIO m, IsRef a) 
=> a

ref: a Ref.

-> m Bool

Returns: True if the reference is a remote, False otherwise.

Check whether the reference is a remote.

isTag

refIsTag Source #

Arguments

:: (HasCallStack, MonadIO m, IsRef a) 
=> a

ref: a Ref.

-> m Bool

Returns: True if the reference is a tag, False otherwise.

Check whether the reference is a tag.

isValidName

refIsValidName Source #

Arguments

:: (HasCallStack, MonadIO m) 
=> Text

name: the name to validate.

-> m Bool

Returns: True if name is valid, False otherwise.

Check if the given name is a valid name for a reference. Note that name should be the full ref name (including prefixes).

Valid toplevel names can contain only capital letters and underscores and must start and end with a letter (e.g. HEAD, ORIG_HEAD).

Valid refs/ names may contain any characters, except '~', '^', ':', '\', '?', '[', '*', ".." and "@{", because they are interpreted by revparse.

lookup

refLookup Source #

Arguments

:: (HasCallStack, MonadIO m, IsRef a) 
=> a

ref: a Ref.

-> m Object

Returns: a Object. (Can throw GError)

Convenient method to resolve a reference to an object.

rename

refRename Source #

Arguments

:: (HasCallStack, MonadIO m, IsRef a) 
=> a

ref: a Ref.

-> Text

newName: the new name.

-> Bool

force: True to force the renaming.

-> Text

logMessage: The one line long message to be appended to the reflog.

-> m Ref

Returns: a newly created Ref. (Can throw GError)

Rename an existing reference.

This method works for both direct and symbolic references.

The new name will be checked for validity. See ggit_ref_create_symbolic() for rules about valid names.

If not error, ref will be deleted from disk and a new Ref will be returned.

The reference will be immediately renamed in-memory and on disk.

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

IMPORTANT: The user needs to write a proper reflog entry if the reflog is enabled for the repository. We only rename the reflog if it exists.

resolve

refResolve Source #

Arguments

:: (HasCallStack, MonadIO m, IsRef a) 
=> a

ref: a Ref.

-> m Ref

Returns: the resolved reference to the peeled one. (Can throw GError)

Resolves a symbolic 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, that reference is returned immediately.

setSymbolicTarget

refSetSymbolicTarget Source #

Arguments

:: (HasCallStack, MonadIO m, IsRef a) 
=> a

ref: a Ref.

-> Text

target: The new target for the reference.

-> Text

logMessage: The one line long message to be appended to the reflog.

-> m Ref

Returns: the newly created Ref. (Can throw GError)

Create a new reference with the same name as the given reference but a different symbolic target. The reference must be a symbolic reference, otherwise this will fail.

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

The target name will be checked for validity. See ggit_ref_create_symbolic() for rules about valid names.

setTarget

refSetTarget Source #

Arguments

:: (HasCallStack, MonadIO m, IsRef a) 
=> a

ref: a Ref.

-> OId

oid: a OId.

-> Text

logMessage: The one line long message to be appended to the reflog.

-> m Ref

Returns: the newly created Ref. (Can throw GError)

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.

toString

refToString Source #

Arguments

:: (HasCallStack, MonadIO m, IsRef a) 
=> a

ref: a Ref.

-> m Text

Returns: a string representation of the ref.

Get a string representation of the ref.