MCPcopy Create free account
hub / github.com/git-bug/git-bug / Id

Method Id

entity/dag/operation_pack.go:42–56  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

40}
41
42func (opp *operationPack) Id() entity.Id {
43 if opp.id == "" || opp.id == entity.UnsetId {
44 // This means we are trying to get the opp's Id *before* it has been stored.
45 // As the Id is computed based on the actual bytes written on the disk, we are going to predict
46 // those and then get the Id. This is safe as it will be the exact same code writing on disk later.
47
48 data, err := json.Marshal(opp)
49 if err != nil {
50 panic(err)
51 }
52 opp.id = entity.DeriveId(data)
53 }
54
55 return opp.id
56}
57
58func (opp *operationPack) MarshalJSON() ([]byte, error) {
59 return json.Marshal(struct {

Callers

nothing calls this directly

Calls 1

DeriveIdFunction · 0.92

Tested by

no test coverage detected