| 1 | package fixtures_testscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6_test`/ |
| 2 | |
| 3 | import ( |
| 4 | "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/" |
| 5 | |
| 6 | fixturesscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/ "github.com/go-git/go-git-fixtures/v6scip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/" |
| 7 | "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/" |
| 8 | "github.com/stretchr/testify/requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/" |
| 9 | ) |
| 10 | |
| 11 | func TestEntriesscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6_test`/TestEntries().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 12 | t.Parallelscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Parallel().() |
| 13 | |
| 14 | for _, f := range fixturesscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/.ByTagscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/ByTag().("packfile-entries") { |
| 15 | t.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Run().(f.PackfileHashscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/Fixture#PackfileHash., func(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 16 | t.Parallelscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Parallel().() |
| 17 | |
| 18 | entries := f.Entriesscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/Fixture#Entries().() |
| 19 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NotNil().(t, entries) |
| 20 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotEmptyscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotEmpty().(t, entries) |
| 21 | |
| 22 | for hash, offset := range entries { |
| 23 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotEmptyscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotEmpty().(t, hash) |
| 24 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.GreaterOrEqualscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/GreaterOrEqual().(t, offset, int64(0)) |
| 25 | } |
| 26 | }) |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | func TestEntriesReturnsNilForUnregisteredPackfilescip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6_test`/TestEntriesReturnsNilForUnregisteredPackfile().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 31 | t.Parallelscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Parallel().() |
| 32 | |
| 33 | f := fixturesscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/.ByTagscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/ByTag().("notes").Onescip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/Fixtures#One().() |
| 34 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NotNil().(t, f) |
| 35 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, f.Entriesscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/Fixture#Entries().()) |
| 36 | } |
| 37 | |
| 38 | func TestEntriesReturnsFreshMapscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6_test`/TestEntriesReturnsFreshMap().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 39 | t.Parallelscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Parallel().() |
| 40 | |
| 41 | f := fixturesscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/.ByTagscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/ByTag().("packfile-entries").Onescip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/Fixtures#One().() |
| 42 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NotNil().(t, f) |
| 43 | |
| 44 | a := f.Entriesscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/Fixture#Entries().() |
| 45 | b := f.Entriesscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/Fixture#Entries().() |
| 46 | |
| 47 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NotNil().(t, a) |
| 48 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NotNil().(t, b) |
| 49 | |
| 50 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, a, b) |
| 51 | |
| 52 | // Mutating one must not affect the other. |
| 53 | for k := range a { |
| 54 | a[k] = -1 |
| 55 | |
| 56 | break |
| 57 | } |
| 58 | |
| 59 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotEqualscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotEqual().(t, a, b) |
| 60 | } |
| 61 | |
| 62 | func TestScannerEntriesscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6_test`/TestScannerEntries().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 63 | t.Parallelscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Parallel().() |
| 64 | |
| 65 | for _, f := range fixturesscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/.ByTagscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/ByTag().("scanner-entries") { |
| 66 | t.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Run().(f.PackfileHashscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/Fixture#PackfileHash., func(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 67 | t.Parallelscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Parallel().() |
| 68 | |
| 69 | entries := f.ScannerEntriesscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/Fixture#ScannerEntries().() |
| 70 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NotNil().(t, entries) |
| 71 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotEmptyscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotEmpty().(t, entries) |
| 72 | |
| 73 | var prevOffset int64 |
| 74 | for i, e := range entries { |
| 75 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Greaterscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Greater().(t, e.Offsetscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/ScannerEntry#Offset., prevOffset, |
| 76 | "entry %d: offset %d must be greater than previous %d", i, e.Offsetscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/ScannerEntry#Offset., prevOffset) |
| 77 | prevOffset = e.Offsetscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/ScannerEntry#Offset. |
| 78 | |
| 79 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.GreaterOrEqualscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/GreaterOrEqual().(t, e.Sizescip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/ScannerEntry#Size., int64(0)) |
| 80 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotZeroscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotZero().(t, e.Typescip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/ScannerEntry#Type.) |
| 81 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotZeroscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotZero().(t, e.CRC32scip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/ScannerEntry#CRC32.) |
| 82 | } |
| 83 | }) |
| 84 | } |
| 85 | } |
| 86 | |
| 87 | func TestScannerEntriesReturnsNilForUnregisteredPackfilescip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6_test`/TestScannerEntriesReturnsNilForUnregisteredPackfile().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 88 | t.Parallelscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Parallel().() |
| 89 | |
| 90 | f := fixturesscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/.ByTagscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/ByTag().("notes").Onescip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/Fixtures#One().() |
| 91 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NotNil().(t, f) |
| 92 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Nilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Nil().(t, f.ScannerEntriesscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/Fixture#ScannerEntries().()) |
| 93 | } |
| 94 | |
| 95 | func TestScannerEntriesReturnsFreshSlicescip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6_test`/TestScannerEntriesReturnsFreshSlice().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 96 | t.Parallelscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Parallel().() |
| 97 | |
| 98 | f := fixturesscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/.ByTagscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/ByTag().("scanner-entries").Onescip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/Fixtures#One().() |
| 99 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NotNil().(t, f) |
| 100 | |
| 101 | a := f.ScannerEntriesscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/Fixture#ScannerEntries().() |
| 102 | b := f.ScannerEntriesscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/Fixture#ScannerEntries().() |
| 103 | |
| 104 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NotNil().(t, a) |
| 105 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NotNil().(t, b) |
| 106 | |
| 107 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, a, b) |
| 108 | |
| 109 | a[0].Offsetscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/ScannerEntry#Offset. = -1 |
| 110 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NotEqualscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NotEqual().(t, a, b) |
| 111 | } |
| 112 | |
| 113 | func TestEntriesConsistentWithScannerEntriesscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6_test`/TestEntriesConsistentWithScannerEntries().(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 114 | t.Parallelscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Parallel().() |
| 115 | |
| 116 | // Fixtures tagged with both should have consistent hash/offset pairs. |
| 117 | ff := fixturesscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/.ByTagscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/ByTag().("packfile-entries").ByTagscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/Fixtures#ByTag().("scanner-entries") |
| 118 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NotEmptyscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NotEmpty().(t, ff) |
| 119 | |
| 120 | for _, f := range ff { |
| 121 | t.Runscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Run().(f.PackfileHashscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/Fixture#PackfileHash., func(t *testingscip-go gomod github.com/golang/go/src go1.25.0 testing/.Tscip-go gomod github.com/golang/go/src go1.25.0 testing/T#) { |
| 122 | t.Parallelscip-go gomod github.com/golang/go/src go1.25.0 testing/T#Parallel().() |
| 123 | |
| 124 | entries := f.Entriesscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/Fixture#Entries().() |
| 125 | scannerEntries := f.ScannerEntriesscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/Fixture#ScannerEntries().() |
| 126 | |
| 127 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NotNil().(t, entries) |
| 128 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.NotNilscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/NotNil().(t, scannerEntries) |
| 129 | |
| 130 | for _, se := range scannerEntries { |
| 131 | if se.Hashscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/ScannerEntry#Hash. == "" { |
| 132 | continue // delta objects have no hash |
| 133 | } |
| 134 | |
| 135 | offset, ok := entries[se.Hashscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/ScannerEntry#Hash.] |
| 136 | requirescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/.Truescip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/require`/True().(t, ok, "scanner entry hash %s not found in packfile entries", se.Hashscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/ScannerEntry#Hash.) |
| 137 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Equalscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Equal().(t, se.Offsetscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/ScannerEntry#Offset., offset, |
| 138 | "offset mismatch for hash %s", se.Hashscip-go gomod github.com/go-git/go-git-fixtures/v6 . `github.com/go-git/go-git-fixtures/v6`/ScannerEntry#Hash.) |
| 139 | } |
| 140 | }) |
| 141 | } |
| 142 | } |