+338
-338
api/tangled/cbor_gen.go
+338
-338
api/tangled/cbor_gen.go
···
1202
1202
1203
1203
return nil
1204
1204
}
1205
-
func (t *GitRefUpdate_Meta) MarshalCBOR(w io.Writer) error {
1206
-
if t == nil {
1207
-
_, err := w.Write(cbg.CborNull)
1208
-
return err
1209
-
}
1210
-
1211
-
cw := cbg.NewCborWriter(w)
1212
-
fieldCount := 3
1213
-
1214
-
if t.LangBreakdown == nil {
1215
-
fieldCount--
1216
-
}
1217
-
1218
-
if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
1219
-
return err
1220
-
}
1221
-
1222
-
// t.CommitCount (tangled.GitRefUpdate_Meta_CommitCount) (struct)
1223
-
if len("commitCount") > 1000000 {
1224
-
return xerrors.Errorf("Value in field \"commitCount\" was too long")
1225
-
}
1226
-
1227
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("commitCount"))); err != nil {
1228
-
return err
1229
-
}
1230
-
if _, err := cw.WriteString(string("commitCount")); err != nil {
1231
-
return err
1232
-
}
1233
-
1234
-
if err := t.CommitCount.MarshalCBOR(cw); err != nil {
1235
-
return err
1236
-
}
1237
-
1238
-
// t.IsDefaultRef (bool) (bool)
1239
-
if len("isDefaultRef") > 1000000 {
1240
-
return xerrors.Errorf("Value in field \"isDefaultRef\" was too long")
1241
-
}
1242
-
1243
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("isDefaultRef"))); err != nil {
1244
-
return err
1245
-
}
1246
-
if _, err := cw.WriteString(string("isDefaultRef")); err != nil {
1247
-
return err
1248
-
}
1249
-
1250
-
if err := cbg.WriteBool(w, t.IsDefaultRef); err != nil {
1251
-
return err
1252
-
}
1253
-
1254
-
// t.LangBreakdown (tangled.GitRefUpdate_Meta_LangBreakdown) (struct)
1255
-
if t.LangBreakdown != nil {
1256
-
1257
-
if len("langBreakdown") > 1000000 {
1258
-
return xerrors.Errorf("Value in field \"langBreakdown\" was too long")
1259
-
}
1260
-
1261
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("langBreakdown"))); err != nil {
1262
-
return err
1263
-
}
1264
-
if _, err := cw.WriteString(string("langBreakdown")); err != nil {
1265
-
return err
1266
-
}
1267
-
1268
-
if err := t.LangBreakdown.MarshalCBOR(cw); err != nil {
1269
-
return err
1270
-
}
1271
-
}
1272
-
return nil
1273
-
}
1274
-
1275
-
func (t *GitRefUpdate_Meta) UnmarshalCBOR(r io.Reader) (err error) {
1276
-
*t = GitRefUpdate_Meta{}
1277
-
1278
-
cr := cbg.NewCborReader(r)
1279
-
1280
-
maj, extra, err := cr.ReadHeader()
1281
-
if err != nil {
1282
-
return err
1283
-
}
1284
-
defer func() {
1285
-
if err == io.EOF {
1286
-
err = io.ErrUnexpectedEOF
1287
-
}
1288
-
}()
1289
-
1290
-
if maj != cbg.MajMap {
1291
-
return fmt.Errorf("cbor input should be of type map")
1292
-
}
1293
-
1294
-
if extra > cbg.MaxLength {
1295
-
return fmt.Errorf("GitRefUpdate_Meta: map struct too large (%d)", extra)
1296
-
}
1297
-
1298
-
n := extra
1299
-
1300
-
nameBuf := make([]byte, 13)
1301
-
for i := uint64(0); i < n; i++ {
1302
-
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
1303
-
if err != nil {
1304
-
return err
1305
-
}
1306
-
1307
-
if !ok {
1308
-
// Field doesn't exist on this type, so ignore it
1309
-
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
1310
-
return err
1311
-
}
1312
-
continue
1313
-
}
1314
-
1315
-
switch string(nameBuf[:nameLen]) {
1316
-
// t.CommitCount (tangled.GitRefUpdate_Meta_CommitCount) (struct)
1317
-
case "commitCount":
1318
-
1319
-
{
1320
-
1321
-
b, err := cr.ReadByte()
1322
-
if err != nil {
1323
-
return err
1324
-
}
1325
-
if b != cbg.CborNull[0] {
1326
-
if err := cr.UnreadByte(); err != nil {
1327
-
return err
1328
-
}
1329
-
t.CommitCount = new(GitRefUpdate_Meta_CommitCount)
1330
-
if err := t.CommitCount.UnmarshalCBOR(cr); err != nil {
1331
-
return xerrors.Errorf("unmarshaling t.CommitCount pointer: %w", err)
1332
-
}
1333
-
}
1334
-
1335
-
}
1336
-
// t.IsDefaultRef (bool) (bool)
1337
-
case "isDefaultRef":
1338
-
1339
-
maj, extra, err = cr.ReadHeader()
1340
-
if err != nil {
1341
-
return err
1342
-
}
1343
-
if maj != cbg.MajOther {
1344
-
return fmt.Errorf("booleans must be major type 7")
1345
-
}
1346
-
switch extra {
1347
-
case 20:
1348
-
t.IsDefaultRef = false
1349
-
case 21:
1350
-
t.IsDefaultRef = true
1351
-
default:
1352
-
return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra)
1353
-
}
1354
-
// t.LangBreakdown (tangled.GitRefUpdate_Meta_LangBreakdown) (struct)
1355
-
case "langBreakdown":
1356
-
1357
-
{
1358
-
1359
-
b, err := cr.ReadByte()
1360
-
if err != nil {
1361
-
return err
1362
-
}
1363
-
if b != cbg.CborNull[0] {
1364
-
if err := cr.UnreadByte(); err != nil {
1365
-
return err
1366
-
}
1367
-
t.LangBreakdown = new(GitRefUpdate_Meta_LangBreakdown)
1368
-
if err := t.LangBreakdown.UnmarshalCBOR(cr); err != nil {
1369
-
return xerrors.Errorf("unmarshaling t.LangBreakdown pointer: %w", err)
1370
-
}
1371
-
}
1372
-
1373
-
}
1374
-
1375
-
default:
1376
-
// Field doesn't exist on this type, so ignore it
1377
-
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
1378
-
return err
1379
-
}
1380
-
}
1381
-
}
1382
-
1383
-
return nil
1384
-
}
1385
-
func (t *GitRefUpdate_Meta_CommitCount) MarshalCBOR(w io.Writer) error {
1205
+
func (t *GitRefUpdate_CommitCountBreakdown) MarshalCBOR(w io.Writer) error {
1386
1206
if t == nil {
1387
1207
_, err := w.Write(cbg.CborNull)
1388
1208
return err
···
1399
1219
return err
1400
1220
}
1401
1221
1402
-
// t.ByEmail ([]*tangled.GitRefUpdate_Meta_CommitCount_ByEmail_Elem) (slice)
1222
+
// t.ByEmail ([]*tangled.GitRefUpdate_IndividualEmailCommitCount) (slice)
1403
1223
if t.ByEmail != nil {
1404
1224
1405
1225
if len("byEmail") > 1000000 {
···
1430
1250
return nil
1431
1251
}
1432
1252
1433
-
func (t *GitRefUpdate_Meta_CommitCount) UnmarshalCBOR(r io.Reader) (err error) {
1434
-
*t = GitRefUpdate_Meta_CommitCount{}
1253
+
func (t *GitRefUpdate_CommitCountBreakdown) UnmarshalCBOR(r io.Reader) (err error) {
1254
+
*t = GitRefUpdate_CommitCountBreakdown{}
1435
1255
1436
1256
cr := cbg.NewCborReader(r)
1437
1257
···
1450
1270
}
1451
1271
1452
1272
if extra > cbg.MaxLength {
1453
-
return fmt.Errorf("GitRefUpdate_Meta_CommitCount: map struct too large (%d)", extra)
1273
+
return fmt.Errorf("GitRefUpdate_CommitCountBreakdown: map struct too large (%d)", extra)
1454
1274
}
1455
1275
1456
1276
n := extra
···
1471
1291
}
1472
1292
1473
1293
switch string(nameBuf[:nameLen]) {
1474
-
// t.ByEmail ([]*tangled.GitRefUpdate_Meta_CommitCount_ByEmail_Elem) (slice)
1294
+
// t.ByEmail ([]*tangled.GitRefUpdate_IndividualEmailCommitCount) (slice)
1475
1295
case "byEmail":
1476
1296
1477
1297
maj, extra, err = cr.ReadHeader()
···
1488
1308
}
1489
1309
1490
1310
if extra > 0 {
1491
-
t.ByEmail = make([]*GitRefUpdate_Meta_CommitCount_ByEmail_Elem, extra)
1311
+
t.ByEmail = make([]*GitRefUpdate_IndividualEmailCommitCount, extra)
1492
1312
}
1493
1313
1494
1314
for i := 0; i < int(extra); i++ {
···
1510
1330
if err := cr.UnreadByte(); err != nil {
1511
1331
return err
1512
1332
}
1513
-
t.ByEmail[i] = new(GitRefUpdate_Meta_CommitCount_ByEmail_Elem)
1333
+
t.ByEmail[i] = new(GitRefUpdate_IndividualEmailCommitCount)
1514
1334
if err := t.ByEmail[i].UnmarshalCBOR(cr); err != nil {
1515
1335
return xerrors.Errorf("unmarshaling t.ByEmail[i] pointer: %w", err)
1516
1336
}
···
1531
1351
1532
1352
return nil
1533
1353
}
1534
-
func (t *GitRefUpdate_Meta_CommitCount_ByEmail_Elem) MarshalCBOR(w io.Writer) error {
1354
+
func (t *GitRefUpdate_IndividualEmailCommitCount) MarshalCBOR(w io.Writer) error {
1535
1355
if t == nil {
1536
1356
_, err := w.Write(cbg.CborNull)
1537
1357
return err
···
1590
1410
return nil
1591
1411
}
1592
1412
1593
-
func (t *GitRefUpdate_Meta_CommitCount_ByEmail_Elem) UnmarshalCBOR(r io.Reader) (err error) {
1594
-
*t = GitRefUpdate_Meta_CommitCount_ByEmail_Elem{}
1413
+
func (t *GitRefUpdate_IndividualEmailCommitCount) UnmarshalCBOR(r io.Reader) (err error) {
1414
+
*t = GitRefUpdate_IndividualEmailCommitCount{}
1595
1415
1596
1416
cr := cbg.NewCborReader(r)
1597
1417
···
1610
1430
}
1611
1431
1612
1432
if extra > cbg.MaxLength {
1613
-
return fmt.Errorf("GitRefUpdate_Meta_CommitCount_ByEmail_Elem: map struct too large (%d)", extra)
1433
+
return fmt.Errorf("GitRefUpdate_IndividualEmailCommitCount: map struct too large (%d)", extra)
1614
1434
}
1615
1435
1616
1436
n := extra
···
1679
1499
1680
1500
return nil
1681
1501
}
1682
-
func (t *GitRefUpdate_Meta_LangBreakdown) MarshalCBOR(w io.Writer) error {
1502
+
func (t *GitRefUpdate_LangBreakdown) MarshalCBOR(w io.Writer) error {
1683
1503
if t == nil {
1684
1504
_, err := w.Write(cbg.CborNull)
1685
1505
return err
···
1696
1516
return err
1697
1517
}
1698
1518
1699
-
// t.Inputs ([]*tangled.GitRefUpdate_Pair) (slice)
1519
+
// t.Inputs ([]*tangled.GitRefUpdate_IndividualLanguageSize) (slice)
1700
1520
if t.Inputs != nil {
1701
1521
1702
1522
if len("inputs") > 1000000 {
···
1727
1547
return nil
1728
1548
}
1729
1549
1730
-
func (t *GitRefUpdate_Meta_LangBreakdown) UnmarshalCBOR(r io.Reader) (err error) {
1731
-
*t = GitRefUpdate_Meta_LangBreakdown{}
1550
+
func (t *GitRefUpdate_LangBreakdown) UnmarshalCBOR(r io.Reader) (err error) {
1551
+
*t = GitRefUpdate_LangBreakdown{}
1732
1552
1733
1553
cr := cbg.NewCborReader(r)
1734
1554
···
1747
1567
}
1748
1568
1749
1569
if extra > cbg.MaxLength {
1750
-
return fmt.Errorf("GitRefUpdate_Meta_LangBreakdown: map struct too large (%d)", extra)
1570
+
return fmt.Errorf("GitRefUpdate_LangBreakdown: map struct too large (%d)", extra)
1751
1571
}
1752
1572
1753
1573
n := extra
···
1768
1588
}
1769
1589
1770
1590
switch string(nameBuf[:nameLen]) {
1771
-
// t.Inputs ([]*tangled.GitRefUpdate_Pair) (slice)
1591
+
// t.Inputs ([]*tangled.GitRefUpdate_IndividualLanguageSize) (slice)
1772
1592
case "inputs":
1773
1593
1774
1594
maj, extra, err = cr.ReadHeader()
···
1785
1605
}
1786
1606
1787
1607
if extra > 0 {
1788
-
t.Inputs = make([]*GitRefUpdate_Pair, extra)
1608
+
t.Inputs = make([]*GitRefUpdate_IndividualLanguageSize, extra)
1789
1609
}
1790
1610
1791
1611
for i := 0; i < int(extra); i++ {
···
1807
1627
if err := cr.UnreadByte(); err != nil {
1808
1628
return err
1809
1629
}
1810
-
t.Inputs[i] = new(GitRefUpdate_Pair)
1630
+
t.Inputs[i] = new(GitRefUpdate_IndividualLanguageSize)
1811
1631
if err := t.Inputs[i].UnmarshalCBOR(cr); err != nil {
1812
1632
return xerrors.Errorf("unmarshaling t.Inputs[i] pointer: %w", err)
1813
1633
}
···
1828
1648
1829
1649
return nil
1830
1650
}
1831
-
func (t *GitRefUpdate_Pair) MarshalCBOR(w io.Writer) error {
1651
+
func (t *GitRefUpdate_IndividualLanguageSize) MarshalCBOR(w io.Writer) error {
1832
1652
if t == nil {
1833
1653
_, err := w.Write(cbg.CborNull)
1834
1654
return err
···
1888
1708
return nil
1889
1709
}
1890
1710
1891
-
func (t *GitRefUpdate_Pair) UnmarshalCBOR(r io.Reader) (err error) {
1892
-
*t = GitRefUpdate_Pair{}
1711
+
func (t *GitRefUpdate_IndividualLanguageSize) UnmarshalCBOR(r io.Reader) (err error) {
1712
+
*t = GitRefUpdate_IndividualLanguageSize{}
1893
1713
1894
1714
cr := cbg.NewCborReader(r)
1895
1715
···
1908
1728
}
1909
1729
1910
1730
if extra > cbg.MaxLength {
1911
-
return fmt.Errorf("GitRefUpdate_Pair: map struct too large (%d)", extra)
1731
+
return fmt.Errorf("GitRefUpdate_IndividualLanguageSize: map struct too large (%d)", extra)
1912
1732
}
1913
1733
1914
1734
n := extra
···
1965
1785
}
1966
1786
1967
1787
t.Size = int64(extraI)
1788
+
}
1789
+
1790
+
default:
1791
+
// Field doesn't exist on this type, so ignore it
1792
+
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
1793
+
return err
1794
+
}
1795
+
}
1796
+
}
1797
+
1798
+
return nil
1799
+
}
1800
+
func (t *GitRefUpdate_Meta) MarshalCBOR(w io.Writer) error {
1801
+
if t == nil {
1802
+
_, err := w.Write(cbg.CborNull)
1803
+
return err
1804
+
}
1805
+
1806
+
cw := cbg.NewCborWriter(w)
1807
+
fieldCount := 3
1808
+
1809
+
if t.LangBreakdown == nil {
1810
+
fieldCount--
1811
+
}
1812
+
1813
+
if _, err := cw.Write(cbg.CborEncodeMajorType(cbg.MajMap, uint64(fieldCount))); err != nil {
1814
+
return err
1815
+
}
1816
+
1817
+
// t.CommitCount (tangled.GitRefUpdate_CommitCountBreakdown) (struct)
1818
+
if len("commitCount") > 1000000 {
1819
+
return xerrors.Errorf("Value in field \"commitCount\" was too long")
1820
+
}
1821
+
1822
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("commitCount"))); err != nil {
1823
+
return err
1824
+
}
1825
+
if _, err := cw.WriteString(string("commitCount")); err != nil {
1826
+
return err
1827
+
}
1828
+
1829
+
if err := t.CommitCount.MarshalCBOR(cw); err != nil {
1830
+
return err
1831
+
}
1832
+
1833
+
// t.IsDefaultRef (bool) (bool)
1834
+
if len("isDefaultRef") > 1000000 {
1835
+
return xerrors.Errorf("Value in field \"isDefaultRef\" was too long")
1836
+
}
1837
+
1838
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("isDefaultRef"))); err != nil {
1839
+
return err
1840
+
}
1841
+
if _, err := cw.WriteString(string("isDefaultRef")); err != nil {
1842
+
return err
1843
+
}
1844
+
1845
+
if err := cbg.WriteBool(w, t.IsDefaultRef); err != nil {
1846
+
return err
1847
+
}
1848
+
1849
+
// t.LangBreakdown (tangled.GitRefUpdate_LangBreakdown) (struct)
1850
+
if t.LangBreakdown != nil {
1851
+
1852
+
if len("langBreakdown") > 1000000 {
1853
+
return xerrors.Errorf("Value in field \"langBreakdown\" was too long")
1854
+
}
1855
+
1856
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("langBreakdown"))); err != nil {
1857
+
return err
1858
+
}
1859
+
if _, err := cw.WriteString(string("langBreakdown")); err != nil {
1860
+
return err
1861
+
}
1862
+
1863
+
if err := t.LangBreakdown.MarshalCBOR(cw); err != nil {
1864
+
return err
1865
+
}
1866
+
}
1867
+
return nil
1868
+
}
1869
+
1870
+
func (t *GitRefUpdate_Meta) UnmarshalCBOR(r io.Reader) (err error) {
1871
+
*t = GitRefUpdate_Meta{}
1872
+
1873
+
cr := cbg.NewCborReader(r)
1874
+
1875
+
maj, extra, err := cr.ReadHeader()
1876
+
if err != nil {
1877
+
return err
1878
+
}
1879
+
defer func() {
1880
+
if err == io.EOF {
1881
+
err = io.ErrUnexpectedEOF
1882
+
}
1883
+
}()
1884
+
1885
+
if maj != cbg.MajMap {
1886
+
return fmt.Errorf("cbor input should be of type map")
1887
+
}
1888
+
1889
+
if extra > cbg.MaxLength {
1890
+
return fmt.Errorf("GitRefUpdate_Meta: map struct too large (%d)", extra)
1891
+
}
1892
+
1893
+
n := extra
1894
+
1895
+
nameBuf := make([]byte, 13)
1896
+
for i := uint64(0); i < n; i++ {
1897
+
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
1898
+
if err != nil {
1899
+
return err
1900
+
}
1901
+
1902
+
if !ok {
1903
+
// Field doesn't exist on this type, so ignore it
1904
+
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
1905
+
return err
1906
+
}
1907
+
continue
1908
+
}
1909
+
1910
+
switch string(nameBuf[:nameLen]) {
1911
+
// t.CommitCount (tangled.GitRefUpdate_CommitCountBreakdown) (struct)
1912
+
case "commitCount":
1913
+
1914
+
{
1915
+
1916
+
b, err := cr.ReadByte()
1917
+
if err != nil {
1918
+
return err
1919
+
}
1920
+
if b != cbg.CborNull[0] {
1921
+
if err := cr.UnreadByte(); err != nil {
1922
+
return err
1923
+
}
1924
+
t.CommitCount = new(GitRefUpdate_CommitCountBreakdown)
1925
+
if err := t.CommitCount.UnmarshalCBOR(cr); err != nil {
1926
+
return xerrors.Errorf("unmarshaling t.CommitCount pointer: %w", err)
1927
+
}
1928
+
}
1929
+
1930
+
}
1931
+
// t.IsDefaultRef (bool) (bool)
1932
+
case "isDefaultRef":
1933
+
1934
+
maj, extra, err = cr.ReadHeader()
1935
+
if err != nil {
1936
+
return err
1937
+
}
1938
+
if maj != cbg.MajOther {
1939
+
return fmt.Errorf("booleans must be major type 7")
1940
+
}
1941
+
switch extra {
1942
+
case 20:
1943
+
t.IsDefaultRef = false
1944
+
case 21:
1945
+
t.IsDefaultRef = true
1946
+
default:
1947
+
return fmt.Errorf("booleans are either major type 7, value 20 or 21 (got %d)", extra)
1948
+
}
1949
+
// t.LangBreakdown (tangled.GitRefUpdate_LangBreakdown) (struct)
1950
+
case "langBreakdown":
1951
+
1952
+
{
1953
+
1954
+
b, err := cr.ReadByte()
1955
+
if err != nil {
1956
+
return err
1957
+
}
1958
+
if b != cbg.CborNull[0] {
1959
+
if err := cr.UnreadByte(); err != nil {
1960
+
return err
1961
+
}
1962
+
t.LangBreakdown = new(GitRefUpdate_LangBreakdown)
1963
+
if err := t.LangBreakdown.UnmarshalCBOR(cr); err != nil {
1964
+
return xerrors.Errorf("unmarshaling t.LangBreakdown pointer: %w", err)
1965
+
}
1966
+
}
1967
+
1968
1968
}
1969
1969
1970
1970
default:
···
6522
6522
6523
6523
return nil
6524
6524
}
6525
-
func (t *RepoPull_Target) MarshalCBOR(w io.Writer) error {
6526
-
if t == nil {
6527
-
_, err := w.Write(cbg.CborNull)
6528
-
return err
6529
-
}
6530
-
6531
-
cw := cbg.NewCborWriter(w)
6532
-
6533
-
if _, err := cw.Write([]byte{162}); err != nil {
6534
-
return err
6535
-
}
6536
-
6537
-
// t.Repo (string) (string)
6538
-
if len("repo") > 1000000 {
6539
-
return xerrors.Errorf("Value in field \"repo\" was too long")
6540
-
}
6541
-
6542
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
6543
-
return err
6544
-
}
6545
-
if _, err := cw.WriteString(string("repo")); err != nil {
6546
-
return err
6547
-
}
6548
-
6549
-
if len(t.Repo) > 1000000 {
6550
-
return xerrors.Errorf("Value in field t.Repo was too long")
6551
-
}
6552
-
6553
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Repo))); err != nil {
6554
-
return err
6555
-
}
6556
-
if _, err := cw.WriteString(string(t.Repo)); err != nil {
6557
-
return err
6558
-
}
6559
-
6560
-
// t.Branch (string) (string)
6561
-
if len("branch") > 1000000 {
6562
-
return xerrors.Errorf("Value in field \"branch\" was too long")
6563
-
}
6564
-
6565
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("branch"))); err != nil {
6566
-
return err
6567
-
}
6568
-
if _, err := cw.WriteString(string("branch")); err != nil {
6569
-
return err
6570
-
}
6571
-
6572
-
if len(t.Branch) > 1000000 {
6573
-
return xerrors.Errorf("Value in field t.Branch was too long")
6574
-
}
6575
-
6576
-
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Branch))); err != nil {
6577
-
return err
6578
-
}
6579
-
if _, err := cw.WriteString(string(t.Branch)); err != nil {
6580
-
return err
6581
-
}
6582
-
return nil
6583
-
}
6584
-
6585
-
func (t *RepoPull_Target) UnmarshalCBOR(r io.Reader) (err error) {
6586
-
*t = RepoPull_Target{}
6587
-
6588
-
cr := cbg.NewCborReader(r)
6589
-
6590
-
maj, extra, err := cr.ReadHeader()
6591
-
if err != nil {
6592
-
return err
6593
-
}
6594
-
defer func() {
6595
-
if err == io.EOF {
6596
-
err = io.ErrUnexpectedEOF
6597
-
}
6598
-
}()
6599
-
6600
-
if maj != cbg.MajMap {
6601
-
return fmt.Errorf("cbor input should be of type map")
6602
-
}
6603
-
6604
-
if extra > cbg.MaxLength {
6605
-
return fmt.Errorf("RepoPull_Target: map struct too large (%d)", extra)
6606
-
}
6607
-
6608
-
n := extra
6609
-
6610
-
nameBuf := make([]byte, 6)
6611
-
for i := uint64(0); i < n; i++ {
6612
-
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
6613
-
if err != nil {
6614
-
return err
6615
-
}
6616
-
6617
-
if !ok {
6618
-
// Field doesn't exist on this type, so ignore it
6619
-
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
6620
-
return err
6621
-
}
6622
-
continue
6623
-
}
6624
-
6625
-
switch string(nameBuf[:nameLen]) {
6626
-
// t.Repo (string) (string)
6627
-
case "repo":
6628
-
6629
-
{
6630
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
6631
-
if err != nil {
6632
-
return err
6633
-
}
6634
-
6635
-
t.Repo = string(sval)
6636
-
}
6637
-
// t.Branch (string) (string)
6638
-
case "branch":
6639
-
6640
-
{
6641
-
sval, err := cbg.ReadStringWithMax(cr, 1000000)
6642
-
if err != nil {
6643
-
return err
6644
-
}
6645
-
6646
-
t.Branch = string(sval)
6647
-
}
6648
-
6649
-
default:
6650
-
// Field doesn't exist on this type, so ignore it
6651
-
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
6652
-
return err
6653
-
}
6654
-
}
6655
-
}
6656
-
6657
-
return nil
6658
-
}
6659
6525
func (t *RepoPull) MarshalCBOR(w io.Writer) error {
6660
6526
if t == nil {
6661
6527
_, err := w.Write(cbg.CborNull)
···
7533
7399
}
7534
7400
7535
7401
t.Status = string(sval)
7402
+
}
7403
+
7404
+
default:
7405
+
// Field doesn't exist on this type, so ignore it
7406
+
if err := cbg.ScanForLinks(r, func(cid.Cid) {}); err != nil {
7407
+
return err
7408
+
}
7409
+
}
7410
+
}
7411
+
7412
+
return nil
7413
+
}
7414
+
func (t *RepoPull_Target) MarshalCBOR(w io.Writer) error {
7415
+
if t == nil {
7416
+
_, err := w.Write(cbg.CborNull)
7417
+
return err
7418
+
}
7419
+
7420
+
cw := cbg.NewCborWriter(w)
7421
+
7422
+
if _, err := cw.Write([]byte{162}); err != nil {
7423
+
return err
7424
+
}
7425
+
7426
+
// t.Repo (string) (string)
7427
+
if len("repo") > 1000000 {
7428
+
return xerrors.Errorf("Value in field \"repo\" was too long")
7429
+
}
7430
+
7431
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("repo"))); err != nil {
7432
+
return err
7433
+
}
7434
+
if _, err := cw.WriteString(string("repo")); err != nil {
7435
+
return err
7436
+
}
7437
+
7438
+
if len(t.Repo) > 1000000 {
7439
+
return xerrors.Errorf("Value in field t.Repo was too long")
7440
+
}
7441
+
7442
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Repo))); err != nil {
7443
+
return err
7444
+
}
7445
+
if _, err := cw.WriteString(string(t.Repo)); err != nil {
7446
+
return err
7447
+
}
7448
+
7449
+
// t.Branch (string) (string)
7450
+
if len("branch") > 1000000 {
7451
+
return xerrors.Errorf("Value in field \"branch\" was too long")
7452
+
}
7453
+
7454
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("branch"))); err != nil {
7455
+
return err
7456
+
}
7457
+
if _, err := cw.WriteString(string("branch")); err != nil {
7458
+
return err
7459
+
}
7460
+
7461
+
if len(t.Branch) > 1000000 {
7462
+
return xerrors.Errorf("Value in field t.Branch was too long")
7463
+
}
7464
+
7465
+
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len(t.Branch))); err != nil {
7466
+
return err
7467
+
}
7468
+
if _, err := cw.WriteString(string(t.Branch)); err != nil {
7469
+
return err
7470
+
}
7471
+
return nil
7472
+
}
7473
+
7474
+
func (t *RepoPull_Target) UnmarshalCBOR(r io.Reader) (err error) {
7475
+
*t = RepoPull_Target{}
7476
+
7477
+
cr := cbg.NewCborReader(r)
7478
+
7479
+
maj, extra, err := cr.ReadHeader()
7480
+
if err != nil {
7481
+
return err
7482
+
}
7483
+
defer func() {
7484
+
if err == io.EOF {
7485
+
err = io.ErrUnexpectedEOF
7486
+
}
7487
+
}()
7488
+
7489
+
if maj != cbg.MajMap {
7490
+
return fmt.Errorf("cbor input should be of type map")
7491
+
}
7492
+
7493
+
if extra > cbg.MaxLength {
7494
+
return fmt.Errorf("RepoPull_Target: map struct too large (%d)", extra)
7495
+
}
7496
+
7497
+
n := extra
7498
+
7499
+
nameBuf := make([]byte, 6)
7500
+
for i := uint64(0); i < n; i++ {
7501
+
nameLen, ok, err := cbg.ReadFullStringIntoBuf(cr, nameBuf, 1000000)
7502
+
if err != nil {
7503
+
return err
7504
+
}
7505
+
7506
+
if !ok {
7507
+
// Field doesn't exist on this type, so ignore it
7508
+
if err := cbg.ScanForLinks(cr, func(cid.Cid) {}); err != nil {
7509
+
return err
7510
+
}
7511
+
continue
7512
+
}
7513
+
7514
+
switch string(nameBuf[:nameLen]) {
7515
+
// t.Repo (string) (string)
7516
+
case "repo":
7517
+
7518
+
{
7519
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
7520
+
if err != nil {
7521
+
return err
7522
+
}
7523
+
7524
+
t.Repo = string(sval)
7525
+
}
7526
+
// t.Branch (string) (string)
7527
+
case "branch":
7528
+
7529
+
{
7530
+
sval, err := cbg.ReadStringWithMax(cr, 1000000)
7531
+
if err != nil {
7532
+
return err
7533
+
}
7534
+
7535
+
t.Branch = string(sval)
7536
7536
}
7537
7537
7538
7538
default:
+19
-15
api/tangled/gitrefUpdate.go
+19
-15
api/tangled/gitrefUpdate.go
···
33
33
RepoName string `json:"repoName" cborgen:"repoName"`
34
34
}
35
35
36
-
type GitRefUpdate_Meta struct {
37
-
CommitCount *GitRefUpdate_Meta_CommitCount `json:"commitCount" cborgen:"commitCount"`
38
-
IsDefaultRef bool `json:"isDefaultRef" cborgen:"isDefaultRef"`
39
-
LangBreakdown *GitRefUpdate_Meta_LangBreakdown `json:"langBreakdown,omitempty" cborgen:"langBreakdown,omitempty"`
36
+
// GitRefUpdate_CommitCountBreakdown is a "commitCountBreakdown" in the sh.tangled.git.refUpdate schema.
37
+
type GitRefUpdate_CommitCountBreakdown struct {
38
+
ByEmail []*GitRefUpdate_IndividualEmailCommitCount `json:"byEmail,omitempty" cborgen:"byEmail,omitempty"`
40
39
}
41
40
42
-
type GitRefUpdate_Meta_CommitCount struct {
43
-
ByEmail []*GitRefUpdate_Meta_CommitCount_ByEmail_Elem `json:"byEmail,omitempty" cborgen:"byEmail,omitempty"`
44
-
}
45
-
46
-
type GitRefUpdate_Meta_CommitCount_ByEmail_Elem struct {
41
+
// GitRefUpdate_IndividualEmailCommitCount is a "individualEmailCommitCount" in the sh.tangled.git.refUpdate schema.
42
+
type GitRefUpdate_IndividualEmailCommitCount struct {
47
43
Count int64 `json:"count" cborgen:"count"`
48
44
Email string `json:"email" cborgen:"email"`
49
45
}
50
46
51
-
type GitRefUpdate_Meta_LangBreakdown struct {
52
-
Inputs []*GitRefUpdate_Pair `json:"inputs,omitempty" cborgen:"inputs,omitempty"`
53
-
}
54
-
55
-
// GitRefUpdate_Pair is a "pair" in the sh.tangled.git.refUpdate schema.
56
-
type GitRefUpdate_Pair struct {
47
+
// GitRefUpdate_IndividualLanguageSize is a "individualLanguageSize" in the sh.tangled.git.refUpdate schema.
48
+
type GitRefUpdate_IndividualLanguageSize struct {
57
49
Lang string `json:"lang" cborgen:"lang"`
58
50
Size int64 `json:"size" cborgen:"size"`
59
51
}
52
+
53
+
// GitRefUpdate_LangBreakdown is a "langBreakdown" in the sh.tangled.git.refUpdate schema.
54
+
type GitRefUpdate_LangBreakdown struct {
55
+
Inputs []*GitRefUpdate_IndividualLanguageSize `json:"inputs,omitempty" cborgen:"inputs,omitempty"`
56
+
}
57
+
58
+
// GitRefUpdate_Meta is a "meta" in the sh.tangled.git.refUpdate schema.
59
+
type GitRefUpdate_Meta struct {
60
+
CommitCount *GitRefUpdate_CommitCountBreakdown `json:"commitCount" cborgen:"commitCount"`
61
+
IsDefaultRef bool `json:"isDefaultRef" cborgen:"isDefaultRef"`
62
+
LangBreakdown *GitRefUpdate_LangBreakdown `json:"langBreakdown,omitempty" cborgen:"langBreakdown,omitempty"`
63
+
}
+5
-5
cmd/gen.go
+5
-5
cmd/gen.go
···
18
18
tangled.FeedReaction{},
19
19
tangled.FeedStar{},
20
20
tangled.GitRefUpdate{},
21
+
tangled.GitRefUpdate_CommitCountBreakdown{},
22
+
tangled.GitRefUpdate_IndividualEmailCommitCount{},
23
+
tangled.GitRefUpdate_LangBreakdown{},
24
+
tangled.GitRefUpdate_IndividualLanguageSize{},
21
25
tangled.GitRefUpdate_Meta{},
22
-
tangled.GitRefUpdate_Meta_CommitCount{},
23
-
tangled.GitRefUpdate_Meta_CommitCount_ByEmail_Elem{},
24
-
tangled.GitRefUpdate_Meta_LangBreakdown{},
25
-
tangled.GitRefUpdate_Pair{},
26
26
tangled.GraphFollow{},
27
27
tangled.Knot{},
28
28
tangled.KnotMember{},
···
46
46
tangled.RepoPull{},
47
47
tangled.RepoPullComment{},
48
48
tangled.RepoPull_Source{},
49
-
tangled.RepoPull_Target{},
50
49
tangled.RepoPullStatus{},
50
+
tangled.RepoPull_Target{},
51
51
tangled.Spindle{},
52
52
tangled.SpindleMember{},
53
53
tangled.String{},
+9
-10
knotserver/git/post_receive.go
+9
-10
knotserver/git/post_receive.go
···
145
145
}
146
146
147
147
func (m RefUpdateMeta) AsRecord() tangled.GitRefUpdate_Meta {
148
-
var byEmail []*tangled.GitRefUpdate_Meta_CommitCount_ByEmail_Elem
148
+
var byEmail []*tangled.GitRefUpdate_IndividualEmailCommitCount
149
149
for e, v := range m.CommitCount.ByEmail {
150
-
byEmail = append(byEmail, &tangled.GitRefUpdate_Meta_CommitCount_ByEmail_Elem{
150
+
byEmail = append(byEmail, &tangled.GitRefUpdate_IndividualEmailCommitCount{
151
151
Email: e,
152
152
Count: int64(v),
153
153
})
154
154
}
155
155
156
-
var langs []*tangled.GitRefUpdate_Pair
156
+
var langs []*tangled.GitRefUpdate_IndividualLanguageSize
157
157
for lang, size := range m.LangBreakdown {
158
-
langs = append(langs, &tangled.GitRefUpdate_Pair{
158
+
langs = append(langs, &tangled.GitRefUpdate_IndividualLanguageSize{
159
159
Lang: lang,
160
160
Size: size,
161
161
})
162
162
}
163
-
langBreakdown := &tangled.GitRefUpdate_Meta_LangBreakdown{
164
-
Inputs: langs,
165
-
}
166
163
167
164
return tangled.GitRefUpdate_Meta{
168
-
CommitCount: &tangled.GitRefUpdate_Meta_CommitCount{
165
+
CommitCount: &tangled.GitRefUpdate_CommitCountBreakdown{
169
166
ByEmail: byEmail,
170
167
},
171
-
IsDefaultRef: m.IsDefaultRef,
172
-
LangBreakdown: langBreakdown,
168
+
IsDefaultRef: m.IsDefaultRef,
169
+
LangBreakdown: &tangled.GitRefUpdate_LangBreakdown{
170
+
Inputs: langs,
171
+
},
173
172
}
174
173
}