@@ -29,7 +29,7 @@ class GitUtilTest {
29
29
void status_clean () throws GitAPIException {
30
30
31
31
// given
32
- Git git = Git .init ().setDirectory (tempDir .toFile ()).call ();
32
+ Git git = Git .init ().setInitialBranch ( MASTER ). setDirectory (tempDir .toFile ()).call ();
33
33
34
34
// when
35
35
Status status = GitUtil .status (git .getRepository ());
@@ -42,7 +42,7 @@ void status_clean() throws GitAPIException {
42
42
void status_dirty () throws GitAPIException , IOException {
43
43
44
44
// given
45
- Git git = Git .init ().setDirectory (tempDir .toFile ()).call ();
45
+ Git git = Git .init ().setInitialBranch ( MASTER ). setDirectory (tempDir .toFile ()).call ();
46
46
47
47
boolean dummyFileCreated = new File (tempDir .toFile (), "README.md" ).createNewFile ();
48
48
assertThat (dummyFileCreated ).isTrue ();
@@ -58,7 +58,7 @@ void status_dirty() throws GitAPIException, IOException {
58
58
void branch_emptyRepo () throws GitAPIException , IOException {
59
59
60
60
// given
61
- Git git = Git .init ().setDirectory (tempDir .toFile ()).call ();
61
+ Git git = Git .init ().setInitialBranch ( MASTER ). setDirectory (tempDir .toFile ()).call ();
62
62
63
63
// when
64
64
String branch = GitUtil .branch (git .getRepository ());
@@ -71,7 +71,7 @@ void branch_emptyRepo() throws GitAPIException, IOException {
71
71
void branch_nonEmptyRepo () throws GitAPIException , IOException {
72
72
73
73
// given
74
- Git git = Git .init ().setDirectory (tempDir .toFile ()).call ();
74
+ Git git = Git .init ().setInitialBranch ( MASTER ). setDirectory (tempDir .toFile ()).call ();
75
75
RevCommit givenCommit = git .commit ().setMessage ("initial commit" ).setAllowEmpty (true ).call ();
76
76
String givenBranchName = "feature" ;
77
77
git .branchCreate ().setName (givenBranchName ).setStartPoint (givenCommit ).call ();
@@ -88,7 +88,7 @@ void branch_nonEmptyRepo() throws GitAPIException, IOException {
88
88
void tag_pointsAt_emptyRepo () throws GitAPIException , IOException {
89
89
90
90
// given
91
- Git git = Git .init ().setDirectory (tempDir .toFile ()).call ();
91
+ Git git = Git .init ().setInitialBranch ( MASTER ). setDirectory (tempDir .toFile ()).call ();
92
92
93
93
// when
94
94
List <String > tags = GitUtil .tag_pointsAt (git .getRepository (), HEAD );
@@ -101,7 +101,7 @@ void tag_pointsAt_emptyRepo() throws GitAPIException, IOException {
101
101
void tag_pointsAt_noTags () throws GitAPIException , IOException {
102
102
103
103
// given
104
- Git git = Git .init ().setDirectory (tempDir .toFile ()).call ();
104
+ Git git = Git .init ().setInitialBranch ( MASTER ). setDirectory (tempDir .toFile ()).call ();
105
105
106
106
git .commit ().setMessage ("initial commit" ).setAllowEmpty (true ).call ();
107
107
@@ -116,7 +116,7 @@ void tag_pointsAt_noTags() throws GitAPIException, IOException {
116
116
void tag_pointsAt_oneTag () throws GitAPIException , IOException {
117
117
118
118
// given
119
- Git git = Git .init ().setDirectory (tempDir .toFile ()).call ();
119
+ Git git = Git .init ().setInitialBranch ( MASTER ). setDirectory (tempDir .toFile ()).call ();
120
120
121
121
RevCommit givenCommit = git .commit ().setMessage ("initial commit" ).setAllowEmpty (true ).call ();
122
122
String givenTagName = "v1.0.0" ;
@@ -133,7 +133,7 @@ void tag_pointsAt_oneTag() throws GitAPIException, IOException {
133
133
void tag_pointsAt_multipleTags () throws GitAPIException , IOException {
134
134
135
135
// given
136
- Git git = Git .init ().setDirectory (tempDir .toFile ()).call ();
136
+ Git git = Git .init ().setInitialBranch ( MASTER ). setDirectory (tempDir .toFile ()).call ();
137
137
138
138
RevCommit givenCommit = git .commit ().setMessage ("initial commit" ).setAllowEmpty (true ).call ();
139
139
String givenTagName1 = "111" ;
@@ -154,7 +154,7 @@ void tag_pointsAt_multipleTags() throws GitAPIException, IOException {
154
154
void tag_pointsAt_lightweightTag () throws GitAPIException , IOException {
155
155
156
156
// given
157
- Git git = Git .init ().setDirectory (tempDir .toFile ()).call ();
157
+ Git git = Git .init ().setInitialBranch ( MASTER ). setDirectory (tempDir .toFile ()).call ();
158
158
159
159
RevCommit givenCommit = git .commit ().setMessage ("initial commit" ).setAllowEmpty (true ).call ();
160
160
@@ -172,7 +172,7 @@ void tag_pointsAt_lightweightTag() throws GitAPIException, IOException {
172
172
void revParse_emptyRepo () throws GitAPIException , IOException {
173
173
174
174
// given
175
- Git git = Git .init ().setDirectory (tempDir .toFile ()).call ();
175
+ Git git = Git .init ().setInitialBranch ( MASTER ). setDirectory (tempDir .toFile ()).call ();
176
176
177
177
// when
178
178
String ref = GitUtil .revParse (git .getRepository (), HEAD );
@@ -185,7 +185,7 @@ void revParse_emptyRepo() throws GitAPIException, IOException {
185
185
void revParse_nonEmptyRepo () throws GitAPIException , IOException {
186
186
187
187
// given
188
- Git git = Git .init ().setDirectory (tempDir .toFile ()).call ();
188
+ Git git = Git .init ().setInitialBranch ( MASTER ). setDirectory (tempDir .toFile ()).call ();
189
189
190
190
RevCommit givenCommit = git .commit ().setMessage ("initial commit" ).setAllowEmpty (true ).call ();
191
191
@@ -200,7 +200,7 @@ void revParse_nonEmptyRepo() throws GitAPIException, IOException {
200
200
void headSituation_emptyRepo () throws GitAPIException , IOException {
201
201
202
202
// Given
203
- Git git = Git .init ().setDirectory (tempDir .toFile ()).call ();
203
+ Git git = Git .init ().setInitialBranch ( MASTER ). setDirectory (tempDir .toFile ()).call ();
204
204
205
205
// When
206
206
GitSituation gitSituation = GitUtil .situation (git .getRepository ().getDirectory ());
@@ -218,7 +218,7 @@ void headSituation_emptyRepo() throws GitAPIException, IOException {
218
218
void headSituation_onBranch () throws GitAPIException , IOException {
219
219
220
220
// Given
221
- Git git = Git .init ().setDirectory (tempDir .toFile ()).call ();
221
+ Git git = Git .init ().setInitialBranch ( MASTER ). setDirectory (tempDir .toFile ()).call ();
222
222
RevCommit givenCommit = git .commit ().setMessage ("init" ).setAllowEmpty (true ).call ();
223
223
224
224
// When
@@ -237,7 +237,7 @@ void headSituation_onBranch() throws GitAPIException, IOException {
237
237
void headSituation_onBranchWithTag () throws GitAPIException , IOException {
238
238
239
239
// Given
240
- Git git = Git .init ().setDirectory (tempDir .toFile ()).call ();
240
+ Git git = Git .init ().setInitialBranch ( MASTER ). setDirectory (tempDir .toFile ()).call ();
241
241
RevCommit givenCommit = git .commit ().setMessage ("init" ).setAllowEmpty (true ).call ();
242
242
String givenTag = "v1" ;
243
243
git .tag ().setName (givenTag ).setObjectId (givenCommit ).call ();
@@ -258,7 +258,7 @@ void headSituation_onBranchWithTag() throws GitAPIException, IOException {
258
258
void headSituation_detachedHead () throws GitAPIException , IOException {
259
259
260
260
// Given
261
- Git git = Git .init ().setDirectory (tempDir .toFile ()).call ();
261
+ Git git = Git .init ().setInitialBranch ( MASTER ). setDirectory (tempDir .toFile ()).call ();
262
262
RevCommit givenCommit = git .commit ().setMessage ("init" ).setAllowEmpty (true ).call ();
263
263
git .checkout ().setName (givenCommit .getName ()).call ();
264
264
@@ -278,7 +278,7 @@ void headSituation_detachedHead() throws GitAPIException, IOException {
278
278
void headSituation_detachedHeadWithTag () throws GitAPIException , IOException {
279
279
280
280
// Given
281
- Git git = Git .init ().setDirectory (tempDir .toFile ()).call ();
281
+ Git git = Git .init ().setInitialBranch ( MASTER ). setDirectory (tempDir .toFile ()).call ();
282
282
RevCommit givenCommit = git .commit ().setMessage ("init" ).setAllowEmpty (true ).call ();
283
283
String givenTag = "v1" ;
284
284
git .tag ().setName (givenTag ).setObjectId (givenCommit ).call ();
@@ -300,7 +300,7 @@ void headSituation_detachedHeadWithTag() throws GitAPIException, IOException {
300
300
void situation_annotatedTagOnMaster () throws Exception , IOException {
301
301
302
302
// Given
303
- Git git = Git .init ().setDirectory (tempDir .toFile ()).call ();
303
+ Git git = Git .init ().setInitialBranch ( MASTER ). setDirectory (tempDir .toFile ()).call ();
304
304
RevCommit givenCommit = git .commit ().setMessage ("initial commit" ).setAllowEmpty (true ).call ();
305
305
306
306
String givenTag = "v1" ;
@@ -322,7 +322,7 @@ void situation_annotatedTagOnMaster() throws Exception, IOException {
322
322
void situation_annotatedTagDetached () throws Exception {
323
323
324
324
// Given
325
- Git git = Git .init ().setDirectory (tempDir .toFile ()).call ();
325
+ Git git = Git .init ().setInitialBranch ( MASTER ). setDirectory (tempDir .toFile ()).call ();
326
326
RevCommit givenCommit = git .commit ().setMessage ("initial commit" ).setAllowEmpty (true ).call ();
327
327
328
328
String givenTag = "v1" ;
@@ -345,7 +345,7 @@ void situation_annotatedTagDetached() throws Exception {
345
345
void situation_lightweightTagOnMaster () throws Exception {
346
346
347
347
// Given
348
- Git git = Git .init ().setDirectory (tempDir .toFile ()).call ();
348
+ Git git = Git .init ().setInitialBranch ( MASTER ). setDirectory (tempDir .toFile ()).call ();
349
349
RevCommit givenCommit = git .commit ().setMessage ("initial commit" ).setAllowEmpty (true ).call ();
350
350
351
351
String givenTag = "v1" ;
@@ -367,7 +367,7 @@ void situation_lightweightTagOnMaster() throws Exception {
367
367
void situation_lightweightTagDetached () throws Exception {
368
368
369
369
// Given
370
- Git git = Git .init ().setDirectory (tempDir .toFile ()).call ();
370
+ Git git = Git .init ().setInitialBranch ( MASTER ). setDirectory (tempDir .toFile ()).call ();
371
371
RevCommit givenCommit = git .commit ().setMessage ("initial commit" ).setAllowEmpty (true ).call ();
372
372
373
373
String givenTag = "v1" ;
@@ -390,7 +390,7 @@ void situation_lightweightTagDetached() throws Exception {
390
390
void situation_multipleTags () throws Exception {
391
391
392
392
// Given
393
- Git git = Git .init ().setDirectory (tempDir .toFile ()).call ();
393
+ Git git = Git .init ().setInitialBranch ( MASTER ). setDirectory (tempDir .toFile ()).call ();
394
394
git .commit ().setMessage ("initial commit" ).setAllowEmpty (true ).call ();
395
395
396
396
String givenTag1 = "v2" ;
0 commit comments