gi-ggit-1.0.7: libgit2-glib bindings

CopyrightWill Thompson Iñaki García Etxebarria and Jonas Platte
LicenseLGPL-2.1
MaintainerIñaki García Etxebarria (inaki@blueleaf.cc)
Safe HaskellNone
LanguageHaskell2010

GI.Ggit.Objects.Ref

Contents

Description

Reprensents a git reference.

Synopsis

Exported types

newtype Ref Source #

Memory-managed wrapper type.

Constructors

Ref (ManagedPtr Ref) 
Instances
GObject Ref Source # 
Instance details

Defined in GI.Ggit.Objects.Ref

Methods

gobjectType :: IO GType #

HasParentTypes Ref Source # 
Instance details

Defined in GI.Ggit.Objects.Ref

type ParentTypes Ref Source # 
Instance details

Defined in GI.Ggit.Objects.Ref

type ParentTypes Ref = Native ': (ObjectFactoryBase ': (Object ': ([] :: [Type])))

class (GObject o, IsDescendantOf Ref o) => IsRef o Source #

Type class for types which can be safely cast to Ref, for instance with toRef.

Instances
(GObject o, IsDescendantOf Ref o) => IsRef o Source # 
Instance details

Defined in GI.Ggit.Objects.Ref

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

Cast to Ref, for types for which this is known to be safe. For general casts, use castTo.

noRef :: Maybe Ref Source #

A convenience alias for Nothing :: Maybe Ref.

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 (Maybe Reflog)

Returns: the reflog or Nothing. (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 (Maybe Text)

Returns: the full name of a reference or Nothing.

Gets the full name of ref.

getOwner

refGetOwner Source #

Arguments

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

ref: a Ref.

-> m (Maybe Repository)

Returns: the repository where a reference resides or Nothing.

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 (Maybe Text)

Returns: the shorthand name of a reference or Nothing.

Gets the shorthand name of ref.

getSymbolicTarget

refGetSymbolicTarget Source #

Arguments

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

ref: a Ref.

-> m (Maybe 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 (Maybe 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 (Maybe Object)

Returns: a Object or Nothing. (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 (Maybe Ref)

Returns: a newly created Ref or Nothing. (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 (Maybe Ref)

Returns: the resolved reference to the peeled one or Nothing. (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 (Maybe Ref)

Returns: the newly created Ref or Nothing. (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 (Maybe Ref)

Returns: the newly created Ref or Nothing. (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 (Maybe Text)

Returns: a string representation of the ref or Nothing.

Get a string representation of the ref.