{- |
Copyright  : Will Thompson, Iñaki García Etxebarria and Jonas Platte
License    : LGPL-2.1
Maintainer : Iñaki García Etxebarria (inaki@blueleaf.cc)

Represents a blame hunk.
-}

#define ENABLE_OVERLOADING (MIN_VERSION_haskell_gi_overloading(1,0,0) \
       && !defined(__HADDOCK_VERSION__))

module GI.Ggit.Structs.BlameHunk
    (

-- * Exported types
    BlameHunk(..)                           ,
    noBlameHunk                             ,


 -- * Methods
-- ** getFinalCommitId #method:getFinalCommitId#

#if ENABLE_OVERLOADING
    BlameHunkGetFinalCommitIdMethodInfo     ,
#endif
    blameHunkGetFinalCommitId               ,


-- ** getFinalSignature #method:getFinalSignature#

#if ENABLE_OVERLOADING
    BlameHunkGetFinalSignatureMethodInfo    ,
#endif
    blameHunkGetFinalSignature              ,


-- ** getFinalStartLineNumber #method:getFinalStartLineNumber#

#if ENABLE_OVERLOADING
    BlameHunkGetFinalStartLineNumberMethodInfo,
#endif
    blameHunkGetFinalStartLineNumber        ,


-- ** getLinesInHunk #method:getLinesInHunk#

#if ENABLE_OVERLOADING
    BlameHunkGetLinesInHunkMethodInfo       ,
#endif
    blameHunkGetLinesInHunk                 ,


-- ** getOrigCommitId #method:getOrigCommitId#

#if ENABLE_OVERLOADING
    BlameHunkGetOrigCommitIdMethodInfo      ,
#endif
    blameHunkGetOrigCommitId                ,


-- ** getOrigPath #method:getOrigPath#

#if ENABLE_OVERLOADING
    BlameHunkGetOrigPathMethodInfo          ,
#endif
    blameHunkGetOrigPath                    ,


-- ** getOrigSignature #method:getOrigSignature#

#if ENABLE_OVERLOADING
    BlameHunkGetOrigSignatureMethodInfo     ,
#endif
    blameHunkGetOrigSignature               ,


-- ** getOrigStartLineNumber #method:getOrigStartLineNumber#

#if ENABLE_OVERLOADING
    BlameHunkGetOrigStartLineNumberMethodInfo,
#endif
    blameHunkGetOrigStartLineNumber         ,


-- ** isBoundary #method:isBoundary#

#if ENABLE_OVERLOADING
    BlameHunkIsBoundaryMethodInfo           ,
#endif
    blameHunkIsBoundary                     ,


-- ** ref #method:ref#

#if ENABLE_OVERLOADING
    BlameHunkRefMethodInfo                  ,
#endif
    blameHunkRef                            ,


-- ** unref #method:unref#

#if ENABLE_OVERLOADING
    BlameHunkUnrefMethodInfo                ,
#endif
    blameHunkUnref                          ,




    ) where

import Data.GI.Base.ShortPrelude
import qualified Data.GI.Base.ShortPrelude as SP
import qualified Data.GI.Base.Overloading as O
import qualified Prelude as P

import qualified Data.GI.Base.Attributes as GI.Attributes
import qualified Data.GI.Base.ManagedPtr as B.ManagedPtr
import qualified Data.GI.Base.GClosure as B.GClosure
import qualified Data.GI.Base.GError as B.GError
import qualified Data.GI.Base.GVariant as B.GVariant
import qualified Data.GI.Base.GValue as B.GValue
import qualified Data.GI.Base.GParamSpec as B.GParamSpec
import qualified Data.GI.Base.CallStack as B.CallStack
import qualified Data.GI.Base.Properties as B.Properties
import qualified Data.Text as T
import qualified Data.ByteString.Char8 as B
import qualified Data.Map as Map
import qualified Foreign.Ptr as FP
import qualified GHC.OverloadedLabels as OL

import {-# SOURCE #-} qualified GI.Ggit.Objects.Signature as Ggit.Signature
import {-# SOURCE #-} qualified GI.Ggit.Structs.OId as Ggit.OId

-- | Memory-managed wrapper type.
newtype BlameHunk = BlameHunk (ManagedPtr BlameHunk)
foreign import ccall "ggit_blame_hunk_get_type" c_ggit_blame_hunk_get_type ::
    IO GType

instance BoxedObject BlameHunk where
    boxedType _ = c_ggit_blame_hunk_get_type

-- | A convenience alias for `Nothing` :: `Maybe` `BlameHunk`.
noBlameHunk :: Maybe BlameHunk
noBlameHunk = Nothing


#if ENABLE_OVERLOADING
instance O.HasAttributeList BlameHunk
type instance O.AttributeList BlameHunk = BlameHunkAttributeList
type BlameHunkAttributeList = ('[ ] :: [(Symbol, *)])
#endif

-- method BlameHunk::get_final_commit_id
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "blame_hunk", argType = TInterface (Name {namespace = "Ggit", name = "BlameHunk"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitBlameHunk.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Ggit", name = "OId"}))
-- throws : False
-- Skip return : False

foreign import ccall "ggit_blame_hunk_get_final_commit_id" ggit_blame_hunk_get_final_commit_id ::
    Ptr BlameHunk ->                        -- blame_hunk : TInterface (Name {namespace = "Ggit", name = "BlameHunk"})
    IO (Ptr Ggit.OId.OId)

{- |
Get the id of the commit where this hunk was last changed.
-}
blameHunkGetFinalCommitId ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BlameHunk
    {- ^ /@blameHunk@/: a 'GI.Ggit.Structs.BlameHunk.BlameHunk'. -}
    -> m (Maybe Ggit.OId.OId)
    {- ^ __Returns:__ a 'GI.Ggit.Structs.OId.OId' or 'Nothing'. -}
blameHunkGetFinalCommitId blameHunk = liftIO $ do
    blameHunk' <- unsafeManagedPtrGetPtr blameHunk
    result <- ggit_blame_hunk_get_final_commit_id blameHunk'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newBoxed Ggit.OId.OId) result'
        return result''
    touchManagedPtr blameHunk
    return maybeResult

#if ENABLE_OVERLOADING
data BlameHunkGetFinalCommitIdMethodInfo
instance (signature ~ (m (Maybe Ggit.OId.OId)), MonadIO m) => O.MethodInfo BlameHunkGetFinalCommitIdMethodInfo BlameHunk signature where
    overloadedMethod _ = blameHunkGetFinalCommitId

#endif

-- method BlameHunk::get_final_signature
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "blame_hunk", argType = TInterface (Name {namespace = "Ggit", name = "BlameHunk"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitBlameHunk.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Ggit", name = "Signature"}))
-- throws : False
-- Skip return : False

foreign import ccall "ggit_blame_hunk_get_final_signature" ggit_blame_hunk_get_final_signature ::
    Ptr BlameHunk ->                        -- blame_hunk : TInterface (Name {namespace = "Ggit", name = "BlameHunk"})
    IO (Ptr Ggit.Signature.Signature)

{- |
Get the signature of the final version of the hunk.
-}
blameHunkGetFinalSignature ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BlameHunk
    {- ^ /@blameHunk@/: a 'GI.Ggit.Structs.BlameHunk.BlameHunk'. -}
    -> m (Maybe Ggit.Signature.Signature)
    {- ^ __Returns:__ a 'GI.Ggit.Objects.Signature.Signature' or 'Nothing'. -}
blameHunkGetFinalSignature blameHunk = liftIO $ do
    blameHunk' <- unsafeManagedPtrGetPtr blameHunk
    result <- ggit_blame_hunk_get_final_signature blameHunk'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newObject Ggit.Signature.Signature) result'
        return result''
    touchManagedPtr blameHunk
    return maybeResult

#if ENABLE_OVERLOADING
data BlameHunkGetFinalSignatureMethodInfo
instance (signature ~ (m (Maybe Ggit.Signature.Signature)), MonadIO m) => O.MethodInfo BlameHunkGetFinalSignatureMethodInfo BlameHunk signature where
    overloadedMethod _ = blameHunkGetFinalSignature

#endif

-- method BlameHunk::get_final_start_line_number
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "blame_hunk", argType = TInterface (Name {namespace = "Ggit", name = "BlameHunk"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitBlameHunk.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt16)
-- throws : False
-- Skip return : False

foreign import ccall "ggit_blame_hunk_get_final_start_line_number" ggit_blame_hunk_get_final_start_line_number ::
    Ptr BlameHunk ->                        -- blame_hunk : TInterface (Name {namespace = "Ggit", name = "BlameHunk"})
    IO Word16

{- |
Get the line number where the hunk begins in the final version of the file.
Line numbers start at 1.
-}
blameHunkGetFinalStartLineNumber ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BlameHunk
    {- ^ /@blameHunk@/: a 'GI.Ggit.Structs.BlameHunk.BlameHunk'. -}
    -> m Word16
    {- ^ __Returns:__ the final hunk line number. -}
blameHunkGetFinalStartLineNumber blameHunk = liftIO $ do
    blameHunk' <- unsafeManagedPtrGetPtr blameHunk
    result <- ggit_blame_hunk_get_final_start_line_number blameHunk'
    touchManagedPtr blameHunk
    return result

#if ENABLE_OVERLOADING
data BlameHunkGetFinalStartLineNumberMethodInfo
instance (signature ~ (m Word16), MonadIO m) => O.MethodInfo BlameHunkGetFinalStartLineNumberMethodInfo BlameHunk signature where
    overloadedMethod _ = blameHunkGetFinalStartLineNumber

#endif

-- method BlameHunk::get_lines_in_hunk
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "blame_hunk", argType = TInterface (Name {namespace = "Ggit", name = "BlameHunk"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitBlameHunk.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt16)
-- throws : False
-- Skip return : False

foreign import ccall "ggit_blame_hunk_get_lines_in_hunk" ggit_blame_hunk_get_lines_in_hunk ::
    Ptr BlameHunk ->                        -- blame_hunk : TInterface (Name {namespace = "Ggit", name = "BlameHunk"})
    IO Word16

{- |
Get the number of lines in the hunk.
-}
blameHunkGetLinesInHunk ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BlameHunk
    {- ^ /@blameHunk@/: a 'GI.Ggit.Structs.BlameHunk.BlameHunk'. -}
    -> m Word16
    {- ^ __Returns:__ the number of lines in the hunk. -}
blameHunkGetLinesInHunk blameHunk = liftIO $ do
    blameHunk' <- unsafeManagedPtrGetPtr blameHunk
    result <- ggit_blame_hunk_get_lines_in_hunk blameHunk'
    touchManagedPtr blameHunk
    return result

#if ENABLE_OVERLOADING
data BlameHunkGetLinesInHunkMethodInfo
instance (signature ~ (m Word16), MonadIO m) => O.MethodInfo BlameHunkGetLinesInHunkMethodInfo BlameHunk signature where
    overloadedMethod _ = blameHunkGetLinesInHunk

#endif

-- method BlameHunk::get_orig_commit_id
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "blame_hunk", argType = TInterface (Name {namespace = "Ggit", name = "BlameHunk"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitBlameHunk.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Ggit", name = "OId"}))
-- throws : False
-- Skip return : False

foreign import ccall "ggit_blame_hunk_get_orig_commit_id" ggit_blame_hunk_get_orig_commit_id ::
    Ptr BlameHunk ->                        -- blame_hunk : TInterface (Name {namespace = "Ggit", name = "BlameHunk"})
    IO (Ptr Ggit.OId.OId)

{- |
Get the id of the commit where the hunk was found. This is usually the same
the final commit id, except when @/GGIT_BLAME_TRACK_COPIES_ANY_COMMIT/@ was used.
-}
blameHunkGetOrigCommitId ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BlameHunk
    {- ^ /@blameHunk@/: a 'GI.Ggit.Structs.BlameHunk.BlameHunk'. -}
    -> m (Maybe Ggit.OId.OId)
    {- ^ __Returns:__ a 'GI.Ggit.Structs.OId.OId' or 'Nothing'. -}
blameHunkGetOrigCommitId blameHunk = liftIO $ do
    blameHunk' <- unsafeManagedPtrGetPtr blameHunk
    result <- ggit_blame_hunk_get_orig_commit_id blameHunk'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newBoxed Ggit.OId.OId) result'
        return result''
    touchManagedPtr blameHunk
    return maybeResult

#if ENABLE_OVERLOADING
data BlameHunkGetOrigCommitIdMethodInfo
instance (signature ~ (m (Maybe Ggit.OId.OId)), MonadIO m) => O.MethodInfo BlameHunkGetOrigCommitIdMethodInfo BlameHunk signature where
    overloadedMethod _ = blameHunkGetOrigCommitId

#endif

-- method BlameHunk::get_orig_path
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "blame_hunk", argType = TInterface (Name {namespace = "Ggit", name = "BlameHunk"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitBlameHunk.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUTF8)
-- throws : False
-- Skip return : False

foreign import ccall "ggit_blame_hunk_get_orig_path" ggit_blame_hunk_get_orig_path ::
    Ptr BlameHunk ->                        -- blame_hunk : TInterface (Name {namespace = "Ggit", name = "BlameHunk"})
    IO CString

{- |
Get the path of the file where this hunk originated, as of the commit
specified by @/ggit_blame_hunk_get_orig_commit_id/@.
-}
blameHunkGetOrigPath ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BlameHunk
    {- ^ /@blameHunk@/: a 'GI.Ggit.Structs.BlameHunk.BlameHunk'. -}
    -> m (Maybe T.Text)
    {- ^ __Returns:__ the path or 'Nothing'. -}
blameHunkGetOrigPath blameHunk = liftIO $ do
    blameHunk' <- unsafeManagedPtrGetPtr blameHunk
    result <- ggit_blame_hunk_get_orig_path blameHunk'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- cstringToText result'
        return result''
    touchManagedPtr blameHunk
    return maybeResult

#if ENABLE_OVERLOADING
data BlameHunkGetOrigPathMethodInfo
instance (signature ~ (m (Maybe T.Text)), MonadIO m) => O.MethodInfo BlameHunkGetOrigPathMethodInfo BlameHunk signature where
    overloadedMethod _ = blameHunkGetOrigPath

#endif

-- method BlameHunk::get_orig_signature
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "blame_hunk", argType = TInterface (Name {namespace = "Ggit", name = "BlameHunk"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitBlameHunk.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Ggit", name = "Signature"}))
-- throws : False
-- Skip return : False

foreign import ccall "ggit_blame_hunk_get_orig_signature" ggit_blame_hunk_get_orig_signature ::
    Ptr BlameHunk ->                        -- blame_hunk : TInterface (Name {namespace = "Ggit", name = "BlameHunk"})
    IO (Ptr Ggit.Signature.Signature)

{- |
Get the signature of the commit specified by @/ggit_blame_hunk_get_orig_commit_id/@.
-}
blameHunkGetOrigSignature ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BlameHunk
    {- ^ /@blameHunk@/: a 'GI.Ggit.Structs.BlameHunk.BlameHunk'. -}
    -> m (Maybe Ggit.Signature.Signature)
    {- ^ __Returns:__ a 'GI.Ggit.Objects.Signature.Signature' or 'Nothing'. -}
blameHunkGetOrigSignature blameHunk = liftIO $ do
    blameHunk' <- unsafeManagedPtrGetPtr blameHunk
    result <- ggit_blame_hunk_get_orig_signature blameHunk'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newObject Ggit.Signature.Signature) result'
        return result''
    touchManagedPtr blameHunk
    return maybeResult

#if ENABLE_OVERLOADING
data BlameHunkGetOrigSignatureMethodInfo
instance (signature ~ (m (Maybe Ggit.Signature.Signature)), MonadIO m) => O.MethodInfo BlameHunkGetOrigSignatureMethodInfo BlameHunk signature where
    overloadedMethod _ = blameHunkGetOrigSignature

#endif

-- method BlameHunk::get_orig_start_line_number
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "blame_hunk", argType = TInterface (Name {namespace = "Ggit", name = "BlameHunk"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitBlameHunk.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TUInt16)
-- throws : False
-- Skip return : False

foreign import ccall "ggit_blame_hunk_get_orig_start_line_number" ggit_blame_hunk_get_orig_start_line_number ::
    Ptr BlameHunk ->                        -- blame_hunk : TInterface (Name {namespace = "Ggit", name = "BlameHunk"})
    IO Word16

{- |
Get the line number where the hunk begins in the file specified by
@/ggit_blame_hunk_get_orig_path/@ at the commit specified by
@/ggit_blame_hunk_get_orig_commit_id/@. Line numbers start at 1.
-}
blameHunkGetOrigStartLineNumber ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BlameHunk
    {- ^ /@blameHunk@/: a 'GI.Ggit.Structs.BlameHunk.BlameHunk'. -}
    -> m Word16
    {- ^ __Returns:__ the orig hunk line number. -}
blameHunkGetOrigStartLineNumber blameHunk = liftIO $ do
    blameHunk' <- unsafeManagedPtrGetPtr blameHunk
    result <- ggit_blame_hunk_get_orig_start_line_number blameHunk'
    touchManagedPtr blameHunk
    return result

#if ENABLE_OVERLOADING
data BlameHunkGetOrigStartLineNumberMethodInfo
instance (signature ~ (m Word16), MonadIO m) => O.MethodInfo BlameHunkGetOrigStartLineNumberMethodInfo BlameHunk signature where
    overloadedMethod _ = blameHunkGetOrigStartLineNumber

#endif

-- method BlameHunk::is_boundary
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "blame_hunk", argType = TInterface (Name {namespace = "Ggit", name = "BlameHunk"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitBlameHunk.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TBasicType TBoolean)
-- throws : False
-- Skip return : False

foreign import ccall "ggit_blame_hunk_is_boundary" ggit_blame_hunk_is_boundary ::
    Ptr BlameHunk ->                        -- blame_hunk : TInterface (Name {namespace = "Ggit", name = "BlameHunk"})
    IO CInt

{- |
Get whether the hunk has been tracked to a boundary commit (the root,
or the commit specified in @/ggit_blame_options_set_oldest_commit/@).
-}
blameHunkIsBoundary ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BlameHunk
    {- ^ /@blameHunk@/: a 'GI.Ggit.Structs.BlameHunk.BlameHunk'. -}
    -> m Bool
    {- ^ __Returns:__ whether the hunk is at a boundary commit. -}
blameHunkIsBoundary blameHunk = liftIO $ do
    blameHunk' <- unsafeManagedPtrGetPtr blameHunk
    result <- ggit_blame_hunk_is_boundary blameHunk'
    let result' = (/= 0) result
    touchManagedPtr blameHunk
    return result'

#if ENABLE_OVERLOADING
data BlameHunkIsBoundaryMethodInfo
instance (signature ~ (m Bool), MonadIO m) => O.MethodInfo BlameHunkIsBoundaryMethodInfo BlameHunk signature where
    overloadedMethod _ = blameHunkIsBoundary

#endif

-- method BlameHunk::ref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "blame_hunk", argType = TInterface (Name {namespace = "Ggit", name = "BlameHunk"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitBlameHunk.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Just (TInterface (Name {namespace = "Ggit", name = "BlameHunk"}))
-- throws : False
-- Skip return : False

foreign import ccall "ggit_blame_hunk_ref" ggit_blame_hunk_ref ::
    Ptr BlameHunk ->                        -- blame_hunk : TInterface (Name {namespace = "Ggit", name = "BlameHunk"})
    IO (Ptr BlameHunk)

{- |
Atomically increments the reference count of /@blameHunk@/ by one.
This function is MT-safe and may be called from any thread.
-}
blameHunkRef ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BlameHunk
    {- ^ /@blameHunk@/: a 'GI.Ggit.Structs.BlameHunk.BlameHunk'. -}
    -> m (Maybe BlameHunk)
    {- ^ __Returns:__ a 'GI.Ggit.Structs.BlameHunk.BlameHunk' or 'Nothing'. -}
blameHunkRef blameHunk = liftIO $ do
    blameHunk' <- unsafeManagedPtrGetPtr blameHunk
    result <- ggit_blame_hunk_ref blameHunk'
    maybeResult <- convertIfNonNull result $ \result' -> do
        result'' <- (newBoxed BlameHunk) result'
        return result''
    touchManagedPtr blameHunk
    return maybeResult

#if ENABLE_OVERLOADING
data BlameHunkRefMethodInfo
instance (signature ~ (m (Maybe BlameHunk)), MonadIO m) => O.MethodInfo BlameHunkRefMethodInfo BlameHunk signature where
    overloadedMethod _ = blameHunkRef

#endif

-- method BlameHunk::unref
-- method type : OrdinaryMethod
-- Args : [Arg {argCName = "blame_hunk", argType = TInterface (Name {namespace = "Ggit", name = "BlameHunk"}), direction = DirectionIn, mayBeNull = False, argDoc = Documentation {rawDocText = Just "a #GgitBlameHunk.", sinceVersion = Nothing}, argScope = ScopeTypeInvalid, argClosure = -1, argDestroy = -1, argCallerAllocates = False, transfer = TransferNothing}]
-- Lengths : []
-- returnType : Nothing
-- throws : False
-- Skip return : False

foreign import ccall "ggit_blame_hunk_unref" ggit_blame_hunk_unref ::
    Ptr BlameHunk ->                        -- blame_hunk : TInterface (Name {namespace = "Ggit", name = "BlameHunk"})
    IO ()

{- |
Atomically decrements the reference count of /@blameHunk@/ by one.
If the reference count drops to 0, /@blameHunk@/ is freed.
-}
blameHunkUnref ::
    (B.CallStack.HasCallStack, MonadIO m) =>
    BlameHunk
    {- ^ /@blameHunk@/: a 'GI.Ggit.Structs.BlameHunk.BlameHunk'. -}
    -> m ()
blameHunkUnref blameHunk = liftIO $ do
    blameHunk' <- unsafeManagedPtrGetPtr blameHunk
    ggit_blame_hunk_unref blameHunk'
    touchManagedPtr blameHunk
    return ()

#if ENABLE_OVERLOADING
data BlameHunkUnrefMethodInfo
instance (signature ~ (m ()), MonadIO m) => O.MethodInfo BlameHunkUnrefMethodInfo BlameHunk signature where
    overloadedMethod _ = blameHunkUnref

#endif

#if ENABLE_OVERLOADING
type family ResolveBlameHunkMethod (t :: Symbol) (o :: *) :: * where
    ResolveBlameHunkMethod "isBoundary" o = BlameHunkIsBoundaryMethodInfo
    ResolveBlameHunkMethod "ref" o = BlameHunkRefMethodInfo
    ResolveBlameHunkMethod "unref" o = BlameHunkUnrefMethodInfo
    ResolveBlameHunkMethod "getFinalCommitId" o = BlameHunkGetFinalCommitIdMethodInfo
    ResolveBlameHunkMethod "getFinalSignature" o = BlameHunkGetFinalSignatureMethodInfo
    ResolveBlameHunkMethod "getFinalStartLineNumber" o = BlameHunkGetFinalStartLineNumberMethodInfo
    ResolveBlameHunkMethod "getLinesInHunk" o = BlameHunkGetLinesInHunkMethodInfo
    ResolveBlameHunkMethod "getOrigCommitId" o = BlameHunkGetOrigCommitIdMethodInfo
    ResolveBlameHunkMethod "getOrigPath" o = BlameHunkGetOrigPathMethodInfo
    ResolveBlameHunkMethod "getOrigSignature" o = BlameHunkGetOrigSignatureMethodInfo
    ResolveBlameHunkMethod "getOrigStartLineNumber" o = BlameHunkGetOrigStartLineNumberMethodInfo
    ResolveBlameHunkMethod l o = O.MethodResolutionFailed l o

instance (info ~ ResolveBlameHunkMethod t BlameHunk, O.MethodInfo info BlameHunk p) => OL.IsLabel t (BlameHunk -> p) where
#if MIN_VERSION_base(4,10,0)
    fromLabel = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#else
    fromLabel _ = O.overloadedMethod (O.MethodProxy :: O.MethodProxy info)
#endif

#endif