Conflicts

An important part of working with others is disagreeing. On text files (such as source code), work can sometimes be split beforehand in such a way that disagreements on a single line in a file never occurs.

However, many teams don’t have everything planned in advance, and their members often edit each other’s code. This might result in conflicts.

In Pijul, there are two kinds of conflicts inside a file:

  • When two different authors add lines at the same position in a file, and it is impossible to tell which comes first in the file.

  • When one author adds a line in a block of text or code, while another author deletes that block.

Conflicts can also occur between files:

  • When authors give the same name to two different files.

  • Or when they rename the same file to two different names.

It is important to note that conflicts in Pijul always happen between changes, for example we might say that “change A conflicts with change B”. A conflict resolution is always a change. One option to fix a conflict between A and B is to run pijul unrecord A (respectively pijul unrecord B), which removes A (respectively B) from history.

One of the main features of Pijul is that its internal representation of repositories fully models conflicts. Patches can even be applied to a conflicting repository, leaving the conflict resolution for later.