Primary and Secondary Shares

The example below should help understand the difference between primary and secondary shares:

Assume we start out with the following, one shared file (a.txt) with three links.

$/bar/foo/

$/bar/foo/a.txt (Shared)

$/bar/foo/b.txt

$/a.txt (Shared)

$/proj/a.txt (Shared)

$/xyz

Now, we apply a folder share at $/bar/foo with $/xyz:

$/bar/foo/ (Shared)

$/bar/foo/a.txt (Shared)

$/bar/foo/b.txt

$/a.txt (Shared)

$/proj/a.txt (Shared)

$/xyz/foo/ (Shared)

$/xyz/foo/a.txt (Shared)

$/xyz/foo/b.txt

Now $/bar/foo is shared with $/xyz/foo, so all files within it a secondarily shared. In addition, since a.txt already had a primary share, it inherits the primary share and has a primary share the other a.txt files as well.

Now if we add c.txt and delete b.txt from $/bar/foo, $/xyz/foo gets updated with those changes as well:

$/bar/foo/ (Shared)

$/bar/foo/a.txt (Shared)

$/bar/foo/b.txt (deleted)

$/bar/foo/c.txt

$/a.txt (Shared)

$/proj/a.txt (Shared)

$/xyz/foo/ (Shared)

$/xyz/foo/a.txt (Shared)

$/xyz/foo/b.txt (deleted)

$/xyz/foo/c.txt

Next, if we pin a.txt, and c.txt in $/bar/foo, then a.txt and c.txt both get pinned in $/xyz/foo as well at the same version. Note that $/a.txt and $/proj/a.txt do not get pinned too, because a pin operation only applies to a single primary link. However, they apply to all links in a secondary share.

$/bar/foo/ (Shared)

$/bar/foo/a.txt (Shared and pinned)

$/bar/foo/b.txt (deleted)

$/bar/foo/c.txt (pinned)

$/a.txt (Shared)

$/proj/a.txt (Shared)

$/xyz/foo/ (Shared)

$/xyz/foo/a.txt (Shared and pinned)

$/xyz/foo/b.txt (deleted)

$/xyz/foo/c.txt (pinned)

Likewise, if we unpin and branch a.txt in one of the shared folders, both of them get branched from the other a.txt links.

$/bar/foo/ (Shared)

$/bar/foo/a.txt

$/bar/foo/b.txt (deleted)

$/bar/foo/c.txt (pinned)

$/a.txt (Shared)

$/proj/a.txt (Shared)

$/xyz/foo/ (Shared)

$/xyz/foo/a.txt

$/xyz/foo/b.txt (deleted)

$/xyz/foo/c.txt (pinned)

Note that even though $/bar/foo/a.txt and $/xyz/foo/a.txt have their primary shares broken, they are still have secondary shares, so any change made to one is made to the other. They are just not shared with the other a.txt files any longer.

Finally, suppose we re-share $/bar/foo/a.txt with $/a.txt and then branch $/bar/foo from $/xyz/foo. This results in:

$/bar/foo/

$/bar/foo/a.txt (Shared)

$/bar/foo/b.txt (deleted)

$/bar/foo/c.txt (pinned)

$/a.txt (Shared)

$/proj/a.txt (Shared)

$/xyz/foo/

$/xyz/foo/a.txt (Shared)

$/xyz/foo/b.txt (deleted)

$/xyz/foo/c.txt (pinned)

$/bar/foo and $/xyz/foo are no longer shared and changes made to one do not get reflected in the other. However, the a.txt files in each are still shared with each other, because they had a primary share prior to the folder branch.