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
|
test RepoSubtree:
node n
shell on n as git_init:
mkdir -p work
git -C work -c init.defaultBranch=master init -q
git -C work -c user.name=test -c user.email=test commit -q --allow-empty -m 'initial commit'
mkdir -p work/first/second
touch work/first/second/file
git -C work add first
git -C work -c user.name=test -c user.email=test commit -q -m 'commit'
git -C work rev-parse HEAD^{commit}
git -C work rev-parse HEAD^{tree}
git -C work rev-parse HEAD:first
git -C work rev-parse HEAD:first/second
expect /([0-9a-f]+)/ from git_init capture commit
expect /([0-9a-f]+)/ from git_init capture root
expect /([0-9a-f]+)/ from git_init capture sub1
expect /([0-9a-f]+)/ from git_init capture sub2
for repo in [ "./work" ]:
local:
spawn as p on n args [ repo, "subtree", commit, "" ]
expect from p /msg $root/
local:
spawn as p on n args [ repo, "subtree", commit, "." ]
expect from p /msg $root/
local:
spawn as p on n args [ repo, "subtree", commit, "/" ]
expect from p /msg $root/
local:
spawn as p on n args [ repo, "subtree", commit, "first" ]
expect from p /msg $sub1/
local:
spawn as p on n args [ repo, "subtree", commit, "./first" ]
expect from p /msg $sub1/
local:
spawn as p on n args [ repo, "subtree", commit, "/first" ]
expect from p /msg $sub1/
local:
spawn as p on n args [ repo, "subtree", commit, "./first/second" ]
expect from p /msg $sub2/
local:
spawn as p on n args [ repo, "subtree", commit, "/first/second" ]
expect from p /msg $sub2/
local:
spawn as p on n args [ repo, "subtree", "$sub1(first)", "second" ]
expect from p /msg $sub2/
local:
spawn as p on n args [ repo, "subtree", "$sub1(first)", "./second" ]
expect from p /msg $sub2/
local:
spawn as p on n args [ repo, "subtree", "$sub1(first)", "/second/" ]
expect from p /msg $sub2/
|