Skip to content

Commit 6d60e0f

Browse files
committed
Merge pull request libgit2#283 from ebfe/repo-open
Add missing RepositoryOpenExtended arguments
2 parents 105573a + 1bc7cf6 commit 6d60e0f

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

repository.go

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,15 +62,29 @@ func OpenRepository(path string) (*Repository, error) {
6262
return newRepositoryFromC(ptr), nil
6363
}
6464

65-
func OpenRepositoryExtended(path string) (*Repository, error) {
65+
type RepositoryOpenFlag int
66+
67+
const (
68+
RepositoryOpenNoSearch RepositoryOpenFlag = C.GIT_REPOSITORY_OPEN_NO_SEARCH
69+
RepositoryOpenCrossFs RepositoryOpenFlag = C.GIT_REPOSITORY_OPEN_CROSS_FS
70+
RepositoryOpenBare RepositoryOpenFlag = C.GIT_REPOSITORY_OPEN_BARE
71+
)
72+
73+
func OpenRepositoryExtended(path string, flags RepositoryOpenFlag, ceiling string) (*Repository, error) {
6674
cpath := C.CString(path)
6775
defer C.free(unsafe.Pointer(cpath))
6876

77+
var cceiling *C.char = nil
78+
if len(ceiling) > 0 {
79+
cceiling = C.CString(ceiling)
80+
defer C.free(unsafe.Pointer(cceiling))
81+
}
82+
6983
runtime.LockOSThread()
7084
defer runtime.UnlockOSThread()
7185

7286
var ptr *C.git_repository
73-
ret := C.git_repository_open_ext(&ptr, cpath, 0, nil)
87+
ret := C.git_repository_open_ext(&ptr, cpath, C.uint(flags), cceiling)
7488
if ret < 0 {
7589
return nil, MakeGitError(ret)
7690
}

0 commit comments

Comments
 (0)