Page MenuHomeSoftware Heritage

Document snapshot target types
Closed, MigratedEdits Locked

Description

softwareheritage=> select distinct target_type from snapshot_branch;
 target_type 
-------------
 
 content
 release
 revision
 alias
 directory

I can't find documentation as to when/why/how a target type is selected when loading an origin.

Event Timeline

I'm not sure I understand your question (or the purpose of this task). Can you elaborate?

As a general comment: triggering an origin load has nothing to do with the target type of a snapshot. Each branch of a snapshot can potentially point to different type of objects, but it depends on what is found at the origin. The loader for the origin check all available branches there (with a notion of "branch" that might very depending on the loader), will check to what it points, and will set the target and target type of that branch in the snapshot accordingly.

Is this enough to clarify your doubt? (If so, feel free to close this task.)

Sorry, I meant loading a snapshot.

I was wondering mainly in what cases a snapshot may point to a directory or a content.

I still think my answer applies, no?

A snapshot will point to a directory when you find a branch pointing to a directory.

Where do you want this to be documented?

In T1252#23306, @zack wrote:

I still think my answer applies, no?

A snapshot will point to a directory when you find a branch pointing to a directory.

That's what I don't understand: when do branch point to directories? Even with file deposits, SWH has a revision.

Where do you want this to be documented?

In the data-model documentation, which currently states that "snapshots point to revisions and releases"

here's a git repo i've just built for you:

$ git br
* master
  not-a-branch
$ git show-ref not-a-branch
72955907aa477d43dc1c03ee6f5a13c2c49534bd refs/heads/not-a-branch
$ git cat-file -p 72955907aa477d43dc1c03ee6f5a13c2c49534bd
040000 tree 8535775197eeced6f90e9116618c61472ebccb9f	foo

How to obtain this is left as a game for the interested reader ;-))

But all in all it doesn't matter how hard it is to build such a repo or how common they are in the wild.
For one thing they might exist. Second, the most generic version of the data model is one in which it is allowed to have branches pointing to anything and it's trivial for us to support. Hence we do support this.

vlorentz claimed this task.

Got it, thanks!