module Bindings.Libgit2.Index where
import Foreign.Ptr
import Foreign.Ptr (Ptr,FunPtr,plusPtr)
import Foreign.Ptr (wordPtrToPtr,castPtrToFunPtr)
import Foreign.Storable
import Foreign.C.Types
import Foreign.C.String (CString,CStringLen,CWString,CWStringLen)
import Foreign.Marshal.Alloc (alloca)
import Foreign.Marshal.Array (peekArray,pokeArray)
import Data.Int
import Data.Word
import Bindings.Libgit2.Common
import Bindings.Libgit2.Indexer
import Bindings.Libgit2.Types
import Bindings.Libgit2.Oid
data C'git_index_time = C'git_index_time{
c'git_index_time'seconds :: CLong,
c'git_index_time'nanoseconds :: CUInt
} deriving (Eq,Show)
p'git_index_time'seconds p = plusPtr p 0
p'git_index_time'seconds :: Ptr (C'git_index_time) -> Ptr (CLong)
p'git_index_time'nanoseconds p = plusPtr p 8
p'git_index_time'nanoseconds :: Ptr (C'git_index_time) -> Ptr (CUInt)
instance Storable C'git_index_time where
sizeOf _ = 16
alignment _ = 8
peek p = do
v0 <- peekByteOff p 0
v1 <- peekByteOff p 8
return $ C'git_index_time v0 v1
poke p (C'git_index_time v0 v1) = do
pokeByteOff p 0 v0
pokeByteOff p 8 v1
return ()
data C'git_index_entry = C'git_index_entry{
c'git_index_entry'ctime :: C'git_index_time,
c'git_index_entry'mtime :: C'git_index_time,
c'git_index_entry'dev :: CUInt,
c'git_index_entry'ino :: CUInt,
c'git_index_entry'mode :: CUInt,
c'git_index_entry'uid :: CUInt,
c'git_index_entry'gid :: CUInt,
c'git_index_entry'file_size :: CLong,
c'git_index_entry'oid :: C'git_oid,
c'git_index_entry'flags :: CUShort,
c'git_index_entry'flags_extended :: CUShort,
c'git_index_entry'path :: CString
} deriving (Eq,Show)
p'git_index_entry'ctime p = plusPtr p 0
p'git_index_entry'ctime :: Ptr (C'git_index_entry) -> Ptr (C'git_index_time)
p'git_index_entry'mtime p = plusPtr p 16
p'git_index_entry'mtime :: Ptr (C'git_index_entry) -> Ptr (C'git_index_time)
p'git_index_entry'dev p = plusPtr p 32
p'git_index_entry'dev :: Ptr (C'git_index_entry) -> Ptr (CUInt)
p'git_index_entry'ino p = plusPtr p 36
p'git_index_entry'ino :: Ptr (C'git_index_entry) -> Ptr (CUInt)
p'git_index_entry'mode p = plusPtr p 40
p'git_index_entry'mode :: Ptr (C'git_index_entry) -> Ptr (CUInt)
p'git_index_entry'uid p = plusPtr p 44
p'git_index_entry'uid :: Ptr (C'git_index_entry) -> Ptr (CUInt)
p'git_index_entry'gid p = plusPtr p 48
p'git_index_entry'gid :: Ptr (C'git_index_entry) -> Ptr (CUInt)
p'git_index_entry'file_size p = plusPtr p 56
p'git_index_entry'file_size :: Ptr (C'git_index_entry) -> Ptr (CLong)
p'git_index_entry'oid p = plusPtr p 64
p'git_index_entry'oid :: Ptr (C'git_index_entry) -> Ptr (C'git_oid)
p'git_index_entry'flags p = plusPtr p 84
p'git_index_entry'flags :: Ptr (C'git_index_entry) -> Ptr (CUShort)
p'git_index_entry'flags_extended p = plusPtr p 86
p'git_index_entry'flags_extended :: Ptr (C'git_index_entry) -> Ptr (CUShort)
p'git_index_entry'path p = plusPtr p 88
p'git_index_entry'path :: Ptr (C'git_index_entry) -> Ptr (CString)
instance Storable C'git_index_entry where
sizeOf _ = 96
alignment _ = 8
peek p = do
v0 <- peekByteOff p 0
v1 <- peekByteOff p 16
v2 <- peekByteOff p 32
v3 <- peekByteOff p 36
v4 <- peekByteOff p 40
v5 <- peekByteOff p 44
v6 <- peekByteOff p 48
v7 <- peekByteOff p 56
v8 <- peekByteOff p 64
v9 <- peekByteOff p 84
v10 <- peekByteOff p 86
v11 <- peekByteOff p 88
return $ C'git_index_entry v0 v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11
poke p (C'git_index_entry v0 v1 v2 v3 v4 v5 v6 v7 v8 v9 v10 v11) = do
pokeByteOff p 0 v0
pokeByteOff p 16 v1
pokeByteOff p 32 v2
pokeByteOff p 36 v3
pokeByteOff p 40 v4
pokeByteOff p 44 v5
pokeByteOff p 48 v6
pokeByteOff p 56 v7
pokeByteOff p 64 v8
pokeByteOff p 84 v9
pokeByteOff p 86 v10
pokeByteOff p 88 v11
return ()
data C'git_index_reuc_entry = C'git_index_reuc_entry{
c'git_index_reuc_entry'mode :: [CUInt],
c'git_index_reuc_entry'oid :: [C'git_oid],
c'git_index_reuc_entry'path :: CString
} deriving (Eq,Show)
p'git_index_reuc_entry'mode p = plusPtr p 0
p'git_index_reuc_entry'mode :: Ptr (C'git_index_reuc_entry) -> Ptr (CUInt)
p'git_index_reuc_entry'oid p = plusPtr p 12
p'git_index_reuc_entry'oid :: Ptr (C'git_index_reuc_entry) -> Ptr (C'git_oid)
p'git_index_reuc_entry'path p = plusPtr p 72
p'git_index_reuc_entry'path :: Ptr (C'git_index_reuc_entry) -> Ptr (CString)
instance Storable C'git_index_reuc_entry where
sizeOf _ = 80
alignment _ = 8
peek p = do
v0 <- let s = div 12 $ sizeOf $ (undefined :: CUInt) in peekArray s (plusPtr p 0)
v1 <- let s = div 60 $ sizeOf $ (undefined :: C'git_oid) in peekArray s (plusPtr p 12)
v2 <- peekByteOff p 72
return $ C'git_index_reuc_entry v0 v1 v2
poke p (C'git_index_reuc_entry v0 v1 v2) = do
let s = div 12 $ sizeOf $ (undefined :: CUInt)
pokeArray (plusPtr p 0) (take s v0)
let s = div 60 $ sizeOf $ (undefined :: C'git_oid)
pokeArray (plusPtr p 12) (take s v1)
pokeByteOff p 72 v2
return ()
c'GIT_INDEXCAP_IGNORE_CASE = 1
c'GIT_INDEXCAP_IGNORE_CASE :: (Num a) => a
c'GIT_INDEXCAP_NO_FILEMODE = 2
c'GIT_INDEXCAP_NO_FILEMODE :: (Num a) => a
c'GIT_INDEXCAP_NO_SYMLINKS = 4
c'GIT_INDEXCAP_NO_SYMLINKS :: (Num a) => a
c'GIT_INDEXCAP_FROM_OWNER = 4294967295
c'GIT_INDEXCAP_FROM_OWNER :: (Num a) => a
foreign import ccall "git_index_open" c'git_index_open
:: Ptr (Ptr C'git_index) -> CString -> IO (CInt)
foreign import ccall "&git_index_open" p'git_index_open
:: FunPtr (Ptr (Ptr C'git_index) -> CString -> IO (CInt))
foreign import ccall "git_index_new" c'git_index_new
:: Ptr (Ptr C'git_index) -> IO (CInt)
foreign import ccall "&git_index_new" p'git_index_new
:: FunPtr (Ptr (Ptr C'git_index) -> IO (CInt))
foreign import ccall "git_index_free" c'git_index_free
:: Ptr C'git_index -> IO ()
foreign import ccall "&git_index_free" p'git_index_free
:: FunPtr (Ptr C'git_index -> IO ())
foreign import ccall "git_index_owner" c'git_index_owner
:: Ptr C'git_index -> IO (Ptr C'git_repository)
foreign import ccall "&git_index_owner" p'git_index_owner
:: FunPtr (Ptr C'git_index -> IO (Ptr C'git_repository))
foreign import ccall "git_index_caps" c'git_index_caps
:: Ptr C'git_index -> IO (CUInt)
foreign import ccall "&git_index_caps" p'git_index_caps
:: FunPtr (Ptr C'git_index -> IO (CUInt))
foreign import ccall "git_index_set_caps" c'git_index_set_caps
:: Ptr C'git_index -> CUInt -> IO (CInt)
foreign import ccall "&git_index_set_caps" p'git_index_set_caps
:: FunPtr (Ptr C'git_index -> CUInt -> IO (CInt))
foreign import ccall "git_index_read" c'git_index_read
:: Ptr C'git_index -> IO (CInt)
foreign import ccall "&git_index_read" p'git_index_read
:: FunPtr (Ptr C'git_index -> IO (CInt))
foreign import ccall "git_index_write" c'git_index_write
:: Ptr C'git_index -> IO (CInt)
foreign import ccall "&git_index_write" p'git_index_write
:: FunPtr (Ptr C'git_index -> IO (CInt))
foreign import ccall "git_index_read_tree" c'git_index_read_tree
:: Ptr C'git_index -> Ptr C'git_tree -> IO (CInt)
foreign import ccall "&git_index_read_tree" p'git_index_read_tree
:: FunPtr (Ptr C'git_index -> Ptr C'git_tree -> IO (CInt))
foreign import ccall "git_index_write_tree" c'git_index_write_tree
:: Ptr C'git_oid -> Ptr C'git_index -> IO (CInt)
foreign import ccall "&git_index_write_tree" p'git_index_write_tree
:: FunPtr (Ptr C'git_oid -> Ptr C'git_index -> IO (CInt))
foreign import ccall "git_index_write_tree_to" c'git_index_write_tree_to
:: Ptr C'git_oid -> Ptr C'git_index -> Ptr C'git_repository -> IO (CInt)
foreign import ccall "&git_index_write_tree_to" p'git_index_write_tree_to
:: FunPtr (Ptr C'git_oid -> Ptr C'git_index -> Ptr C'git_repository -> IO (CInt))
foreign import ccall "git_index_entrycount" c'git_index_entrycount
:: Ptr C'git_index -> IO (CSize)
foreign import ccall "&git_index_entrycount" p'git_index_entrycount
:: FunPtr (Ptr C'git_index -> IO (CSize))
foreign import ccall "git_index_clear" c'git_index_clear
:: Ptr C'git_index -> IO ()
foreign import ccall "&git_index_clear" p'git_index_clear
:: FunPtr (Ptr C'git_index -> IO ())
foreign import ccall "git_index_get_byindex" c'git_index_get_byindex
:: Ptr C'git_index -> CSize -> IO (Ptr C'git_index_entry)
foreign import ccall "&git_index_get_byindex" p'git_index_get_byindex
:: FunPtr (Ptr C'git_index -> CSize -> IO (Ptr C'git_index_entry))
foreign import ccall "git_index_get_bypath" c'git_index_get_bypath
:: Ptr C'git_index -> CString -> CInt -> IO (Ptr C'git_index_entry)
foreign import ccall "&git_index_get_bypath" p'git_index_get_bypath
:: FunPtr (Ptr C'git_index -> CString -> CInt -> IO (Ptr C'git_index_entry))
foreign import ccall "git_index_remove" c'git_index_remove
:: Ptr C'git_index -> CString -> CInt -> IO (CInt)
foreign import ccall "&git_index_remove" p'git_index_remove
:: FunPtr (Ptr C'git_index -> CString -> CInt -> IO (CInt))
foreign import ccall "git_index_remove_directory" c'git_index_remove_directory
:: Ptr C'git_index -> CString -> CInt -> IO (CInt)
foreign import ccall "&git_index_remove_directory" p'git_index_remove_directory
:: FunPtr (Ptr C'git_index -> CString -> CInt -> IO (CInt))
foreign import ccall "git_index_add" c'git_index_add
:: Ptr C'git_index -> Ptr C'git_index_entry -> IO (CInt)
foreign import ccall "&git_index_add" p'git_index_add
:: FunPtr (Ptr C'git_index -> Ptr C'git_index_entry -> IO (CInt))
foreign import ccall "git_index_entry_stage" c'git_index_entry_stage
:: Ptr C'git_index_entry -> IO (CInt)
foreign import ccall "&git_index_entry_stage" p'git_index_entry_stage
:: FunPtr (Ptr C'git_index_entry -> IO (CInt))
foreign import ccall "git_index_add_bypath" c'git_index_add_bypath
:: Ptr C'git_index -> CString -> IO (CInt)
foreign import ccall "&git_index_add_bypath" p'git_index_add_bypath
:: FunPtr (Ptr C'git_index -> CString -> IO (CInt))
foreign import ccall "git_index_remove_bypath" c'git_index_remove_bypath
:: Ptr C'git_index -> CString -> IO (CInt)
foreign import ccall "&git_index_remove_bypath" p'git_index_remove_bypath
:: FunPtr (Ptr C'git_index -> CString -> IO (CInt))
foreign import ccall "git_index_find" c'git_index_find
:: Ptr CSize -> Ptr C'git_index -> CString -> IO (CInt)
foreign import ccall "&git_index_find" p'git_index_find
:: FunPtr (Ptr CSize -> Ptr C'git_index -> CString -> IO (CInt))
foreign import ccall "git_index_conflict_add" c'git_index_conflict_add
:: Ptr C'git_index -> Ptr C'git_index_entry -> Ptr C'git_index_entry -> Ptr C'git_index_entry -> IO (CInt)
foreign import ccall "&git_index_conflict_add" p'git_index_conflict_add
:: FunPtr (Ptr C'git_index -> Ptr C'git_index_entry -> Ptr C'git_index_entry -> Ptr C'git_index_entry -> IO (CInt))
foreign import ccall "git_index_conflict_get" c'git_index_conflict_get
:: Ptr (Ptr C'git_index_entry) -> Ptr (Ptr C'git_index_entry) -> Ptr (Ptr C'git_index_entry) -> Ptr C'git_index -> CString -> IO (CInt)
foreign import ccall "&git_index_conflict_get" p'git_index_conflict_get
:: FunPtr (Ptr (Ptr C'git_index_entry) -> Ptr (Ptr C'git_index_entry) -> Ptr (Ptr C'git_index_entry) -> Ptr C'git_index -> CString -> IO (CInt))
foreign import ccall "git_index_conflict_remove" c'git_index_conflict_remove
:: Ptr C'git_index -> CString -> IO (CInt)
foreign import ccall "&git_index_conflict_remove" p'git_index_conflict_remove
:: FunPtr (Ptr C'git_index -> CString -> IO (CInt))
foreign import ccall "git_index_conflict_cleanup" c'git_index_conflict_cleanup
:: Ptr C'git_index -> IO ()
foreign import ccall "&git_index_conflict_cleanup" p'git_index_conflict_cleanup
:: FunPtr (Ptr C'git_index -> IO ())
foreign import ccall "git_index_has_conflicts" c'git_index_has_conflicts
:: Ptr C'git_index -> IO (CInt)
foreign import ccall "&git_index_has_conflicts" p'git_index_has_conflicts
:: FunPtr (Ptr C'git_index -> IO (CInt))
foreign import ccall "git_index_reuc_entrycount" c'git_index_reuc_entrycount
:: Ptr C'git_index -> IO (CUInt)
foreign import ccall "&git_index_reuc_entrycount" p'git_index_reuc_entrycount
:: FunPtr (Ptr C'git_index -> IO (CUInt))
foreign import ccall "git_index_reuc_find" c'git_index_reuc_find
:: Ptr CSize -> Ptr C'git_index -> CString -> IO (CInt)
foreign import ccall "&git_index_reuc_find" p'git_index_reuc_find
:: FunPtr (Ptr CSize -> Ptr C'git_index -> CString -> IO (CInt))
foreign import ccall "git_index_reuc_get_bypath" c'git_index_reuc_get_bypath
:: Ptr C'git_index -> CString -> IO (Ptr C'git_index_reuc_entry)
foreign import ccall "&git_index_reuc_get_bypath" p'git_index_reuc_get_bypath
:: FunPtr (Ptr C'git_index -> CString -> IO (Ptr C'git_index_reuc_entry))
foreign import ccall "git_index_reuc_get_byindex" c'git_index_reuc_get_byindex
:: Ptr C'git_index -> CSize -> IO (Ptr C'git_index_reuc_entry)
foreign import ccall "&git_index_reuc_get_byindex" p'git_index_reuc_get_byindex
:: FunPtr (Ptr C'git_index -> CSize -> IO (Ptr C'git_index_reuc_entry))
foreign import ccall "git_index_reuc_add" c'git_index_reuc_add
:: Ptr C'git_index -> CString -> CInt -> Ptr C'git_oid -> CInt -> Ptr C'git_oid -> CInt -> Ptr C'git_oid -> IO (CInt)
foreign import ccall "&git_index_reuc_add" p'git_index_reuc_add
:: FunPtr (Ptr C'git_index -> CString -> CInt -> Ptr C'git_oid -> CInt -> Ptr C'git_oid -> CInt -> Ptr C'git_oid -> IO (CInt))
foreign import ccall "git_index_reuc_remove" c'git_index_reuc_remove
:: Ptr C'git_index -> CSize -> IO (CInt)
foreign import ccall "&git_index_reuc_remove" p'git_index_reuc_remove
:: FunPtr (Ptr C'git_index -> CSize -> IO (CInt))
foreign import ccall "git_index_reuc_clear" c'git_index_reuc_clear
:: Ptr C'git_index -> IO ()
foreign import ccall "&git_index_reuc_clear" p'git_index_reuc_clear
:: FunPtr (Ptr C'git_index -> IO ())