@@ -31,7 +31,7 @@ func TestNewRepoGetsCreatedWithAbsolutePath(t *testing.T) {
31
31
32
32
func TestNoAdditionsBetweenSameRef (t * testing.T ) {
33
33
doInRepoWithCommit (func (git * git_testing.GitTesting ) {
34
- assert .Len (t , RepoLocatedAt (git .GetRoot ()).AdditionsWithinRange ("HEAD" , "HEAD" ), 0 ,
34
+ assert .Len (t , RepoLocatedAt (git .Root ()).AdditionsWithinRange ("HEAD" , "HEAD" ), 0 ,
35
35
"There should be no additions between a ref and itself." )
36
36
})
37
37
}
@@ -42,7 +42,7 @@ func TestGetDiffForStagedFiles(t *testing.T) {
42
42
git .CreateFileWithContents ("new.txt" , "created contents" )
43
43
git .Add ("a.txt" )
44
44
git .Add ("new.txt" )
45
- repo := RepoLocatedAt (git .GetRoot ())
45
+ repo := RepoLocatedAt (git .Root ())
46
46
additions := repo .GetDiffForStagedFiles ()
47
47
48
48
if assert .Len (t , additions , 2 ) {
@@ -80,7 +80,7 @@ func TestGetDiffForStagedFilesWithSpacesInPath(t *testing.T) {
80
80
doInRepoWithCommit (func (git * git_testing.GitTesting ) {
81
81
git .AppendFileContent ("folder b/c.txt" , "New content.\n " , "Spanning multiple lines, even." )
82
82
git .Add ("folder b/c.txt" )
83
- repo := RepoLocatedAt (git .GetRoot ())
83
+ repo := RepoLocatedAt (git .Root ())
84
84
additions := repo .GetDiffForStagedFiles ()
85
85
86
86
if assert .Len (t , additions , 1 ) {
@@ -109,7 +109,7 @@ func TestAdditionsReturnsEditsAndAdds(t *testing.T) {
109
109
git .CreateFileWithContents ("new.txt" , "created contents" )
110
110
git .AddAndcommit ("*" , "added to lorem-ipsum content with my own stuff!" )
111
111
112
- additions := RepoLocatedAt (git .GetRoot ()).additionsInLastCommit ()
112
+ additions := RepoLocatedAt (git .Root ()).additionsInLastCommit ()
113
113
assert .Len (t , additions , 2 )
114
114
assert .True (t , strings .HasSuffix (string (additions [0 ].Data ), "New content.\n Spanning multiple lines, even." ))
115
115
})
@@ -120,15 +120,15 @@ func TestNewlyAddedFilesAreCountedAsChanges(t *testing.T) {
120
120
git .CreateFileWithContents ("h" , "Hello" )
121
121
git .CreateFileWithContents ("foo/bar/w" , ", World!" )
122
122
git .AddAndcommit ("*" , "added hello world" )
123
- assert .Len (t , RepoLocatedAt (git .GetRoot ()).additionsInLastCommit (), 2 )
123
+ assert .Len (t , RepoLocatedAt (git .Root ()).additionsInLastCommit (), 2 )
124
124
})
125
125
}
126
126
127
127
func TestOutgoingContentOfNewlyAddedFilesIsAvailableInChanges (t * testing.T ) {
128
128
doInRepoWithCommit (func (git * git_testing.GitTesting ) {
129
129
git .CreateFileWithContents ("foo/bar/w" , "new contents" )
130
130
git .AddAndcommit ("*" , "added new files" )
131
- repo := RepoLocatedAt (git .GetRoot ())
131
+ repo := RepoLocatedAt (git .Root ())
132
132
assert .Len (t , repo .additionsInLastCommit (), 1 )
133
133
assert .True (t , strings .HasSuffix (string (repo .AdditionsWithinRange ("HEAD~1" , "HEAD" )[0 ].Data ), "new contents" ))
134
134
})
@@ -138,7 +138,7 @@ func TestOutgoingContentOfModifiedFilesIsAvailableInChanges(t *testing.T) {
138
138
doInRepoWithCommit (func (git * git_testing.GitTesting ) {
139
139
git .AppendFileContent ("a.txt" , "New content.\n " , "Spanning multiple lines, even." )
140
140
git .AddAndcommit ("a.txt" , "added to lorem-ipsum content with my own stuff!" )
141
- repo := RepoLocatedAt (git .GetRoot ())
141
+ repo := RepoLocatedAt (git .Root ())
142
142
assert .Len (t , repo .additionsInLastCommit (), 1 )
143
143
assert .True (t , strings .HasSuffix (string (repo .additionsInLastCommit ()[0 ].Data ), "New content.\n Spanning multiple lines, even." ))
144
144
})
@@ -152,7 +152,7 @@ func TestMultipleOutgoingChangesToTheSameFileAreAvailableInAdditions(t *testing.
152
152
git .AppendFileContent ("a.txt" , "More new content.\n " )
153
153
git .AddAndcommit ("a.txt" , "added some more new content" )
154
154
155
- repo := RepoLocatedAt (git .GetRoot ())
155
+ repo := RepoLocatedAt (git .Root ())
156
156
assert .Len (t , repo .additionsInLastCommit (), 1 )
157
157
assert .True (t , strings .HasSuffix (string (repo .AdditionsWithinRange ("HEAD~2" , "HEAD" )[0 ].Data ), "New content.\n More new content.\n " ))
158
158
})
@@ -162,14 +162,14 @@ func TestContentOfDeletedFilesIsNotAvailableInChanges(t *testing.T) {
162
162
doInRepoWithCommit (func (git * git_testing.GitTesting ) {
163
163
git .RemoveFile ("a.txt" )
164
164
git .AddAndcommit ("a.txt" , "Deleted this file. After all, it only had lorem-ipsum content." )
165
- assert .Equal (t , 0 , len (RepoLocatedAt (git .GetRoot ()).additionsInLastCommit ()),
165
+ assert .Equal (t , 0 , len (RepoLocatedAt (git .Root ()).additionsInLastCommit ()),
166
166
"There should be no additions because there is only an outgoing deletion" )
167
167
})
168
168
}
169
169
170
170
func TestDiffContainingBinaryFileChangesDoesNotBlowUp (t * testing.T ) {
171
171
doInRepoWithCommit (func (git * git_testing.GitTesting ) {
172
- repo := RepoLocatedAt (git .GetRoot ())
172
+ repo := RepoLocatedAt (git .Root ())
173
173
exec .Command ("cp" , "./pixel.jpg" , repo .root ).Run ()
174
174
git .AddAndcommit ("pixel.jpg" , "Testing binary diff." )
175
175
assert .Len (t , repo .additionsInLastCommit (), 1 )
@@ -185,7 +185,7 @@ func TestStagedAdditionsIncludeStagedFiles(t *testing.T) {
185
185
git .AppendFileContent ("a.txt" , "More new content\n " )
186
186
git .AppendFileContent ("alice/bob/b.txt" , "New content to b\n " )
187
187
188
- stagedAdditions := RepoLocatedAt (git .GetRoot ()).StagedAdditions ()
188
+ stagedAdditions := RepoLocatedAt (git .Root ()).StagedAdditions ()
189
189
assert .Len (t , stagedAdditions , 1 )
190
190
assert .Equal (t , "a.txt" , string (stagedAdditions [0 ].Name ))
191
191
assert .Equal (t , "New content.\n " , string (stagedAdditions [0 ].Data ))
@@ -197,7 +197,7 @@ func TestStagedAdditionsIncludeStagedNewFiles(t *testing.T) {
197
197
git .CreateFileWithContents ("new.txt" , "New content.\n " )
198
198
git .Add ("new.txt" )
199
199
200
- stagedAdditions := RepoLocatedAt (git .GetRoot ()).StagedAdditions ()
200
+ stagedAdditions := RepoLocatedAt (git .Root ()).StagedAdditions ()
201
201
assert .Len (t , stagedAdditions , 1 )
202
202
assert .Equal (t , "new.txt" , string (stagedAdditions [0 ].Name ))
203
203
assert .Equal (t , "New content.\n " , string (stagedAdditions [0 ].Data ))
@@ -209,7 +209,7 @@ func TestStagedAdditionsShouldNotIncludeDeletedFiles(t *testing.T) {
209
209
git .RemoveFile ("a.txt" )
210
210
git .Add ("." )
211
211
212
- stagedAdditions := RepoLocatedAt (git .GetRoot ()).StagedAdditions ()
212
+ stagedAdditions := RepoLocatedAt (git .Root ()).StagedAdditions ()
213
213
assert .Len (t , stagedAdditions , 0 )
214
214
})
215
215
}
0 commit comments