This page covers a known problem with Darcs1 patch types (used in old-fashioned and hashed repositories). It does not affect Darcs2 patch types. If running darcs show repo in your repository displays the line Format: hashed, darcs-2, this will not happen.

See DarcsTwo for information about upgrading.

What are Conflicts?

See FAQ/ConflictsDarcs1 for information about conflicts and how they can be resolved.

What are Hidden Conflicts?

If a conflict involves a third patch that reverses the effect of one of the conflicting patches, darcs considers conflict resolved and does not apply any of the conflicting patches.

See a small example that we use in our testsuite:

rm -rf temp1 temp2
mkdir temp1
cd temp1
darcs init --hashed
echo first > a
darcs add a
darcs record -am first
Finished recording patch 'first'
cd ..
darcs get temp1 temp2
Copying patches, to get lazy repository hit ctrl-C...
Finished getting.

cd temp1
echo second > a
darcs record -am 'first to second'
Finished recording patch 'first to second'
echo first > a
darcs record -am 'second back to first'
Finished recording patch 'second back to first'
cd ..

cd temp2
echo third > a
darcs record -am 'first to third'
Finished recording patch 'first to third'
cd ..

cd temp1
darcs pull -a ../temp2

At the last step, darcs does not say there is a conflict, while it there should be one. Worse, the file “a” in the working copy still contains “first” and not “third”. It has no conflict marker, the patch “first to third” is present in the history (darcs changes) but has no effect on the working copy.

Why Hidden Conflicts Matter?

The hidden conflicts lead to data loss.

The problem is most acute with the darcs rollback command as rollback is designed to create the inverse patches. However, it is not limited to rollback. As explained above, the inverses can be created by accident or worse yet, maliciously.

How to Avoid Hidden Conflicts?

Be careful when trying to resolve conflict by rolling any conflicting patches back while all the conflicting patches are not present in the repository. That is sure way to create hidden conflicts. However, note that rolling back conflicting patches trigger other, more immediate bugs in darcs.

How to Detect Hidden Conflicts?

Explain how to find out that you repository has hidden conflicts

Unpull patches until the topmost patch contains merger but darcs resolve does not report conflict.

The conflict is not hidden if the topmost patch is a rollback (UNDO) and it contains the rollback of the conflict (aka. regrem) and depend on all the conflicting patches.

How to Recover From Hidden Conflict?

Explain how to reliably recover from hidden conflict and prevent their propagation.