@@ -739,5 +739,39 @@ func (r *Repository) RemoveMessage() error {
739739 if cErr < 0 {
740740 return MakeGitError (cErr )
741741 }
742- return nil
742+ return nil
743+ }
744+
745+ type RepositoryItem int
746+
747+ const (
748+ RepositoryItemGitDir RepositoryItem = C .GIT_REPOSITORY_ITEM_GITDIR
749+ RepositoryItemWorkDir RepositoryItem = C .GIT_REPOSITORY_ITEM_WORKDIR
750+ RepositoryItemCommonDir RepositoryItem = C .GIT_REPOSITORY_ITEM_COMMONDIR
751+ RepositoryItemIndex RepositoryItem = C .GIT_REPOSITORY_ITEM_INDEX
752+ RepositoryItemObjects RepositoryItem = C .GIT_REPOSITORY_ITEM_OBJECTS
753+ RepositoryItemRefs RepositoryItem = C .GIT_REPOSITORY_ITEM_REFS
754+ RepositoryItemPackedRefs RepositoryItem = C .GIT_REPOSITORY_ITEM_PACKED_REFS
755+ RepositoryItemRemotes RepositoryItem = C .GIT_REPOSITORY_ITEM_REMOTES
756+ RepositoryItemConfig RepositoryItem = C .GIT_REPOSITORY_ITEM_CONFIG
757+ RepositoryItemInfo RepositoryItem = C .GIT_REPOSITORY_ITEM_INFO
758+ RepositoryItemHooks RepositoryItem = C .GIT_REPOSITORY_ITEM_HOOKS
759+ RepositoryItemLogs RepositoryItem = C .GIT_REPOSITORY_ITEM_LOGS
760+ RepositoryItemModules RepositoryItem = C .GIT_REPOSITORY_ITEM_MODULES
761+ RepositoryItemWorkTrees RepositoryItem = C .GIT_REPOSITORY_ITEM_WORKTREES
762+ )
763+
764+ func (r * Repository ) ItemPath (item RepositoryItem ) (string , error ) {
765+ var c_buf C.git_buf
766+ defer C .git_buf_dispose (& c_buf )
767+
768+ runtime .LockOSThread ()
769+ defer runtime .UnlockOSThread ()
770+
771+ ret := C .git_repository_item_path (& c_buf , r .ptr , C .git_repository_item_t (item ))
772+ runtime .KeepAlive (r )
773+ if ret < 0 {
774+ return "" , MakeGitError (ret )
775+ }
776+ return C .GoString (c_buf .ptr ), nil
743777}
0 commit comments