The Growing Pristine Problem

If you look at the description of a darcs repository, you will see that each repository contains a pristine.hashed directory. This directory contains files of the working copy, along with, possibly, old versions of them. With this directory, getting a remote repository can be done in a lazy way: first, darcs gets the pristine files in order to build the working copy, and the it gets the patches. Also, local operations, like whatsnew, are made by comparing the working tree with the pristing tree.

One issue that arises is that each time one does a record, push or apply, old pristine files stay around in the repository. It is only when using optimize that you can make them go away. In some big repositories this can be a problem. However, there is a reason why we do not systematically clean these olf pristine files.

Growing Pristine and Avoid Race Conditions are related topics

This reason is race conditisons. That is, what happens when:

  1. someone starts getting your repository, and suddenly
  2. you record a new patch and removed the obsolete pristine files?

The get operation may fail when trying to fetch some now deleted pristine files.

The thing is, you can not have at the same time a Darcs program that guarantees you to not have any record-get race condition and cleans the pristine after each record. (In fact we used to go by the second option, but we considered it as a problem and fixed it http://bugs.darcs.net/issue687 ).

If you really want that pristine cleanup to happen at each record, for instance in local repositories you know nobody else than you accesses, you can put darcs optimize as a posthook for apply. Add the following two lines in the file _darcs/prefs/defaults of your repository:

record posthook darcs optimize
record run-posthook

The same can be done for repositories you want to push in, by replacing “record” by “apply” in the lines above.

However, know that the optimize-get race can still happen with current Darcs. Note also that check and repair have (almost) the same effect than optimize, so check-get and repair-get races can happen too.

Related issue : http://bugs.darcs.net/issue1976 “darcs get could handle missing pristine files more graciously”

See also GrowingInventoriesProblem .