Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit bf50a68

Browse files
committed
fixup! Failing test for case sensitive conflicts in the index
1 parent 5456de9 commit bf50a68

File tree

1 file changed

+17
-11
lines changed

1 file changed

+17
-11
lines changed

tests/index/conflicts.c

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ void test_index_conflicts__partial(void)
345345

346346
void test_index_conflicts__case_matters(void)
347347
{
348-
git_index_entry *conflict_entry[3];
348+
const git_index_entry *conflict_entry[3];
349349
git_oid oid;
350350
char *upper_case = "DIFFERS-IN-CASE.TXT";
351351
char *mixed_case = "Differs-In-Case.txt";
@@ -357,31 +357,37 @@ void test_index_conflicts__case_matters(void)
357357
memset(&their_entry, 0x0, sizeof(git_index_entry));
358358

359359
ancestor_entry.path = upper_case;
360-
ancestor_entry.flags |= (1 << GIT_IDXENTRY_STAGESHIFT);
360+
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, GIT_INDEX_STAGE_ANCESTOR);
361361
git_oid_fromstr(&ancestor_entry.id, CONFLICTS_ONE_ANCESTOR_OID);
362+
ancestor_entry.mode = GIT_FILEMODE_BLOB;
362363

363364
our_entry.path = upper_case;
364-
ancestor_entry.flags |= (2 << GIT_IDXENTRY_STAGESHIFT);
365+
GIT_IDXENTRY_STAGE_SET(&our_entry, GIT_INDEX_STAGE_OURS);
365366
git_oid_fromstr(&our_entry.id, CONFLICTS_ONE_OUR_OID);
367+
our_entry.mode = GIT_FILEMODE_BLOB;
366368

367369
their_entry.path = upper_case;
368-
ancestor_entry.flags |= (3 << GIT_IDXENTRY_STAGESHIFT);
370+
GIT_IDXENTRY_STAGE_SET(&their_entry, GIT_INDEX_STAGE_THEIRS);
369371
git_oid_fromstr(&their_entry.id, CONFLICTS_ONE_THEIR_OID);
372+
their_entry.mode = GIT_FILEMODE_BLOB;
370373

371374
cl_git_pass(git_index_conflict_add(repo_index,
372375
&ancestor_entry, &our_entry, &their_entry));
373376

374377
ancestor_entry.path = mixed_case;
375-
ancestor_entry.flags |= (1 << GIT_IDXENTRY_STAGESHIFT);
378+
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, GIT_INDEX_STAGE_ANCESTOR);
376379
git_oid_fromstr(&ancestor_entry.id, CONFLICTS_TWO_ANCESTOR_OID);
380+
ancestor_entry.mode = GIT_FILEMODE_BLOB;
377381

378382
our_entry.path = mixed_case;
379-
ancestor_entry.flags |= (2 << GIT_IDXENTRY_STAGESHIFT);
383+
GIT_IDXENTRY_STAGE_SET(&ancestor_entry, GIT_INDEX_STAGE_ANCESTOR);
380384
git_oid_fromstr(&our_entry.id, CONFLICTS_TWO_OUR_OID);
385+
ancestor_entry.mode = GIT_FILEMODE_BLOB;
381386

382387
their_entry.path = mixed_case;
383-
ancestor_entry.flags |= (3 << GIT_IDXENTRY_STAGESHIFT);
388+
GIT_IDXENTRY_STAGE_SET(&their_entry, GIT_INDEX_STAGE_THEIRS);
384389
git_oid_fromstr(&their_entry.id, CONFLICTS_TWO_THEIR_OID);
390+
their_entry.mode = GIT_FILEMODE_BLOB;
385391

386392
cl_git_pass(git_index_conflict_add(repo_index,
387393
&ancestor_entry, &our_entry, &their_entry));
@@ -390,29 +396,29 @@ void test_index_conflicts__case_matters(void)
390396
&conflict_entry[2], repo_index, upper_case));
391397

392398
cl_assert_equal_s(upper_case, conflict_entry[0]->path);
393-
git_oid_fromstr(&oid, CONFLICTS_ONE_ANCESTOR_OID);
399+
git_oid_fromstr(&oid, CONFLICTS_ONE_ANCESTOR_OID);
394400
cl_assert_equal_oid(&oid, &conflict_entry[0]->id);
395401

396402
cl_assert_equal_s(upper_case, conflict_entry[1]->path);
397403
git_oid_fromstr(&oid, CONFLICTS_ONE_OUR_OID);
398404
cl_assert_equal_oid(&oid, &conflict_entry[1]->id);
399405

400-
cl_assert_equal_s(upper_case, conflict_entry[0]->path);
406+
cl_assert_equal_s(upper_case, conflict_entry[2]->path);
401407
git_oid_fromstr(&oid, CONFLICTS_ONE_THEIR_OID);
402408
cl_assert_equal_oid(&oid, &conflict_entry[2]->id);
403409

404410
cl_git_pass(git_index_conflict_get(&conflict_entry[0], &conflict_entry[1],
405411
&conflict_entry[2], repo_index, mixed_case));
406412

407413
cl_assert_equal_s(mixed_case, conflict_entry[0]->path);
408-
git_oid_fromstr(&oid, CONFLICTS_ONE_ANCESTOR_OID);
414+
git_oid_fromstr(&oid, CONFLICTS_TWO_ANCESTOR_OID);
409415
cl_assert_equal_oid(&oid, &conflict_entry[0]->id);
410416

411417
cl_assert_equal_s(mixed_case, conflict_entry[1]->path);
412418
git_oid_fromstr(&oid, CONFLICTS_TWO_OUR_OID);
413419
cl_assert_equal_oid(&oid, &conflict_entry[1]->id);
414420

415-
cl_assert_equal_s(mixed_case, conflict_entry[0]->path);
421+
cl_assert_equal_s(mixed_case, conflict_entry[2]->path);
416422
git_oid_fromstr(&oid, CONFLICTS_TWO_THEIR_OID);
417423
cl_assert_equal_oid(&oid, &conflict_entry[2]->id);
418424
}

0 commit comments

Comments
 (0)