Skip to content

Commit 831722b

Browse files
committed
Use trees in test instead of commits
1 parent 05bd5d4 commit 831722b

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

ObjectiveGitTests/GTRepositorySpec.m

+5-7
Original file line numberDiff line numberDiff line change
@@ -277,8 +277,8 @@
277277
GTReference *head = [repository headReferenceWithError:NULL];
278278
GTCommit *parent = [repository lookUpObjectByOID:head.targetOID objectType:GTObjectTypeCommit error:NULL];
279279
expect(parent).toNot(beNil());
280-
GTCommit *masterCommit = [repository createCommitWithTree:[index writeTree:NULL] message:@"MOLTAE is 41" parents:[NSArray arrayWithObject:parent] updatingReferenceNamed:head.name error:NULL];
281-
expect(masterCommit).toNot(beNil());
280+
GTTree *masterTree = [index writeTree:NULL];
281+
expect(masterTree).toNot(beNil());
282282

283283
GTBranch *otherBranch = [repository lookUpBranchWithName:@"other-branch" type:GTBranchTypeLocal success:NULL error:NULL];
284284
expect(otherBranch).toNot(beNil());
@@ -288,12 +288,10 @@
288288

289289
index = [repository indexWithError:NULL];
290290
expect(@([index addFile:mainURL.lastPathComponent error:NULL])).to(beTruthy());
291-
parent = [repository lookUpObjectByOID:otherBranch.OID objectType:GTObjectTypeCommit error:NULL];
292-
expect(parent).toNot(beNil());
293-
GTCommit *otherCommit = [repository createCommitWithTree:[index writeTree:NULL] message:@"MOLTAE is 42!" parents:[NSArray arrayWithObject:parent] updatingReferenceNamed:otherBranch.name error:NULL];
294-
expect(otherCommit).toNot(beNil());
291+
GTTree *otherTree = [index writeTree:NULL];
292+
expect(otherTree).toNot(beNil());
295293

296-
GTIndex *conflictIndex = [otherCommit merge:masterCommit error:NULL];
294+
GTIndex *conflictIndex = [otherTree merge:masterTree ancestor:parent.tree error:NULL];
297295
expect(@([conflictIndex hasConflicts])).to(beTruthy());
298296

299297
[conflictIndex enumerateConflictedFilesWithError:NULL usingBlock:^(GTIndexEntry * _Nonnull ancestor, GTIndexEntry * _Nonnull ours, GTIndexEntry * _Nonnull theirs, BOOL * _Nonnull stop) {

0 commit comments

Comments
 (0)