braid 1.1.6 → 1.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/exe/braid +11 -0
- data/lib/braid/check_gem.rb +58 -0
- data/lib/braid/command.rb +13 -0
- data/lib/braid/commands/diff.rb +1 -1
- data/lib/braid/config.rb +28 -4
- data/{bin/braid → lib/braid/main.rb} +1 -16
- data/lib/braid/mirror.rb +110 -23
- data/lib/braid/operations.rb +5 -4
- data/lib/braid/operations_lite.rb +19 -1
- data/lib/braid/sorbet/fake_runtime.rb +68 -0
- data/lib/braid/sorbet/setup.rb +18 -0
- data/lib/braid/version.rb +1 -1
- data/lib/braid.rb +21 -0
- metadata +12 -75
- data/.gitignore +0 -16
- data/.travis.yml +0 -15
- data/CONTRIBUTING.md +0 -24
- data/Gemfile +0 -3
- data/README.md +0 -234
- data/Rakefile +0 -12
- data/_config.yml +0 -1
- data/braid.gemspec +0 -35
- data/braids-json.schema.json +0 -91
- data/config_versions.md +0 -58
- data/spec/config_spec.rb +0 -59
- data/spec/fixtures/shiny/README +0 -3
- data/spec/fixtures/shiny/other-skit/layout.liquid +0 -219
- data/spec/fixtures/shiny/skit-layout.liquid.test +0 -2
- data/spec/fixtures/shiny/skit1.test +0 -2
- data/spec/fixtures/shiny-conf-1.0.9-lock/.braids.json +0 -10
- data/spec/fixtures/shiny-conf-1.0.9-lock/expected.braids.json +0 -9
- data/spec/fixtures/shiny-conf-1.0.9-lock/skit1/layouts/layout.liquid +0 -219
- data/spec/fixtures/shiny-conf-1.0.9-lock/skit1/preview.png +0 -0
- data/spec/fixtures/shiny-conf-breaking-changes/.braids +0 -14
- data/spec/fixtures/shiny-conf-breaking-changes/Spoon-Knife/README.md +0 -9
- data/spec/fixtures/shiny-conf-breaking-changes/Spoon-Knife/index.html +0 -20
- data/spec/fixtures/shiny-conf-breaking-changes/Spoon-Knife/styles.css +0 -17
- data/spec/fixtures/shiny-conf-breaking-changes/expected.braids.json +0 -10
- data/spec/fixtures/shiny-conf-breaking-changes/skit1/layouts/layout.liquid +0 -219
- data/spec/fixtures/shiny-conf-breaking-changes/skit1/preview.png +0 -0
- data/spec/fixtures/shiny-conf-future/.braids.json +0 -10
- data/spec/fixtures/shiny-conf-future/skit1/layouts/layout.liquid +0 -219
- data/spec/fixtures/shiny-conf-future/skit1/preview.png +0 -0
- data/spec/fixtures/shiny-conf-json-old-name/.braids +0 -9
- data/spec/fixtures/shiny-conf-json-old-name/expected.braids.json +0 -10
- data/spec/fixtures/shiny-conf-json-old-name/skit1/layouts/layout.liquid +0 -219
- data/spec/fixtures/shiny-conf-json-old-name/skit1/preview.png +0 -0
- data/spec/fixtures/shiny-conf-yaml/.braids +0 -8
- data/spec/fixtures/shiny-conf-yaml/expected.braids.json +0 -10
- data/spec/fixtures/shiny-conf-yaml/skit1/layouts/layout.liquid +0 -219
- data/spec/fixtures/shiny-conf-yaml/skit1/preview.png +0 -0
- data/spec/fixtures/shiny_skit1.2_merged/layouts/layout.liquid +0 -223
- data/spec/fixtures/shiny_skit1.2_merged/preview.png +0 -0
- data/spec/fixtures/shiny_skit1_conflicting/layouts/layout.liquid +0 -221
- data/spec/fixtures/shiny_skit1_conflicting/preview.png +0 -0
- data/spec/fixtures/shiny_skit1_mergeable/layouts/layout.liquid +0 -221
- data/spec/fixtures/shiny_skit1_mergeable/preview.png +0 -0
- data/spec/fixtures/skit1/layouts/layout.liquid +0 -219
- data/spec/fixtures/skit1/preview.png +0 -0
- data/spec/fixtures/skit1.1/layouts/layout.liquid +0 -219
- data/spec/fixtures/skit1.1_with_filter/.gitattributes +0 -1
- data/spec/fixtures/skit1.1_with_filter/layouts/layout.liquid +0 -219
- data/spec/fixtures/skit1.1_with_filter/preview.png +0 -0
- data/spec/fixtures/skit1.1x/layouts/layout.liquid +0 -219
- data/spec/fixtures/skit1.2/layouts/layout.liquid +0 -221
- data/spec/fixtures/skit1.3/layouts/README.md +0 -1
- data/spec/fixtures/skit1.3/layouts/layout.liquid +0 -221
- data/spec/fixtures/skit1_with_filter/.gitattributes +0 -1
- data/spec/fixtures/skit1_with_filter/layouts/layout.liquid +0 -219
- data/spec/fixtures/skit1_with_filter/preview.png +0 -0
- data/spec/integration/adding_spec.rb +0 -230
- data/spec/integration/config_versioning_spec.rb +0 -222
- data/spec/integration/diff_spec.rb +0 -597
- data/spec/integration/integration_helper.rb +0 -129
- data/spec/integration/push_spec.rb +0 -399
- data/spec/integration/remove_spec.rb +0 -81
- data/spec/integration/status_spec.rb +0 -165
- data/spec/integration/updating_spec.rb +0 -487
- data/spec/mirror_spec.rb +0 -119
- data/spec/operations_spec.rb +0 -66
- data/spec/test_helper.rb +0 -19
@@ -1,165 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/integration_helper'
|
2
|
-
|
3
|
-
describe 'Running braid status on a mirror' do
|
4
|
-
before do
|
5
|
-
FileUtils.rm_rf(TMP_PATH)
|
6
|
-
FileUtils.mkdir_p(TMP_PATH)
|
7
|
-
@repository_dir = create_git_repo_from_fixture('shiny')
|
8
|
-
@vendor_repository_dir = create_git_repo_from_fixture('skit1')
|
9
|
-
end
|
10
|
-
|
11
|
-
describe 'braided directly in' do
|
12
|
-
before do
|
13
|
-
in_dir(@repository_dir) do
|
14
|
-
run_command("#{BRAID_BIN} add #{@vendor_repository_dir}")
|
15
|
-
end
|
16
|
-
end
|
17
|
-
describe 'with no changes' do
|
18
|
-
it 'should only emit version when neither modified' do
|
19
|
-
diff = nil
|
20
|
-
in_dir(@repository_dir) do
|
21
|
-
diff = run_command("#{BRAID_BIN} status skit1")
|
22
|
-
end
|
23
|
-
|
24
|
-
expect(diff).to match(/^skit1 \([0-9a-f]{40}\) \[BRANCH=master\]$/)
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
describe 'with local changes' do
|
29
|
-
it 'should emit local modified indicator' do
|
30
|
-
output = nil
|
31
|
-
in_dir(@repository_dir) do
|
32
|
-
File.open("#{@repository_dir}/skit1/foo.txt", 'wb') { |f| f.write('Hi') }
|
33
|
-
run_command('git add *')
|
34
|
-
run_command('git commit -m "modify mirror"')
|
35
|
-
output = run_command("#{BRAID_BIN} status skit1")
|
36
|
-
end
|
37
|
-
|
38
|
-
expect(output).to match(/^skit1 \([0-9a-f]{40}\) \[BRANCH=master\] \(Locally Modified\)$/)
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
describe 'with remote changes' do
|
43
|
-
it 'should emit remote modified indicator' do
|
44
|
-
update_dir_from_fixture('skit1', 'skit1.1')
|
45
|
-
in_dir(@vendor_repository_dir) do
|
46
|
-
run_command('git add *')
|
47
|
-
run_command('git commit -m "change default color"')
|
48
|
-
end
|
49
|
-
|
50
|
-
output = nil
|
51
|
-
in_dir(@repository_dir) do
|
52
|
-
output = run_command("#{BRAID_BIN} status skit1")
|
53
|
-
end
|
54
|
-
|
55
|
-
expect(output).to match(/^skit1 \([0-9a-f]{40}\) \[BRANCH=master\] \(Remote Modified\)$/)
|
56
|
-
end
|
57
|
-
end
|
58
|
-
end
|
59
|
-
|
60
|
-
describe 'braided into branch in' do
|
61
|
-
before do
|
62
|
-
in_dir(@vendor_repository_dir) do
|
63
|
-
run_command('git checkout -bbranch1 2>&1')
|
64
|
-
end
|
65
|
-
in_dir(@repository_dir) do
|
66
|
-
run_command("#{BRAID_BIN} add #{@vendor_repository_dir} --branch branch1")
|
67
|
-
end
|
68
|
-
end
|
69
|
-
describe 'with no changes' do
|
70
|
-
it 'should only emit version when neither modified' do
|
71
|
-
diff = nil
|
72
|
-
in_dir(@repository_dir) do
|
73
|
-
diff = run_command("#{BRAID_BIN} status skit1")
|
74
|
-
end
|
75
|
-
|
76
|
-
expect(diff).to match(/^skit1 \([0-9a-f]{40}\) \[BRANCH=branch1\]$/)
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
describe 'with local changes' do
|
81
|
-
it 'should emit local modified indicator' do
|
82
|
-
output = nil
|
83
|
-
in_dir(@repository_dir) do
|
84
|
-
File.open("#{@repository_dir}/skit1/foo.txt", 'wb') { |f| f.write('Hi') }
|
85
|
-
run_command('git add *')
|
86
|
-
run_command('git commit -m "modify mirror"')
|
87
|
-
output = run_command("#{BRAID_BIN} status skit1")
|
88
|
-
end
|
89
|
-
|
90
|
-
expect(output).to match(/^skit1 \([0-9a-f]{40}\) \[BRANCH=branch1\] \(Locally Modified\)$/)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
|
94
|
-
describe 'with remote changes' do
|
95
|
-
it 'should emit remote modified indicator' do
|
96
|
-
update_dir_from_fixture('skit1', 'skit1.1')
|
97
|
-
in_dir(@vendor_repository_dir) do
|
98
|
-
run_command('git add *')
|
99
|
-
run_command('git commit -m "change default color"')
|
100
|
-
end
|
101
|
-
|
102
|
-
output = nil
|
103
|
-
in_dir(@repository_dir) do
|
104
|
-
output = run_command("#{BRAID_BIN} status skit1")
|
105
|
-
end
|
106
|
-
|
107
|
-
expect(output).to match(/^skit1 \([0-9a-f]{40}\) \[BRANCH=branch1\] \(Remote Modified\)$/)
|
108
|
-
end
|
109
|
-
end
|
110
|
-
end
|
111
|
-
|
112
|
-
describe 'braided directly in as tag' do
|
113
|
-
before do
|
114
|
-
in_dir(@vendor_repository_dir) do
|
115
|
-
run_command('git tag v1')
|
116
|
-
end
|
117
|
-
|
118
|
-
in_dir(@repository_dir) do
|
119
|
-
run_command("#{BRAID_BIN} add #{@vendor_repository_dir} --tag v1")
|
120
|
-
end
|
121
|
-
end
|
122
|
-
describe 'with no changes' do
|
123
|
-
it 'should only emit version when neither modified' do
|
124
|
-
diff = nil
|
125
|
-
in_dir(@repository_dir) do
|
126
|
-
diff = run_command("#{BRAID_BIN} status skit1")
|
127
|
-
end
|
128
|
-
|
129
|
-
expect(diff).to match(/^skit1 \([0-9a-f]{40}\) \[TAG=v1\]$/)
|
130
|
-
end
|
131
|
-
end
|
132
|
-
|
133
|
-
describe 'with local changes' do
|
134
|
-
it 'should emit local modified indicator' do
|
135
|
-
output = nil
|
136
|
-
in_dir(@repository_dir) do
|
137
|
-
File.open("#{@repository_dir}/skit1/foo.txt", 'wb') { |f| f.write('Hi') }
|
138
|
-
run_command('git add *')
|
139
|
-
run_command('git commit -m "modify mirror"')
|
140
|
-
output = run_command("#{BRAID_BIN} status skit1")
|
141
|
-
end
|
142
|
-
|
143
|
-
expect(output).to match(/^skit1 \([0-9a-f]{40}\) \[TAG=v1\] \(Locally Modified\)$/)
|
144
|
-
end
|
145
|
-
end
|
146
|
-
|
147
|
-
describe 'with remote changes' do
|
148
|
-
it 'should emit remote modified indicator' do
|
149
|
-
update_dir_from_fixture('skit1', 'skit1.1')
|
150
|
-
in_dir(@vendor_repository_dir) do
|
151
|
-
run_command('git add *')
|
152
|
-
run_command('git commit -m "change default color"')
|
153
|
-
run_command('git tag -f v1')
|
154
|
-
end
|
155
|
-
|
156
|
-
output = nil
|
157
|
-
in_dir(@repository_dir) do
|
158
|
-
output = run_command("#{BRAID_BIN} status skit1")
|
159
|
-
end
|
160
|
-
|
161
|
-
expect(output).to match(/^skit1 \([0-9a-f]{40}\) \[TAG=v1\] \(Remote Modified\)$/)
|
162
|
-
end
|
163
|
-
end
|
164
|
-
end
|
165
|
-
end
|
@@ -1,487 +0,0 @@
|
|
1
|
-
require File.dirname(__FILE__) + '/integration_helper'
|
2
|
-
|
3
|
-
describe 'Updating a mirror' do
|
4
|
-
|
5
|
-
before do
|
6
|
-
FileUtils.rm_rf(TMP_PATH)
|
7
|
-
FileUtils.mkdir_p(TMP_PATH)
|
8
|
-
end
|
9
|
-
|
10
|
-
describe 'with a git repository' do
|
11
|
-
before do
|
12
|
-
@repository_dir = create_git_repo_from_fixture('shiny', :name => 'Some body', :email => 'somebody@example.com')
|
13
|
-
@vendor_repository_dir = create_git_repo_from_fixture('skit1')
|
14
|
-
@head_version = nil
|
15
|
-
in_dir(@vendor_repository_dir) do
|
16
|
-
run_command('git tag v1')
|
17
|
-
@head_version = run_command('git rev-parse HEAD')
|
18
|
-
end
|
19
|
-
in_dir(@repository_dir) do
|
20
|
-
run_command("#{BRAID_BIN} add #{@vendor_repository_dir}")
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
it 'should generate an error if --head parameter passed' do
|
25
|
-
output = nil
|
26
|
-
in_dir(@repository_dir) do
|
27
|
-
output = `#{BRAID_BIN} update skit1 --head 2>&1`
|
28
|
-
end
|
29
|
-
|
30
|
-
expect(output).to match(/^Braid: Error: Do not specify --head option anymore. Please use '--branch MyBranch' to track a branch or '--tag MyTag' to track a branch$/)
|
31
|
-
end
|
32
|
-
|
33
|
-
it 'should generate an error if both tag and revision specified' do
|
34
|
-
output = nil
|
35
|
-
in_dir(@repository_dir) do
|
36
|
-
output = `#{BRAID_BIN} update skit1 --tag v1 --revision #{@head_version} 2>&1`
|
37
|
-
end
|
38
|
-
|
39
|
-
expect(output).to match(/^Braid: Error: Can not update mirror specifying both a revision and a tag$/)
|
40
|
-
end
|
41
|
-
|
42
|
-
it 'should generate an error if both branch and revision specified' do
|
43
|
-
output = nil
|
44
|
-
in_dir(@repository_dir) do
|
45
|
-
output = `#{BRAID_BIN} update skit1 --branch master --tag v1`
|
46
|
-
end
|
47
|
-
|
48
|
-
expect(output).to match(/^Braid: Error: Can not update mirror specifying both a branch and a tag$/)
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
describe 'from a git repository' do
|
53
|
-
before do
|
54
|
-
@repository_dir = create_git_repo_from_fixture('shiny')
|
55
|
-
@vendor_repository_dir = create_git_repo_from_fixture('skit1')
|
56
|
-
@file_name = 'layouts/layout.liquid'
|
57
|
-
|
58
|
-
in_dir(@repository_dir) do
|
59
|
-
run_command("#{BRAID_BIN} add #{@vendor_repository_dir}")
|
60
|
-
end
|
61
|
-
|
62
|
-
update_dir_from_fixture('skit1', 'skit1.1')
|
63
|
-
in_dir(@vendor_repository_dir) do
|
64
|
-
run_command('git add *')
|
65
|
-
run_command('git commit -m "change default color"')
|
66
|
-
end
|
67
|
-
|
68
|
-
update_dir_from_fixture('skit1', 'skit1.2')
|
69
|
-
in_dir(@vendor_repository_dir) do
|
70
|
-
run_command('git add *')
|
71
|
-
run_command('git commit -m "add a happy note"')
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
|
-
context 'with no project-specific changes' do
|
76
|
-
it 'should add the files and commit' do
|
77
|
-
in_dir(@repository_dir) do
|
78
|
-
run_command("#{BRAID_BIN} update skit1")
|
79
|
-
end
|
80
|
-
|
81
|
-
assert_no_diff("#{FIXTURE_PATH}/skit1.2/#{@file_name}", "#{@repository_dir}/skit1/#{@file_name}")
|
82
|
-
|
83
|
-
output = nil
|
84
|
-
in_dir(@repository_dir) do
|
85
|
-
output = run_command('git log --pretty=oneline').split("\n")
|
86
|
-
end
|
87
|
-
expect(output.length).to eq(3)
|
88
|
-
expect(output[0]).to match(/^[0-9a-f]{40} Braid: Update mirror 'skit1' to '[0-9a-f]{7}'$/)
|
89
|
-
|
90
|
-
# No temporary commits should be added to the reflog.
|
91
|
-
output = nil
|
92
|
-
in_dir(@repository_dir) do
|
93
|
-
output = `git log -g --pretty=oneline`.split("\n")
|
94
|
-
end
|
95
|
-
expect(output.length).to eq(3)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
|
99
|
-
context 'with mergeable changes to the same file' do
|
100
|
-
it 'should auto-merge and commit' do
|
101
|
-
run_command("cp #{File.join(FIXTURE_PATH, 'shiny_skit1_mergeable', @file_name)} #{File.join(TMP_PATH, 'shiny', 'skit1', @file_name)}")
|
102
|
-
|
103
|
-
in_dir(@repository_dir) do
|
104
|
-
run_command('git commit -a -m "mergeable change"')
|
105
|
-
run_command("#{BRAID_BIN} update skit1")
|
106
|
-
end
|
107
|
-
|
108
|
-
assert_no_diff("#{FIXTURE_PATH}/shiny_skit1.2_merged/#{@file_name}", "#{@repository_dir}/skit1/#{@file_name}")
|
109
|
-
|
110
|
-
output = nil
|
111
|
-
in_dir(@repository_dir) do
|
112
|
-
output = run_command('git log --pretty=oneline').split("\n")
|
113
|
-
end
|
114
|
-
expect(output.length).to eq(4) # plus 'mergeable change'
|
115
|
-
expect(output[0]).to match(/Braid: Update mirror 'skit1' to '[0-9a-f]{7}'/)
|
116
|
-
end
|
117
|
-
end
|
118
|
-
|
119
|
-
context 'with conflicting changes' do
|
120
|
-
it 'should leave conflict markup with the target revision' do
|
121
|
-
run_command("cp #{File.join(FIXTURE_PATH, 'shiny_skit1_conflicting', @file_name)} #{File.join(TMP_PATH, 'shiny', 'skit1', @file_name)}")
|
122
|
-
|
123
|
-
target_revision = nil
|
124
|
-
in_dir(@vendor_repository_dir) do
|
125
|
-
target_revision = run_command('git rev-parse HEAD')
|
126
|
-
end
|
127
|
-
|
128
|
-
braid_output = nil
|
129
|
-
in_dir(@repository_dir) do
|
130
|
-
run_command('git commit -a -m "conflicting change"')
|
131
|
-
braid_output = run_command("#{BRAID_BIN} update skit1")
|
132
|
-
end
|
133
|
-
expect(braid_output).to match(/Caught merge error\. Breaking\./)
|
134
|
-
|
135
|
-
run_command("grep -q \">>>>>>> #{target_revision}\" #{File.join(TMP_PATH, 'shiny', 'skit1', @file_name)}")
|
136
|
-
end
|
137
|
-
end
|
138
|
-
|
139
|
-
# Regression test for https://github.com/cristibalan/braid/issues/41.
|
140
|
-
context 'with a convergent deletion' do
|
141
|
-
it 'should not detect a bogus rename' do
|
142
|
-
in_dir(@vendor_repository_dir) do
|
143
|
-
run_command('git rm layouts/layout.liquid')
|
144
|
-
run_command('git commit -m "delete"')
|
145
|
-
end
|
146
|
-
in_dir(@repository_dir) do
|
147
|
-
run_command('git rm skit1/layouts/layout.liquid')
|
148
|
-
run_command('git commit -m "delete here too"')
|
149
|
-
end
|
150
|
-
|
151
|
-
# Without the fix, when git diffs the base and local trees, it will
|
152
|
-
# think skit1/layouts/layout.liquid was renamed to
|
153
|
-
# other-skit/layout.liquid, resulting in a rename-delete conflict.
|
154
|
-
braid_output = nil
|
155
|
-
in_dir(@repository_dir) do
|
156
|
-
braid_output = run_command("#{BRAID_BIN} update skit1")
|
157
|
-
end
|
158
|
-
expect(braid_output).not_to match(/Caught merge error\. Breaking\./)
|
159
|
-
end
|
160
|
-
end
|
161
|
-
end
|
162
|
-
|
163
|
-
describe 'from a git repository with a braid into subdirectory' do
|
164
|
-
before do
|
165
|
-
@repository_dir = create_git_repo_from_fixture('shiny')
|
166
|
-
@vendor_repository_dir = create_git_repo_from_fixture('skit1')
|
167
|
-
@file_name = 'layouts/layout.liquid'
|
168
|
-
|
169
|
-
in_dir(@repository_dir) do
|
170
|
-
run_command("#{BRAID_BIN} add #{@vendor_repository_dir} --path layouts skit-layouts")
|
171
|
-
end
|
172
|
-
|
173
|
-
update_dir_from_fixture('skit1', 'skit1.1')
|
174
|
-
in_dir(@vendor_repository_dir) do
|
175
|
-
run_command('git add *')
|
176
|
-
run_command('git commit -m "change default color"')
|
177
|
-
end
|
178
|
-
|
179
|
-
update_dir_from_fixture('skit1', 'skit1.2')
|
180
|
-
in_dir(@vendor_repository_dir) do
|
181
|
-
run_command('git add *')
|
182
|
-
run_command('git commit -m "add a happy note"')
|
183
|
-
end
|
184
|
-
end
|
185
|
-
|
186
|
-
context 'with no project-specific changes' do
|
187
|
-
it 'should add the files and commit' do
|
188
|
-
in_dir(@repository_dir) do
|
189
|
-
run_command("#{BRAID_BIN} update skit-layouts")
|
190
|
-
end
|
191
|
-
|
192
|
-
assert_no_diff("#{FIXTURE_PATH}/skit1.2/#{@file_name}", "#{@repository_dir}/skit-layouts/layout.liquid")
|
193
|
-
|
194
|
-
output = nil
|
195
|
-
in_dir(@repository_dir) do
|
196
|
-
output = run_command('git log --pretty=oneline').split("\n")
|
197
|
-
end
|
198
|
-
expect(output.length).to eq(3)
|
199
|
-
expect(output[0]).to match(/^[0-9a-f]{40} Braid: Update mirror 'skit-layouts' to '[0-9a-f]{7}'$/)
|
200
|
-
|
201
|
-
# No temporary commits should be added to the reflog.
|
202
|
-
output = nil
|
203
|
-
in_dir(@repository_dir) do
|
204
|
-
output = `git log -g --pretty=oneline`.split("\n")
|
205
|
-
end
|
206
|
-
expect(output.length).to eq(3)
|
207
|
-
end
|
208
|
-
end
|
209
|
-
end
|
210
|
-
|
211
|
-
describe 'from a git repository with a braid of a single file' do
|
212
|
-
before do
|
213
|
-
@repository_dir = create_git_repo_from_fixture('shiny')
|
214
|
-
@vendor_repository_dir = create_git_repo_from_fixture('skit1')
|
215
|
-
@file_name = 'layouts/layout.liquid'
|
216
|
-
|
217
|
-
in_dir(@repository_dir) do
|
218
|
-
run_command("#{BRAID_BIN} add #{@vendor_repository_dir} --path layouts/layout.liquid skit-layout.liquid")
|
219
|
-
end
|
220
|
-
|
221
|
-
update_dir_from_fixture('skit1', 'skit1.1x')
|
222
|
-
in_dir(@vendor_repository_dir) do
|
223
|
-
run_command('git add *')
|
224
|
-
run_command('git commit -m "change color and file mode"')
|
225
|
-
end
|
226
|
-
end
|
227
|
-
|
228
|
-
context 'with no project-specific changes' do
|
229
|
-
it 'should add the files and commit' do
|
230
|
-
in_dir(@repository_dir) do
|
231
|
-
run_command("#{BRAID_BIN} update skit-layout.liquid")
|
232
|
-
end
|
233
|
-
|
234
|
-
assert_no_diff("#{FIXTURE_PATH}/skit1.1x/#{@file_name}", "#{@repository_dir}/skit-layout.liquid")
|
235
|
-
in_dir(@repository_dir) do
|
236
|
-
if filemode_enabled
|
237
|
-
expect(File.stat('skit-layout.liquid').mode & 0100).to eq(0100)
|
238
|
-
end
|
239
|
-
end
|
240
|
-
|
241
|
-
output = nil
|
242
|
-
in_dir(@repository_dir) do
|
243
|
-
output = run_command('git log --pretty=oneline').split("\n")
|
244
|
-
end
|
245
|
-
expect(output.length).to eq(3)
|
246
|
-
expect(output[0]).to match(/^[0-9a-f]{40} Braid: Update mirror 'skit-layout.liquid' to '[0-9a-f]{7}'$/)
|
247
|
-
end
|
248
|
-
end
|
249
|
-
end
|
250
|
-
|
251
|
-
describe 'from a git repository braided in as a tag' do
|
252
|
-
before do
|
253
|
-
@repository_dir = create_git_repo_from_fixture('shiny')
|
254
|
-
@vendor_repository_dir = create_git_repo_from_fixture('skit1')
|
255
|
-
in_dir(@vendor_repository_dir) do
|
256
|
-
run_command('git tag v1')
|
257
|
-
end
|
258
|
-
@file_name = 'layouts/layout.liquid'
|
259
|
-
|
260
|
-
in_dir(@repository_dir) do
|
261
|
-
run_command("#{BRAID_BIN} add #{@vendor_repository_dir} --tag v1")
|
262
|
-
end
|
263
|
-
|
264
|
-
update_dir_from_fixture('skit1', 'skit1.1')
|
265
|
-
in_dir(@vendor_repository_dir) do
|
266
|
-
run_command('git add *')
|
267
|
-
run_command('git commit -m "change default color"')
|
268
|
-
end
|
269
|
-
|
270
|
-
update_dir_from_fixture('skit1', 'skit1.2')
|
271
|
-
in_dir(@vendor_repository_dir) do
|
272
|
-
run_command('git add *')
|
273
|
-
run_command('git commit -m "add a happy note"')
|
274
|
-
run_command('git tag -f v1')
|
275
|
-
end
|
276
|
-
end
|
277
|
-
|
278
|
-
context 'with no project-specific changes' do
|
279
|
-
it 'should add the files and commit' do
|
280
|
-
in_dir(@repository_dir) do
|
281
|
-
run_command("#{BRAID_BIN} update skit1")
|
282
|
-
end
|
283
|
-
|
284
|
-
assert_no_diff("#{FIXTURE_PATH}/skit1.2/#{@file_name}", "#{@repository_dir}/skit1/#{@file_name}")
|
285
|
-
|
286
|
-
output = nil
|
287
|
-
in_dir(@repository_dir) do
|
288
|
-
output = run_command('git log --pretty=oneline').split("\n")
|
289
|
-
end
|
290
|
-
expect(output.length).to eq(3)
|
291
|
-
expect(output[0]).to match(/^[0-9a-f]{40} Braid: Update mirror 'skit1' to '[0-9a-f]{7}'$/)
|
292
|
-
|
293
|
-
# No temporary commits should be added to the reflog.
|
294
|
-
output = nil
|
295
|
-
in_dir(@repository_dir) do
|
296
|
-
output = `git log -g --pretty=oneline`.split("\n")
|
297
|
-
end
|
298
|
-
expect(output.length).to eq(3)
|
299
|
-
end
|
300
|
-
end
|
301
|
-
|
302
|
-
context 'with mergeable changes to the same file' do
|
303
|
-
it 'should auto-merge and commit' do
|
304
|
-
run_command("cp #{File.join(FIXTURE_PATH, 'shiny_skit1_mergeable', @file_name)} #{File.join(TMP_PATH, 'shiny', 'skit1', @file_name)}")
|
305
|
-
|
306
|
-
in_dir(@repository_dir) do
|
307
|
-
run_command('git commit -a -m "mergeable change"')
|
308
|
-
run_command("#{BRAID_BIN} update skit1")
|
309
|
-
end
|
310
|
-
|
311
|
-
assert_no_diff("#{FIXTURE_PATH}/shiny_skit1.2_merged/#{@file_name}", "#{@repository_dir}/skit1/#{@file_name}")
|
312
|
-
|
313
|
-
output = nil
|
314
|
-
in_dir(@repository_dir) do
|
315
|
-
output = run_command('git log --pretty=oneline').split("\n")
|
316
|
-
end
|
317
|
-
expect(output.length).to eq(4) # plus 'mergeable change'
|
318
|
-
expect(output[0]).to match(/Braid: Update mirror 'skit1' to '[0-9a-f]{7}'/)
|
319
|
-
end
|
320
|
-
end
|
321
|
-
|
322
|
-
context 'with conflicting changes' do
|
323
|
-
it 'should leave conflict markup with the target revision' do
|
324
|
-
run_command("cp #{File.join(FIXTURE_PATH, 'shiny_skit1_conflicting', @file_name)} #{File.join(TMP_PATH, 'shiny', 'skit1', @file_name)}")
|
325
|
-
|
326
|
-
target_revision = nil
|
327
|
-
in_dir(@vendor_repository_dir) do
|
328
|
-
target_revision = run_command('git rev-parse HEAD')
|
329
|
-
end
|
330
|
-
|
331
|
-
braid_output = nil
|
332
|
-
in_dir(@repository_dir) do
|
333
|
-
run_command('git commit -a -m "conflicting change"')
|
334
|
-
braid_output = run_command("#{BRAID_BIN} update skit1")
|
335
|
-
end
|
336
|
-
expect(braid_output).to match(/Caught merge error\. Breaking\./)
|
337
|
-
|
338
|
-
run_command("grep -q '>>>>>>> #{target_revision}' #{File.join(TMP_PATH, 'shiny', 'skit1', @file_name)}")
|
339
|
-
end
|
340
|
-
end
|
341
|
-
end
|
342
|
-
|
343
|
-
tracking_strategy =
|
344
|
-
{
|
345
|
-
'branch' => 'master',
|
346
|
-
'tag' => 'v1',
|
347
|
-
'revision' => nil,
|
348
|
-
}
|
349
|
-
|
350
|
-
tracking_strategy.each_pair do |initial_strategy, initial_value|
|
351
|
-
describe "from a git repository from tracking strategy #{initial_strategy} '#{initial_value}'" do
|
352
|
-
before do
|
353
|
-
@repository_dir = create_git_repo_from_fixture('shiny')
|
354
|
-
@vendor_repository_dir = create_git_repo_from_fixture('skit1')
|
355
|
-
@file_name = 'layouts/layout.liquid'
|
356
|
-
|
357
|
-
@initial_revision = nil
|
358
|
-
in_dir(@vendor_repository_dir) do
|
359
|
-
run_command('git tag v1')
|
360
|
-
@initial_revision = run_command('git rev-parse HEAD').strip
|
361
|
-
end
|
362
|
-
in_dir(@repository_dir) do
|
363
|
-
run_command("#{BRAID_BIN} add #{@vendor_repository_dir} --#{initial_strategy} #{initial_value || @initial_revision}")
|
364
|
-
end
|
365
|
-
|
366
|
-
update_dir_from_fixture('skit1', 'skit1.1')
|
367
|
-
in_dir(@vendor_repository_dir) do
|
368
|
-
run_command('git add *')
|
369
|
-
run_command('git commit -m "change default color"')
|
370
|
-
end
|
371
|
-
|
372
|
-
@target_revision = nil
|
373
|
-
update_dir_from_fixture('skit1', 'skit1.2')
|
374
|
-
in_dir(@vendor_repository_dir) do
|
375
|
-
run_command('git add *')
|
376
|
-
run_command('git commit -m "add a happy note"')
|
377
|
-
@target_revision = run_command('git rev-parse HEAD').strip
|
378
|
-
run_command('git tag -f v1')
|
379
|
-
end
|
380
|
-
end
|
381
|
-
|
382
|
-
context 'with no project-specific changes' do
|
383
|
-
if initial_strategy != 'revision'
|
384
|
-
it 'should add the files and commit' do
|
385
|
-
in_dir(@repository_dir) do
|
386
|
-
run_command("#{BRAID_BIN} update skit1")
|
387
|
-
end
|
388
|
-
|
389
|
-
assert_no_diff("#{FIXTURE_PATH}/skit1.2/#{@file_name}", "#{@repository_dir}/skit1/layouts/layout.liquid")
|
390
|
-
|
391
|
-
output = nil
|
392
|
-
in_dir(@repository_dir) do
|
393
|
-
output = run_command('git log --pretty=oneline').split("\n")
|
394
|
-
end
|
395
|
-
expect(output.length).to eq(3)
|
396
|
-
expect(output[0]).to match(/^[0-9a-f]{40} Braid: Update mirror 'skit1' to '[0-9a-f]{7}'$/)
|
397
|
-
|
398
|
-
# No temporary commits should be added to the reflog.
|
399
|
-
output = nil
|
400
|
-
in_dir(@repository_dir) do
|
401
|
-
output = `git log -g --pretty=oneline`.split("\n")
|
402
|
-
end
|
403
|
-
expect(output.length).to eq(3)
|
404
|
-
end
|
405
|
-
|
406
|
-
context 'with mergeable changes to the same file' do
|
407
|
-
it 'should auto-merge and commit' do
|
408
|
-
run_command("cp #{File.join(FIXTURE_PATH, 'shiny_skit1_mergeable', @file_name)} #{File.join(TMP_PATH, 'shiny', 'skit1', @file_name)}")
|
409
|
-
|
410
|
-
in_dir(@repository_dir) do
|
411
|
-
run_command('git commit -a -m "mergeable change"')
|
412
|
-
run_command("#{BRAID_BIN} update skit1")
|
413
|
-
end
|
414
|
-
|
415
|
-
assert_no_diff("#{FIXTURE_PATH}/shiny_skit1.2_merged/#{@file_name}", "#{@repository_dir}/skit1/#{@file_name}")
|
416
|
-
|
417
|
-
output = nil
|
418
|
-
in_dir(@repository_dir) do
|
419
|
-
output = run_command('git log --pretty=oneline').split("\n")
|
420
|
-
end
|
421
|
-
expect(output.length).to eq(4) # plus 'mergeable change'
|
422
|
-
expect(output[0]).to match(/Braid: Update mirror 'skit1' to '[0-9a-f]{7}'/)
|
423
|
-
end
|
424
|
-
end
|
425
|
-
else
|
426
|
-
it 'should not change files as revision not changed' do
|
427
|
-
in_dir(@repository_dir) do
|
428
|
-
run_command("#{BRAID_BIN} update skit1 --verbose")
|
429
|
-
end
|
430
|
-
|
431
|
-
assert_no_diff("#{FIXTURE_PATH}/skit1/#{@file_name}", "#{@repository_dir}/skit1/#{@file_name}")
|
432
|
-
|
433
|
-
output = nil
|
434
|
-
in_dir(@repository_dir) do
|
435
|
-
output = run_command('git log --pretty=oneline').split("\n")
|
436
|
-
end
|
437
|
-
expect(output.length).to eq(2)
|
438
|
-
|
439
|
-
# No temporary commits should be added to the reflog.
|
440
|
-
output = nil
|
441
|
-
in_dir(@repository_dir) do
|
442
|
-
output = `git log -g --pretty=oneline`.split("\n")
|
443
|
-
end
|
444
|
-
expect(output.length).to eq(2)
|
445
|
-
end
|
446
|
-
end
|
447
|
-
end
|
448
|
-
|
449
|
-
tracking_strategy.each_pair do |target_strategy, target_value|
|
450
|
-
describe "to a tracking strategy #{target_strategy} '#{target_value}'" do
|
451
|
-
it 'should add the files and commit' do
|
452
|
-
output = nil
|
453
|
-
in_dir(@repository_dir) do
|
454
|
-
output = run_command("#{BRAID_BIN} update skit1 --#{target_strategy} #{target_value || @target_revision}").split("\n")
|
455
|
-
end
|
456
|
-
|
457
|
-
index = 0
|
458
|
-
expect(output[index]).to match(/^Braid: Updating mirror 'skit1'.$/)
|
459
|
-
|
460
|
-
if initial_strategy != target_strategy || target_strategy == 'revision'
|
461
|
-
index = index + 1
|
462
|
-
expect(output[index]).to match(/^Braid: Switching mirror 'skit1' to #{target_strategy} '#{target_value || @target_revision}' from #{initial_strategy} '#{initial_value || @initial_revision}'.$/)
|
463
|
-
end
|
464
|
-
index = index + 1
|
465
|
-
expect(output[index]).to match(/^Braid: Updated mirror to '[0-9a-f]{7}'.$/)
|
466
|
-
|
467
|
-
assert_no_diff("#{FIXTURE_PATH}/skit1.2/#{@file_name}", "#{@repository_dir}/skit1/layouts/layout.liquid")
|
468
|
-
|
469
|
-
output = nil
|
470
|
-
in_dir(@repository_dir) do
|
471
|
-
output = run_command('git log --pretty=oneline').split("\n")
|
472
|
-
end
|
473
|
-
expect(output.length).to eq(3)
|
474
|
-
expect(output[0]).to match(/^[0-9a-f]{40} Braid: Update mirror 'skit1' to '[0-9a-f]{7}'$/)
|
475
|
-
|
476
|
-
# No temporary commits should be added to the reflog.
|
477
|
-
output = nil
|
478
|
-
in_dir(@repository_dir) do
|
479
|
-
output = `git log -g --pretty=oneline`.split("\n")
|
480
|
-
end
|
481
|
-
expect(output.length).to eq(3)
|
482
|
-
end
|
483
|
-
end
|
484
|
-
end
|
485
|
-
end
|
486
|
-
end
|
487
|
-
end
|