1.3 Terms and Acronyms

Book can be downloaded from here

Now that we have seen what conflicts look like (with the common ancestor), I want to introduce a few terms about the sections of a conflict that will get rid of some possible ambiguities moving forward.

1.3.1 About the sections of a conflict

Conflict Block or CB

A Conflict Block starts with the Conflict Start Marker and ends with the Conflict Closing Marker.

Upper Block or UB

The top section of a CB. This section will always hold content as it is in HEAD.

Middle Block or MB

The middle section of a CB. This section will show up if you are using diff3 and, during a merge operation, it will hold content from what we commonly refer to as the common ancestor.

Lower Block or LB

The bottom section of a CB. This section will hold content of what we refer to as the other branch during a merge operation.

1.3.2 Terms applied on a conflict from Example 3

From Example 3:

Listing 1.50:Conflict from example 3
671        struct bitmap *objects = bitmap_git->result; 
672 
673<<<<<<< HEAD 
674        ewah_iterator_init(&it, type_filter); 
675||||||| d0654dc308 
676        if (bitmap_git->reuse_objects == bitmap_git->pack->num_objects) 
677                return; 
678 
679        ewah_iterator_init(&it, type_filter); 
680======= 
681        if (bitmap_git->reuse_objects == bitmap_git->pack->num_objects) 
682                return; 
683 
684        init_type_iterator(&it, bitmap_git, object_type); 
685>>>>>>> 20a5fd881a 
686 
687        for (i = 0; i < objects->word_alloc &&

CB

Listing 1.51:CB from example 3
673<<<<<<< HEAD 
674        ewah_iterator_init(&it, type_filter); 
675||||||| d0654dc308 
676        if (bitmap_git->reuse_objects == bitmap_git->pack->num_objects) 
677                return; 
678 
679        ewah_iterator_init(&it, type_filter); 
680======= 
681        if (bitmap_git->reuse_objects == bitmap_git->pack->num_objects) 
682                return; 
683 
684        init_type_iterator(&it, bitmap_git, object_type); 
685>>>>>>> 20a5fd881a

UB

Listing 1.52:UB from example 3
674        ewah_iterator_init(&it, type_filter);

MB

Listing 1.53:One MB from example 3
676        if (bitmap_git->reuse_objects == bitmap_git->pack->num_objects) 
677                return; 
678 
679        ewah_iterator_init(&it, type_filter);

LB

Listing 1.54:LB from example 3
681        if (bitmap_git->reuse_objects == bitmap_git->pack->num_objects) 
682                return; 
683 
684        init_type_iterator(&it, bitmap_git, object_type);

1.3.3 Terms applied on one conflict from Exercise 3

Conflict from path.c of Exercise 3:

Listing 1.55:Conflict on path.c from Exercise 3
852        if (is_git_directory(".")) { 
853<<<<<<< HEAD 
854                set_git_dir(".", 0); 
855                check_repository_format(); 
856||||||| 51ebf55b93 
857                set_git_dir("."); 
858                check_repository_format(); 
859======= 
860                set_git_dir("."); 
861                check_repository_format(NULL); 
862>>>>>>> 1bdca81641 
863                return path; 
864        }

CB

Listing 1.56:CB from Exercise 3
853<<<<<<< HEAD 
854                set_git_dir(".", 0); 
855                check_repository_format(); 
856||||||| 51ebf55b93 
857                set_git_dir("."); 
858                check_repository_format(); 
859======= 
860                set_git_dir("."); 
861                check_repository_format(NULL); 
862>>>>>>> 1bdca81641

UB

Listing 1.57:UB from Exercise 3
854                set_git_dir(".", 0); 
855                check_repository_format();

MB

Listing 1.58:MB from Exercise 3
857                set_git_dir("."); 
858                check_repository_format();

LB

Listing 1.59:LB from Exercise 3
860                set_git_dir("."); 
861                check_repository_format(NULL);

1.3.4 About the differences between them

dMU

The theoretical changes that were applied on MB to turn it into UB, not considering middle stages/revisions between the revisions that are being considered.

dML

The changes that were applied on MB to turn it into LB, again, not considering middle stages/revisions between the revisions that are being considered.

1.3.5 Terms applied on CB from Example 3

dMU

Starting from MB

Listing 1.60:One MB from example 3
676        if (bitmap_git->reuse_objects == bitmap_git->pack->num_objects) 
677                return; 
678 
679        ewah_iterator_init(&it, type_filter);

Ending up in UB:

Listing 1.61:UB from example 3
674        ewah_iterator_init(&it, type_filter);

dMU would be to remove the conditional that started on line 676.

dML

Starting from MB

Listing 1.62:One MB from example 3
676        if (bitmap_git->reuse_objects == bitmap_git->pack->num_objects) 
677                return; 
678 
679        ewah_iterator_init(&it, type_filter);

Ending up in LB

Listing 1.63:LB from example 3
681        if (bitmap_git->reuse_objects == bitmap_git->pack->num_objects) 
682                return; 
683 
684        init_type_iterator(&it, bitmap_git, object_type);

dML would be to change the call to ewah_iterator_init() on line 679 for a call to init_type_iterator() on line 684.

1.3.6 Terms applied on CB from Exercise 3

dMU

Starting from MB

Listing 1.64:MB from Exercise 3
857                set_git_dir("."); 
858                check_repository_format();

Ending up in UB

Listing 1.65:UB from Exercise 3
854                set_git_dir(".", 0); 
855                check_repository_format();

dMU would be to add a second parameter to the set_git_dir() call. The second parameter is a 0.

dML

Starting from MB

Listing 1.66:MB from Exercise 3
857                set_git_dir("."); 
858                check_repository_format();

Ending up in LB

Listing 1.67:LB from Exercise 3
860                set_git_dir("."); 
861                check_repository_format(NULL);

dML would be to add NULL as a parameter to the check_repository_format() call.

Copyright 2020 Edmundo Carmona Antoranz