git-process 1.0.11 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +37 -9
- data/Gemfile +2 -2
- data/Gemfile.lock +17 -17
- data/README.md +14 -7
- data/bin/git-new-fb +10 -2
- data/bin/git-pull-request +30 -6
- data/bin/git-sync +5 -2
- data/bin/git-to-master +62 -11
- data/git-process.gemspec +15 -15
- data/lib/git-process/abstract_error_builder.rb +0 -3
- data/lib/git-process/changed_file_helper.rb +30 -24
- data/lib/git-process/git_abstract_merge_error_builder.rb +31 -11
- data/lib/git-process/git_branch.rb +5 -0
- data/lib/git-process/git_config.rb +153 -0
- data/lib/git-process/git_lib.rb +212 -164
- data/lib/git-process/git_logger.rb +84 -0
- data/lib/git-process/git_merge_error.rb +3 -14
- data/lib/git-process/git_process.rb +44 -73
- data/lib/git-process/git_process_options.rb +6 -6
- data/lib/git-process/git_rebase_error.rb +4 -13
- data/lib/git-process/git_remote.rb +254 -0
- data/lib/git-process/github_configuration.rb +298 -0
- data/lib/git-process/github_pull_request.rb +65 -27
- data/lib/git-process/new_fb.rb +14 -4
- data/lib/git-process/parked_changes_error.rb +1 -1
- data/lib/git-process/pull_request.rb +100 -13
- data/lib/git-process/pull_request_error.rb +25 -0
- data/lib/git-process/rebase_to_master.rb +47 -27
- data/lib/git-process/sync.rb +48 -33
- data/lib/git-process/uncommitted_changes_error.rb +1 -1
- data/lib/git-process/version.rb +2 -2
- data/spec/GitRepoHelper.rb +48 -25
- data/spec/changed_file_helper_spec.rb +39 -58
- data/spec/git_abstract_merge_error_builder_spec.rb +42 -33
- data/spec/git_branch_spec.rb +30 -30
- data/spec/git_config_spec.rb +45 -0
- data/spec/git_lib_spec.rb +103 -122
- data/spec/git_logger_spec.rb +66 -0
- data/spec/git_process_spec.rb +81 -81
- data/spec/git_remote_spec.rb +188 -0
- data/spec/git_status_spec.rb +36 -36
- data/spec/github_configuration_spec.rb +152 -0
- data/spec/github_pull_request_spec.rb +39 -35
- data/spec/github_test_helper.rb +49 -0
- data/spec/new_fb_spec.rb +65 -24
- data/spec/pull_request_helper.rb +94 -0
- data/spec/pull_request_spec.rb +128 -0
- data/spec/rebase_to_master_spec.rb +241 -145
- data/spec/spec_helper.rb +20 -0
- data/spec/sync_spec.rb +115 -109
- metadata +34 -20
- data/lib/git-process/github_client.rb +0 -83
- data/lib/git-process/github_service.rb +0 -174
- data/spec/github_service_spec.rb +0 -211
@@ -15,7 +15,7 @@ require 'git-process/git_process_error'
|
|
15
15
|
module GitProc
|
16
16
|
|
17
17
|
class UncommittedChangesError < GitProcessError
|
18
|
-
def initialize
|
18
|
+
def initialize
|
19
19
|
super("There are uncommitted changes.\nPlease either commit your changes, or use 'git stash' to set them aside.")
|
20
20
|
end
|
21
21
|
end
|
data/lib/git-process/version.rb
CHANGED
data/spec/GitRepoHelper.rb
CHANGED
@@ -1,23 +1,42 @@
|
|
1
|
+
require 'tmpdir'
|
1
2
|
require 'FileHelpers'
|
2
3
|
require 'git-process/git_process'
|
4
|
+
include GitProc
|
3
5
|
|
4
6
|
module GitRepoHelper
|
5
7
|
|
6
8
|
def gitprocess
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
@gitprocess
|
9
|
+
if @gitprocess.nil? and respond_to?(:create_process)
|
10
|
+
@gitprocess = create_process(gitlib, :log_level => log_level)
|
11
|
+
end
|
12
|
+
@gitprocess
|
13
|
+
end
|
14
|
+
|
15
|
+
|
16
|
+
def gitlib
|
17
|
+
if @gitlib.nil?
|
18
|
+
if @gitprocess.nil?
|
19
|
+
@gitlib = create_gitlib(Dir.mktmpdir, :log_level => log_level)
|
20
|
+
else
|
21
|
+
@gitlib = gitprocess.gitlib
|
22
|
+
end
|
23
|
+
end
|
24
|
+
@gitlib
|
11
25
|
end
|
12
26
|
|
13
27
|
|
14
|
-
def
|
15
|
-
|
28
|
+
def config
|
29
|
+
gitlib.config
|
30
|
+
end
|
31
|
+
|
32
|
+
|
33
|
+
def remote
|
34
|
+
gitlib.remote
|
16
35
|
end
|
17
36
|
|
18
37
|
|
19
38
|
def commit_count
|
20
|
-
|
39
|
+
gitlib.log_count
|
21
40
|
end
|
22
41
|
|
23
42
|
|
@@ -27,55 +46,60 @@ module GitRepoHelper
|
|
27
46
|
|
28
47
|
|
29
48
|
def logger
|
30
|
-
|
49
|
+
gitlib.logger
|
31
50
|
end
|
32
51
|
|
33
52
|
|
34
53
|
def create_files(file_names)
|
35
|
-
|
54
|
+
GitRepoHelper.create_files gitlib, file_names
|
55
|
+
end
|
56
|
+
|
57
|
+
|
58
|
+
def self.create_files(gitlib, file_names)
|
59
|
+
Dir.chdir(gitlib.workdir) do |dir|
|
36
60
|
file_names.each do |fn|
|
37
|
-
|
61
|
+
gitlib.logger.debug { "Creating #{dir}/#{fn}" }
|
38
62
|
FileUtils.touch fn
|
39
63
|
end
|
40
64
|
end
|
41
|
-
|
65
|
+
gitlib.add(file_names)
|
42
66
|
end
|
43
67
|
|
44
68
|
|
45
|
-
def change_file(filename, contents, lib =
|
69
|
+
def change_file(filename, contents, lib = gitlib)
|
46
70
|
Dir.chdir(lib.workdir) do
|
47
71
|
File.open(filename, 'w') { |f| f.puts contents }
|
48
72
|
end
|
49
73
|
end
|
50
74
|
|
51
75
|
|
52
|
-
def change_file_and_add(filename, contents, lib =
|
76
|
+
def change_file_and_add(filename, contents, lib = gitlib)
|
53
77
|
change_file(filename, contents, lib)
|
54
78
|
lib.add(filename)
|
55
79
|
end
|
56
80
|
|
57
81
|
|
58
|
-
def change_file_and_commit(filename, contents, lib =
|
82
|
+
def change_file_and_commit(filename, contents, lib = gitlib)
|
59
83
|
change_file_and_add(filename, contents, lib)
|
60
84
|
lib.commit("#{filename} - #{contents}")
|
61
85
|
end
|
62
86
|
|
63
87
|
|
64
|
-
def
|
65
|
-
|
88
|
+
def create_gitlib(dir, opts)
|
89
|
+
git_lib = GitLib.new(dir, opts)
|
90
|
+
git_lib.config['user.email'] = 'test.user@test.com'
|
91
|
+
git_lib.config['user.name'] = 'test user'
|
92
|
+
git_lib
|
66
93
|
end
|
67
94
|
|
68
95
|
|
69
|
-
def
|
96
|
+
def clone_repo(branch='master', remote_name = 'origin', &block)
|
70
97
|
td = Dir.mktmpdir
|
71
98
|
|
72
|
-
logger.debug { "Cloning '#{
|
99
|
+
logger.debug { "Cloning '#{gitlib.workdir}' to '#{td}'" }
|
73
100
|
|
74
|
-
|
75
|
-
|
76
|
-
opts[:verbose] = true if log_level == Logger::DEBUG
|
77
|
-
gl = create_process(td, opts)
|
78
|
-
gl.add_remote(remote_name, "file://#{tmpdir}")
|
101
|
+
gl = create_gitlib(td, :log_level => logger.level)
|
102
|
+
gl.remote.add(remote_name, "file://#{gitlib.workdir}")
|
79
103
|
gl.fetch(remote_name)
|
80
104
|
|
81
105
|
if branch == 'master'
|
@@ -87,9 +111,8 @@ module GitRepoHelper
|
|
87
111
|
if block_given?
|
88
112
|
begin
|
89
113
|
block.arity < 1 ? gl.instance_eval(&block) : block.call(gl)
|
90
|
-
|
114
|
+
ensure
|
91
115
|
rm_rf(gl.workdir)
|
92
|
-
raise exp
|
93
116
|
end
|
94
117
|
nil
|
95
118
|
else
|
@@ -1,58 +1,39 @@
|
|
1
1
|
require 'git-process/sync'
|
2
|
-
|
3
|
-
|
4
|
-
module GitProc
|
5
|
-
|
6
|
-
class CFHStub < Process
|
7
|
-
include ChangeFileHelper
|
8
|
-
|
9
|
-
|
10
|
-
def cleanup
|
11
|
-
stash_pop if @stash_pushed
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
|
18
|
-
|
19
|
-
describe GitProc::ChangeFileHelper do
|
20
|
-
include GitRepoHelper
|
21
|
-
|
22
|
-
before(:each) do
|
23
|
-
create_files(%w(.gitignore))
|
24
|
-
gitprocess.commit('initial')
|
25
|
-
end
|
26
|
-
|
27
|
-
|
28
|
-
after(:each) do
|
29
|
-
rm_rf(tmpdir)
|
30
|
-
end
|
2
|
+
include GitProc
|
31
3
|
|
4
|
+
describe ChangeFileHelper, :git_repo_helper do
|
32
5
|
|
33
6
|
def log_level
|
34
7
|
Logger::ERROR
|
35
8
|
end
|
36
9
|
|
37
10
|
|
11
|
+
#noinspection RubyUnusedLocalVariable
|
38
12
|
def create_process(dir, opts)
|
39
|
-
|
13
|
+
nil
|
40
14
|
end
|
41
15
|
|
42
16
|
|
43
|
-
describe
|
17
|
+
describe 'uncommitted changes' do
|
44
18
|
|
45
19
|
it 'should fail when there are unmerged files' do
|
46
20
|
change_file_and_commit('modified file.txt', 'start')
|
47
21
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
22
|
+
clone_repo do |gl|
|
23
|
+
change_file_and_commit('modified file.txt', 'changed', gl)
|
24
|
+
change_file_and_commit('modified file.txt', 'conflict', gitlib)
|
25
|
+
gl.fetch
|
26
|
+
|
27
|
+
gl.merge('origin/master') rescue ''
|
28
|
+
|
29
|
+
change_file_helper = ChangeFileHelper.new(gl)
|
30
|
+
expect { change_file_helper.offer_to_help_uncommitted_changes }.to raise_error GitProc::UncommittedChangesError
|
31
|
+
end
|
32
|
+
end
|
52
33
|
|
53
|
-
gp.merge('origin/master') rescue ''
|
54
34
|
|
55
|
-
|
35
|
+
def change_file_helper
|
36
|
+
@change_file_helper ||= ChangeFileHelper.new(gitlib)
|
56
37
|
end
|
57
38
|
|
58
39
|
|
@@ -60,23 +41,23 @@ describe GitProc::ChangeFileHelper do
|
|
60
41
|
|
61
42
|
before(:each) do
|
62
43
|
change_file('unknown file.txt', '')
|
63
|
-
|
44
|
+
change_file_helper.stub(:say)
|
64
45
|
end
|
65
46
|
|
66
47
|
|
67
48
|
it 'should then add it' do
|
68
|
-
|
69
|
-
|
49
|
+
ChangeFileHelper.stub(:ask_how_to_handle_unknown_files).and_return(:add)
|
50
|
+
change_file_helper.gitlib.should_receive(:add).with(['unknown file.txt'])
|
70
51
|
|
71
|
-
|
52
|
+
change_file_helper.offer_to_help_uncommitted_changes
|
72
53
|
end
|
73
54
|
|
74
55
|
|
75
56
|
it 'should ignore the file' do
|
76
|
-
|
77
|
-
|
57
|
+
ChangeFileHelper.stub(:ask_how_to_handle_unknown_files).and_return(:ignore)
|
58
|
+
change_file_helper.should_not_receive(:add)
|
78
59
|
|
79
|
-
|
60
|
+
change_file_helper.offer_to_help_uncommitted_changes
|
80
61
|
end
|
81
62
|
|
82
63
|
end
|
@@ -97,9 +78,9 @@ describe GitProc::ChangeFileHelper do
|
|
97
78
|
change_file('modified file2.txt', 'modified again')
|
98
79
|
change_file_and_add('removed file2.txt', 'content')
|
99
80
|
change_file_and_add('modified file4.txt', 'content')
|
100
|
-
File.delete(File.join(
|
101
|
-
File.delete(File.join(
|
102
|
-
File.delete(File.join(
|
81
|
+
File.delete(File.join(gitlib.workdir, 'removed file.txt'))
|
82
|
+
File.delete(File.join(gitlib.workdir, 'removed file2.txt'))
|
83
|
+
File.delete(File.join(gitlib.workdir, 'modified file3.txt'))
|
103
84
|
|
104
85
|
# End state of the above is:
|
105
86
|
# A "added file.txt"
|
@@ -110,30 +91,30 @@ describe GitProc::ChangeFileHelper do
|
|
110
91
|
# D "removed file.txt"
|
111
92
|
# AD "removed file2.txt"
|
112
93
|
|
113
|
-
|
94
|
+
change_file_helper.stub(:say)
|
114
95
|
end
|
115
96
|
|
116
97
|
|
117
98
|
it 'should ask about modified files, then commit them' do
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
99
|
+
ChangeFileHelper.stub(:ask_how_to_handle_changed_files).and_return(:commit)
|
100
|
+
gitlib.should_receive(:add).with(["added file.txt", "modified file.txt", "modified file2.txt", "modified file4.txt"])
|
101
|
+
gitlib.should_receive(:remove).with(["modified file3.txt", "removed file.txt", "removed file2.txt"])
|
102
|
+
gitlib.should_receive(:commit).with(nil)
|
122
103
|
|
123
|
-
|
104
|
+
change_file_helper.offer_to_help_uncommitted_changes
|
124
105
|
end
|
125
106
|
|
126
107
|
|
127
108
|
it 'should ask about modified files, then stash them' do
|
128
|
-
|
109
|
+
ChangeFileHelper.stub(:ask_how_to_handle_changed_files).and_return(:stash)
|
129
110
|
|
130
|
-
|
111
|
+
change_file_helper.offer_to_help_uncommitted_changes
|
131
112
|
|
132
|
-
|
113
|
+
gitlib.status.clean?.should be_true
|
133
114
|
|
134
|
-
|
115
|
+
gitlib.stash_pop
|
135
116
|
|
136
|
-
stat =
|
117
|
+
stat = gitlib.status
|
137
118
|
stat.added.should == ["added file.txt", "removed file2.txt"]
|
138
119
|
stat.modified.should == ["modified file.txt", "modified file2.txt", "modified file4.txt"]
|
139
120
|
stat.deleted.should == ["modified file3.txt", "removed file.txt"]
|
@@ -1,38 +1,42 @@
|
|
1
1
|
require 'git-process/git_abstract_merge_error_builder'
|
2
|
+
require 'git-process/git_lib'
|
3
|
+
require 'FileHelpers'
|
2
4
|
|
3
5
|
describe GitProc::AbstractMergeErrorBuilder do
|
4
6
|
|
5
7
|
def builder
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
end
|
13
|
-
@builder
|
8
|
+
@builder ||= GitProc::AbstractMergeErrorBuilder.new(gitlib, '', nil)
|
9
|
+
end
|
10
|
+
|
11
|
+
|
12
|
+
after(:each) do
|
13
|
+
rm_rf(gitlib.workdir)
|
14
14
|
end
|
15
15
|
|
16
16
|
|
17
|
-
def
|
18
|
-
|
19
|
-
@lib =
|
20
|
-
@lib.
|
21
|
-
@lib.
|
22
|
-
@lib
|
17
|
+
def gitlib
|
18
|
+
if @lib.nil?
|
19
|
+
@lib = GitProc::GitLib.new(Dir.mktmpdir, :log_level => Logger::ERROR)
|
20
|
+
@lib.config.rerere_enabled = true
|
21
|
+
@lib.config.rerere_autoupdate = true
|
22
|
+
mock_status(@lib)
|
23
23
|
end
|
24
24
|
@lib
|
25
25
|
end
|
26
26
|
|
27
27
|
|
28
|
-
def
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
28
|
+
def metaclass(obj)
|
29
|
+
class << obj
|
30
|
+
self
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
|
35
|
+
def mock_status(lib)
|
36
|
+
spec = self
|
37
|
+
metaclass(lib).send(:define_method, :status) do
|
38
|
+
@status ||= spec.double('status')
|
34
39
|
end
|
35
|
-
@status
|
36
40
|
end
|
37
41
|
|
38
42
|
|
@@ -46,9 +50,10 @@ describe GitProc::AbstractMergeErrorBuilder do
|
|
46
50
|
|
47
51
|
|
48
52
|
it "merged with rerere.enabled false" do
|
49
|
-
|
50
|
-
status.stub(:unmerged).and_return(['a', 'b c'])
|
51
|
-
status.stub(:modified).and_return(['a', 'b c'])
|
53
|
+
gitlib.config.rerere_enabled = false
|
54
|
+
gitlib.status.stub(:unmerged).and_return(['a', 'b c'])
|
55
|
+
gitlib.status.stub(:modified).and_return(['a', 'b c'])
|
56
|
+
gitlib.status.stub(:added).and_return([])
|
52
57
|
|
53
58
|
builder.resolved_files.should == []
|
54
59
|
builder.unresolved_files.should == ['a', 'b c']
|
@@ -64,8 +69,11 @@ describe GitProc::AbstractMergeErrorBuilder do
|
|
64
69
|
|
65
70
|
|
66
71
|
it "merged with rerere.enabled true and auto-handled AND autoupdated a file" do
|
67
|
-
|
68
|
-
|
72
|
+
gitlib.config.rerere_enabled = true
|
73
|
+
gitlib.config.rerere_autoupdate = true
|
74
|
+
gitlib.status.stub(:unmerged).and_return(['a', 'b c'])
|
75
|
+
gitlib.status.stub(:modified).and_return(['a', 'b c'])
|
76
|
+
gitlib.status.stub(:added).and_return([])
|
69
77
|
builder.stub(:error_message).and_return("\nResolved 'a' using previous resolution.\n")
|
70
78
|
|
71
79
|
builder.resolved_files.should == %w(a)
|
@@ -81,9 +89,10 @@ describe GitProc::AbstractMergeErrorBuilder do
|
|
81
89
|
|
82
90
|
|
83
91
|
it "merged with rerere.enabled true and auto-handled and not autoupdated a file" do
|
84
|
-
|
85
|
-
status.stub(:unmerged).and_return(['a', 'b c'])
|
86
|
-
status.stub(:modified).and_return(['a', 'b c'])
|
92
|
+
gitlib.config.rerere_autoupdate = false
|
93
|
+
gitlib.status.stub(:unmerged).and_return(['a', 'b c'])
|
94
|
+
gitlib.status.stub(:modified).and_return(['a', 'b c'])
|
95
|
+
gitlib.status.stub(:added).and_return([])
|
87
96
|
builder.stub(:error_message).and_return("\nResolved 'a' using previous resolution.\n")
|
88
97
|
|
89
98
|
builder.resolved_files.should == %w(a)
|
@@ -100,10 +109,10 @@ describe GitProc::AbstractMergeErrorBuilder do
|
|
100
109
|
|
101
110
|
|
102
111
|
it "merged with a file added in both branches" do
|
103
|
-
|
104
|
-
status.stub(:unmerged).and_return(%w(a))
|
105
|
-
status.stub(:modified).and_return(%w(b))
|
106
|
-
status.stub(:added).and_return(%w(a c))
|
112
|
+
gitlib.config.rerere_autoupdate = false
|
113
|
+
gitlib.status.stub(:unmerged).and_return(%w(a))
|
114
|
+
gitlib.status.stub(:modified).and_return(%w(b))
|
115
|
+
gitlib.status.stub(:added).and_return(%w(a c))
|
107
116
|
|
108
117
|
builder.resolved_files.should == %w()
|
109
118
|
builder.unresolved_files.should == %w(a)
|
data/spec/git_branch_spec.rb
CHANGED
@@ -12,28 +12,28 @@ describe GitProc::GitBranch do
|
|
12
12
|
|
13
13
|
before(:each) do
|
14
14
|
create_files(%w(.gitignore))
|
15
|
-
|
15
|
+
gitlib.commit('initial')
|
16
16
|
end
|
17
17
|
|
18
18
|
|
19
19
|
after(:each) do
|
20
|
-
rm_rf(
|
20
|
+
rm_rf(gitlib.workdir)
|
21
21
|
end
|
22
22
|
|
23
23
|
|
24
|
-
describe
|
24
|
+
describe 'contains_all_of' do
|
25
25
|
|
26
|
-
it
|
27
|
-
current =
|
26
|
+
it 'should handle the trivial case' do
|
27
|
+
current = gitlib.branches.current
|
28
28
|
current.contains_all_of(current.name).should == true
|
29
29
|
end
|
30
30
|
|
31
31
|
|
32
|
-
it
|
33
|
-
base_branch =
|
32
|
+
it 'should handle new branch containing base branch that did not change' do
|
33
|
+
base_branch = gitlib.branches.current
|
34
34
|
|
35
|
-
|
36
|
-
current =
|
35
|
+
gitlib.checkout('fb', :new_branch => base_branch.name)
|
36
|
+
current = gitlib.branches.current
|
37
37
|
|
38
38
|
change_file_and_commit('a', 'hello')
|
39
39
|
|
@@ -42,27 +42,27 @@ describe GitProc::GitBranch do
|
|
42
42
|
|
43
43
|
|
44
44
|
it "should handle new branch containing base branch that did change" do
|
45
|
-
base_branch =
|
45
|
+
base_branch = gitlib.branches.current
|
46
46
|
|
47
|
-
|
48
|
-
current =
|
47
|
+
gitlib.checkout('fb', :new_branch => base_branch.name)
|
48
|
+
current = gitlib.branches.current
|
49
49
|
|
50
|
-
|
50
|
+
gitlib.checkout(base_branch.name)
|
51
51
|
change_file_and_commit('a', 'goodbye')
|
52
52
|
|
53
53
|
current.contains_all_of(base_branch.name).should == false
|
54
54
|
end
|
55
55
|
|
56
56
|
|
57
|
-
it
|
58
|
-
base_branch =
|
57
|
+
it 'should handle containing in both branches' do
|
58
|
+
base_branch = gitlib.branches.current
|
59
59
|
|
60
|
-
|
61
|
-
current =
|
60
|
+
gitlib.checkout('fb', :new_branch => base_branch.name)
|
61
|
+
current = gitlib.branches.current
|
62
62
|
|
63
63
|
change_file_and_commit('a', 'hello')
|
64
64
|
|
65
|
-
|
65
|
+
gitlib.checkout(base_branch.name)
|
66
66
|
change_file_and_commit('a', 'goodbye')
|
67
67
|
|
68
68
|
current.contains_all_of(base_branch.name).should == false
|
@@ -74,16 +74,16 @@ describe GitProc::GitBranch do
|
|
74
74
|
describe "is_ahead_of" do
|
75
75
|
|
76
76
|
it "should handle the trivial case" do
|
77
|
-
current =
|
77
|
+
current = gitlib.branches.current
|
78
78
|
current.is_ahead_of(current.name).should == false # same is not "ahead of"
|
79
79
|
end
|
80
80
|
|
81
81
|
|
82
82
|
it "should handle new branch containing base branch that did not change" do
|
83
|
-
base_branch =
|
83
|
+
base_branch = gitlib.branches.current
|
84
84
|
|
85
|
-
|
86
|
-
current =
|
85
|
+
gitlib.checkout('fb', :new_branch => base_branch.name)
|
86
|
+
current = gitlib.branches.current
|
87
87
|
|
88
88
|
change_file_and_commit('a', 'hello')
|
89
89
|
|
@@ -92,12 +92,12 @@ describe GitProc::GitBranch do
|
|
92
92
|
|
93
93
|
|
94
94
|
it "should handle new branch containing base branch that did change" do
|
95
|
-
base_branch =
|
95
|
+
base_branch = gitlib.branches.current
|
96
96
|
|
97
|
-
|
98
|
-
current =
|
97
|
+
gitlib.checkout('fb', :new_branch => base_branch.name)
|
98
|
+
current = gitlib.branches.current
|
99
99
|
|
100
|
-
|
100
|
+
gitlib.checkout(base_branch.name)
|
101
101
|
change_file_and_commit('a', 'goodbye')
|
102
102
|
|
103
103
|
current.is_ahead_of(base_branch.name).should == false
|
@@ -105,14 +105,14 @@ describe GitProc::GitBranch do
|
|
105
105
|
|
106
106
|
|
107
107
|
it "should handle containing in both branches" do
|
108
|
-
base_branch =
|
108
|
+
base_branch = gitlib.branches.current
|
109
109
|
|
110
|
-
|
111
|
-
current =
|
110
|
+
gitlib.checkout('fb', :new_branch => base_branch.name)
|
111
|
+
current = gitlib.branches.current
|
112
112
|
|
113
113
|
change_file_and_commit('a', 'hello')
|
114
114
|
|
115
|
-
|
115
|
+
gitlib.checkout(base_branch.name)
|
116
116
|
change_file_and_commit('a', 'goodbye')
|
117
117
|
|
118
118
|
current.is_ahead_of(base_branch.name).should == false
|