CM wiki web
(Base) ClearCase FAQ: 1.4.1 Why do people put /main/0 at the end of a config spec?
This is a good interview question... A typical development config spec looks like this:
element * CHECKEDOUT
element * .../mybranch/LATEST
element * BASELINE -mkbranch mybranch
element * /main/0 -mkbranch mybranch
or like this:
element * CHECKEDOUT
element * .../mybranch/LATEST
element * .../deliverybranch/LATEST -time sometime -mkbranch mybranch
element * /main/0 -mkbranch mybranch
They all contain the /main/0 rule at end because otherwise, you couldn't create new elements.
When you create a new element, it will only have a /main/0 version.
It wouldn't have a mybranch branch, nor a BASELINE label (in the first config spec) and wouldn't have a deliverybranch either.
Therefore, right after the element was borne, it would disappear from your view since no valid version is selected and the -mkbranch operation couldn't take place.
Adding the /main/0 rule ensures that you can always see a newly created element.
/main/0, how come I can't see somebody else's new element?".
This is a consequence of directory versioning.
In fact, two conditions must be satisfied if you are to see a specific element in your view: - Your config spec must select a valid version
- Your config spec must select a version of the containing directory that has a link to that element.
/main/LATEST instead of /main/0?
Using /main/LATEST may hide labeling errors.
Suppose, for example, that there are elements that are missing the BASELINE label for some reason, and you are using a config spec like the first one above.
If you use /main/0, you will get empty files and empty directories for such elements, which have a good chance of at least causing some visible warning or error at build time.
If you use /main/LATEST, you may end up using the wrong version and not notice it.
There is yet another case where /main/0 is required, and is only indirectly related to creating new elements: intentionally empty directories or files.
When one creates an empty directory or file and later merges it onto a new branch, the findmerge algorithm will notice that the base contributor (/main/0) and the target contributor (also /main/0) are identical, and since the source contributor is empty it will skip the copy merge, leaving you with nothing.
Therefore, you need to select /main/0 even in a config spec where no new elements are created, such as:
element * .../deliverybranch/LATEST -nocheckout
element * /main/0 -nocheckout
Oh, and how come Rational's documentation uses /main/LATEST all over the place?
My guess it that it's a holdover from old documents, where more complex config specs were derived from the default config spec.
It is a non-obvious step to replace /main/LATEST with /main/0, and even to this day, many people think that there is some kind of obligation to merge back into main...
[Extracted verbatim from the FAQ, only converting to the wiki syntax. My understanding is thus that the original author is thus Christian Goetze].
-- MarcGirod - 30 Sep 2007
