Explorer

definy.branch-snapshot-find

description
The latest snapshot of the branch of the project
type
Fn(
  commits: List<@definy.event-snapshot>,
  branches: List<@core.branch-summary>,
  project: String,
  branch: String,
  index: Number
) -> Union{#none, #some(@definy.event-snapshot)}
expression
fn(commits$0, branches$1, project$2, branch$3, index$4) =>
  match @core.list-get(list: $1, index: $4) {
    #none(_) =>
      #none,
    #some(item$5) =>
      match @core.and(left: @core.equal(left: $5.project_name, right: $2), right: @core.equal(left: $5.name, right: $3)) {
        true =>
          @definy.event-snapshot-find(commits: $0, event_hash: $5.latest_event_hash, index: 0),
        false =>
          @definy.branch-snapshot-find(commits: $0, branches: $1, project: $2, branch: $3, index: @core.plus(left: $4, right: 1))
      }
  }
visibility
public
definy.branch-snapshot-find (project definy, branch main, snapshot l0VFjJZP174d8CbZWFoujAGTYjgsQu4uTq5uWCZaXgo)
id: 23-3Y_-MA2bgyePvGhdn-Aq1Tn90Bmrbo0OlJrIEYY0
content hash: hLuoNLrJLk5uqxI-p9XVDedNKku6fuoQo-W5R4LUETU