-
Notifications
You must be signed in to change notification settings - Fork 1
/
repository.dylan
56 lines (52 loc) · 2.2 KB
/
repository.dylan
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
module: libgit2
synopsis: repository related functions
author: Francesco Ceccon
copyright: See LICENSE file in this distribution.
define git-options <git-repository-init-options*>
option git-repository-init-options$version => version = 1;
option git-repository-init-options$flags => flags;
option git-repository-init-options$mode => mode;
option git-repository-init-options$workdir-path => working-directory;
option git-repository-init-options$description => description;
option git-repository-init-options$template-path => template-path;
option git-repository-init-options$initial-head => initial-head;
option git-repository-init-options$origin-url => origin-url;
end git-options;
define method git-repository-init
(path :: <string>,
#key bare? :: <boolean> = #f,
flags :: false-or(<integer>) = #f,
mode :: false-or(<integer>) = #f,
working-directory :: false-or(<string>) = #f,
description :: false-or(<string>) = #f,
template-path :: false-or(<string>) = #f,
initial-head :: false-or(<string>) = #f,
origin-url :: false-or(<string>) = #f)
=> (err, repo)
if (flags | mode | working-directory | description | template-path | initial-head | origin-url)
let opts = make(<git-repository-init-options*>,
flags: flags,
mode: mode,
working-directory: working-directory,
description: description,
template-path: template-path,
initial-head: initial-head,
origin-url: origin-url);
%git-repository-init-ext(path, opts)
else
%git-repository-init(path, if (bare?) 1 else 0 end)
end if
end method git-repository-init;
define method git-repository-open
(path :: <string>,
#key flags :: false-or(<integer>) = #f,
ceiling-directories :: false-or(<string>) = #f)
=> (err, repo)
if (flags | ceiling-directories)
%git-repository-open-ext(path,
if (flags) flags else 0 end,
if (ceiling-directories) ceiling-directories else null-pointer(<C-string>) end)
else
%git-repository-open(path)
end if
end method git-repository-open;