-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathgit.t
69 lines (51 loc) · 2.22 KB
/
git.t
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
(use test test-by-example path cwd)
(example-test (runtime '(print-table git)) #<<.
> (filenamize "github.com/nex3/arc.git")
"github.com_nex3_arc.git"
> (parse-git-spec "foo.arc")
nil
> (parse-git-spec "git://github.com/nex3/arc.git")
#table((repo "git://github.com/nex3/arc.git"))
> (parse-git-spec "git://github.com/nex3/arc.git:lib/ns.arc")
#table((file "lib/ns.arc") (repo "git://github.com/nex3/arc.git"))
> (parse-git-spec "git://github.com/nex3/arc.git!arcc")
#table((repo "git://github.com/nex3/arc.git") (revision "arcc"))
> (parse-git-spec "git://github.com/nex3/arc.git!arcc:arcc/ac.arc")
#table((file "arcc/ac.arc") (repo "git://github.com/nex3/arc.git") (revision "arcc"))
> (git-dir (parse-git-spec "git://github.com/nex3/arc.git!arcc:arcc/ac.arc"))
"github.com_nex3_arc.git/arcc"
.
)
(w/testdir
(let r (runtime '(git))
(= r!git-cachedir* (path testdir "git"))
(let repo (path testdir "git/github.com_awwx_for-testing.git/foo2")
(testis (r!git-repo "git://github.com/awwx/for-testing.git!foo2")
repo)
(testis
(filechars (path repo "foo"))
"version 2\n"))
(let repo (path testdir "git/github.com_awwx_for-testing.git/8a74b81b27d5d4385ef1")
(testis (r!git-repo "git://github.com/awwx/for-testing.git!8a74b81b27d5d4385ef1")
repo)
(testis
(filechars (path repo "foo"))
"version 1\n"))
(testis (r!git-filepath "git://github.com/awwx/for-testing.git!bbdbb4:foo")
(path testdir "git/github.com_awwx_for-testing.git/bbdbb4/foo"))
(testis (~~file-exists (r!git-filepath "git://github.com/awwx/for-testing.git!bbdbb4:bar.arc"))
t)
(w/cwd (r!git-repo "git://github.com/awwx/for-testing.git!bbdbb4")
(system "git reset --hard HEAD^"))
(testis (~~file-exists (r!git-filepath "git://github.com/awwx/for-testing.git!bbdbb4:bar.arc"))
nil)
))
(w/testdir
(let r (runtime '(git))
(= r!git-cachedir* (path testdir "git"))
(let repo (r!git-repo "git://github.com/awwx/for-testing.git")
(w/cwd repo
(system "git reset --hard aaf940"))
(testis (~~file-exists (path repo "bar.arc")) nil)
(r!git-pull "git://github.com/awwx/for-testing.git")
(testis (~~file-exists (path repo "bar.arc")) t))))