Debian Codegraph @

git/githistory/rewriter_test.go

raw symbols SCIP
1 package githistoryscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/
2
3 import (
4 "bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/"
5 "encoding/hexscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/"
6 "ioscip-go gomod github.com/golang/go/src go1.25.0 io/"
7 "reflectscip-go gomod github.com/golang/go/src go1.25.0 reflect/"
8 "strconvscip-go gomod github.com/golang/go/src go1.25.0 strconv/"
9 "stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/"
10 "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/"
11
12 "github.com/git-lfs/git-lfs/v3/errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/"
13 "github.com/git-lfs/git-lfs/v3/filepathfilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/"
14 "github.com/git-lfs/gitobj/v2scip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/"
15 "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/"
16 )
17
18 func TestRewriterRewritesHistoryscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/TestRewriterRewritesHistory().(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#) {
19 db := DatabaseFromFixturescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/DatabaseFromFixture().(t, "linear-history.git")
20 r := NewRewriterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/NewRewriter().(db)
21
22 tip, err := r.Rewritescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/Rewriter#Rewrite().(&RewriteOptionsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#{Includescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#Include.: []string{"refs/heads/master"},
23 BlobFnscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#BlobFn.: func(path string, b *gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#) (*gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#, error) {
24 contents, err := ioscip-go gomod github.com/golang/go/src go1.25.0 io/.ReadAllscip-go gomod github.com/golang/go/src go1.25.0 io/ReadAll().(b.Contentsscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#Contents.)
25 if err != nil {
26 return nil, err
27 }
28
29 n, err := strconvscip-go gomod github.com/golang/go/src go1.25.0 strconv/.Atoiscip-go gomod github.com/golang/go/src go1.25.0 strconv/Atoi().(string(contents))
30 if err != nil {
31 return nil, err
32 }
33
34 rewritten := strconvscip-go gomod github.com/golang/go/src go1.25.0 strconv/.Itoascip-go gomod github.com/golang/go/src go1.25.0 strconv/Itoa().(n + 1)
35
36 return &gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#{
37 Contentsscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#Contents.: stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.25.0 strings/NewReader().(rewritten),
38 Sizescip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#Size.: int64(len(rewritten)),
39 }, nil
40 },
41 })
42
43 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, err)
44
45 tree1 := "ad0aebd16e34cf047820994ea7538a6d4a111082"
46 tree2 := "6e07bd31cb70c4add2c973481ad4fa38b235ca69"
47 tree3 := "c5decfe1fcf39b8c489f4a0bf3b3823676339f80"
48
49 // After rewriting, the HEAD state of the repository should contain a
50 // tree identical to:
51 //
52 // 100644 blob bf0d87ab1b2b0ec1a11a3973d2845b42413d9767 hello.txt
53
54 AssertCommitTreescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertCommitTree().(t, db, hexscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/.EncodeToStringscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/EncodeToString().(tip), tree1)
55
56 AssertBlobContentsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertBlobContents().(t, db, tree1, "hello.txt", "4")
57
58 // After rewriting, the HEAD~1 state of the repository should contain a
59 // tree identical to:
60 //
61 // 100644 blob e440e5c842586965a7fb77deda2eca68612b1f53 hello.txt
62
63 AssertCommitParentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertCommitParent().(t, db, hexscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/.EncodeToStringscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/EncodeToString().(tip), "4aaa3f49ffeabbb874250fe13ffeb8c683aba650")
64 AssertCommitTreescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertCommitTree().(t, db, "4aaa3f49ffeabbb874250fe13ffeb8c683aba650", tree2)
65
66 AssertBlobContentsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertBlobContents().(t, db, tree2, "hello.txt", "3")
67
68 // After rewriting, the HEAD~2 state of the repository should contain a
69 // tree identical to:
70 //
71 // 100644 blob d8263ee9860594d2806b0dfd1bfd17528b0ba2a4 hello.txt
72
73 AssertCommitParentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertCommitParent().(t, db, "4aaa3f49ffeabbb874250fe13ffeb8c683aba650", "24a341e1ff75addc22e336a8d87f82ba56b86fcf")
74 AssertCommitTreescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertCommitTree().(t, db, "24a341e1ff75addc22e336a8d87f82ba56b86fcf", tree3)
75
76 AssertBlobContentsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertBlobContents().(t, db, tree3, "hello.txt", "2")
77 }
78
79 func TestRewriterRewritesOctopusMergesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/TestRewriterRewritesOctopusMerges().(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#) {
80 db := DatabaseFromFixturescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/DatabaseFromFixture().(t, "octopus-merge.git")
81 r := NewRewriterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/NewRewriter().(db)
82
83 tip, err := r.Rewritescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/Rewriter#Rewrite().(&RewriteOptionsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#{Includescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#Include.: []string{"refs/heads/master"},
84 BlobFnscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#BlobFn.: func(path string, b *gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#) (*gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#, error) {
85 return &gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#{
86 Contentsscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#Contents.: ioscip-go gomod github.com/golang/go/src go1.25.0 io/.MultiReaderscip-go gomod github.com/golang/go/src go1.25.0 io/MultiReader().(b.Contentsscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#Contents., stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.25.0 strings/NewReader().("_new")),
87 Sizescip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#Size.: b.Sizescip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#Size. + int64(len("_new")),
88 }, nil
89 },
90 })
91
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, err)
93
94 tree := "8a56716daa78325c3d0433cc163890969810b0da"
95
96 // After rewriting, the HEAD state of the repository should contain a
97 // tree identical to:
98 //
99 // 100644 blob 309f7fc2bfd9ae77b4131cf9cbcc3b548c42ca57 a.txt
100 // 100644 blob 70470dc26cb3eef54fe3dcba53066f7ca7c495c0 b.txt
101 // 100644 blob f2557f74fd5b60f959baf77091782089761e2dc3 hello.txt
102
103 AssertCommitTreescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertCommitTree().(t, db, hexscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/.EncodeToStringscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/EncodeToString().(tip), tree)
104
105 AssertBlobContentsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertBlobContents().(t, db, tree, "a.txt", "a_new")
106 AssertBlobContentsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertBlobContents().(t, db, tree, "b.txt", "b_new")
107 AssertBlobContentsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertBlobContents().(t, db, tree, "hello.txt", "hello_new")
108
109 // And should contain the following parents:
110 //
111 // parent 1fe2b9577d5610e8d8fb2c3030534036fb648393
112 // parent ca447959bdcd20253d69b227bcc7c2e1d3126d5c
113
114 AssertCommitParentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertCommitParent().(t, db, hexscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/.EncodeToStringscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/EncodeToString().(tip), "1fe2b9577d5610e8d8fb2c3030534036fb648393")
115 AssertCommitParentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertCommitParent().(t, db, hexscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/.EncodeToStringscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/EncodeToString().(tip), "ca447959bdcd20253d69b227bcc7c2e1d3126d5c")
116
117 // And each of those parents should contain the root commit as their own
118 // parent:
119
120 AssertCommitParentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertCommitParent().(t, db, "1fe2b9577d5610e8d8fb2c3030534036fb648393", "9237567f379b3c83ddf53ad9a2ae3755afb62a09")
121 AssertCommitParentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertCommitParent().(t, db, "ca447959bdcd20253d69b227bcc7c2e1d3126d5c", "9237567f379b3c83ddf53ad9a2ae3755afb62a09")
122 }
123
124 func TestRewriterVisitsPackedObjectsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/TestRewriterVisitsPackedObjects().(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#) {
125 db := DatabaseFromFixturescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/DatabaseFromFixture().(t, "packed-objects.git")
126 r := NewRewriterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/NewRewriter().(db)
127
128 var contents []byte
129
130 _, err := r.Rewritescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/Rewriter#Rewrite().(&RewriteOptionsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#{Includescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#Include.: []string{"refs/heads/master"},
131 BlobFnscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#BlobFn.: func(path string, b *gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#) (*gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#, error) {
132 var err error
133
134 contents, err = ioscip-go gomod github.com/golang/go/src go1.25.0 io/.ReadAllscip-go gomod github.com/golang/go/src go1.25.0 io/ReadAll().(b.Contentsscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#Contents.)
135 if err != nil {
136 return nil, err
137 }
138
139 return &gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#{
140 Contentsscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#Contents.: bytesscip-go gomod github.com/golang/go/src go1.25.0 bytes/.NewReaderscip-go gomod github.com/golang/go/src go1.25.0 bytes/NewReader().(contents),
141 Sizescip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#Size.: int64(len(contents)),
142 }, nil
143 },
144 })
145
146 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
147 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, string(contents), "Hello, world!\n")
148 }
149
150 func TestRewriterDoesntVisitUnchangedSubtreesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/TestRewriterDoesntVisitUnchangedSubtrees().(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#) {
151 db := DatabaseFromFixturescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/DatabaseFromFixture().(t, "repeated-subtrees.git")
152 r := NewRewriterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/NewRewriter().(db)
153
154 seen := make(map[string]int)
155
156 _, err := r.Rewritescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/Rewriter#Rewrite().(&RewriteOptionsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#{Includescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#Include.: []string{"refs/heads/master"},
157 BlobFnscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#BlobFn.: func(path string, b *gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#) (*gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#, error) {
158 seen[path] = seen[path] + 1
159
160 return b, nil
161 },
162 })
163
164 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, err)
165
166 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, 2, seen["a.txt"])
167 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, 1, seen["subdir/b.txt"])
168 }
169
170 func TestRewriterVisitsUniqueEntriesWithIdenticalContentsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/TestRewriterVisitsUniqueEntriesWithIdenticalContents().(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#) {
171 db := DatabaseFromFixturescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/DatabaseFromFixture().(t, "identical-blobs.git")
172 r := NewRewriterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/NewRewriter().(db)
173
174 tip, err := r.Rewritescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/Rewriter#Rewrite().(&RewriteOptionsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#{Includescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#Include.: []string{"refs/heads/master"},
175 BlobFnscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#BlobFn.: func(path string, b *gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#) (*gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#, error) {
176 if path == "b.txt" {
177 return b, nil
178 }
179
180 return &gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#{
181 Contentsscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#Contents.: stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.25.0 strings/NewReader().("changed"),
182 Sizescip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#Size.: int64(len("changed")),
183 }, nil
184 },
185 })
186
187 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, err)
188
189 tree := "bbbe0a7676523ae02234bfe874784ca2380c2d4b"
190
191 AssertCommitTreescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertCommitTree().(t, db, hexscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/.EncodeToStringscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/EncodeToString().(tip), tree)
192
193 // After rewriting, the HEAD state of the repository should contain a
194 // tree identical to:
195 //
196 // 100644 blob 21fb1eca31e64cd3914025058b21992ab76edcf9 a.txt
197 // 100644 blob 94f3610c08588440112ed977376f26a8fba169b0 b.txt
198
199 AssertBlobContentsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertBlobContents().(t, db, tree, "a.txt", "changed")
200 AssertBlobContentsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertBlobContents().(t, db, tree, "b.txt", "original")
201 }
202
203 func TestRewriterIgnoresPathsThatDontMatchFilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/TestRewriterIgnoresPathsThatDontMatchFilter().(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#) {
204 include := []string{"*.txt"}
205 exclude := []string{"subdir/*.txt"}
206
207 filter := filepathfilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/New().(include, exclude, filepathfilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/.GitIgnorescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/GitIgnore., nil)
208
209 db := DatabaseFromFixturescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/DatabaseFromFixture().(t, "non-repeated-subtrees.git")
210 r := NewRewriterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/NewRewriter().(db, WithFilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/WithFilter.(filter))
211
212 seen := make(map[string]int)
213
214 _, err := r.Rewritescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/Rewriter#Rewrite().(&RewriteOptionsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#{Includescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#Include.: []string{"refs/heads/master"},
215 BlobFnscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#BlobFn.: func(path string, b *gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#) (*gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#, error) {
216 seen[path] = seen[path] + 1
217
218 return b, nil
219 },
220 })
221
222 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, err)
223 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, 1, seen["a.txt"])
224 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, 0, seen["subdir/b.txt"])
225 }
226
227 func TestRewriterIgnoresPathsThatDontMatchFilterWithResultCachingscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/TestRewriterIgnoresPathsThatDontMatchFilterWithResultCaching().(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#) {
228 include := []string{"*.txt"}
229 exclude := []string{"subdir/*.txt"}
230
231 filter := filepathfilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/New().(include, exclude, filepathfilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/.GitIgnorescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/GitIgnore., nil, filepathfilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/.EnableCachescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/EnableCache().(10))
232
233 db := DatabaseFromFixturescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/DatabaseFromFixture().(t, "non-repeated-subtrees.git")
234 r := NewRewriterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/NewRewriter().(db, WithFilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/WithFilter.(filter))
235
236 seen := make(map[string]int)
237
238 _, err := r.Rewritescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/Rewriter#Rewrite().(&RewriteOptionsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#{Includescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#Include.: []string{"refs/heads/master"},
239 BlobFnscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#BlobFn.: func(path string, b *gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#) (*gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#, error) {
240 seen[path] = seen[path] + 1
241
242 return b, nil
243 },
244 })
245
246 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, err)
247 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, 1, seen["a.txt"])
248 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, 0, seen["subdir/b.txt"])
249 }
250
251 func TestRewriterAllowsAdditionalTreeEntriesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/TestRewriterAllowsAdditionalTreeEntries().(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#) {
252 db := DatabaseFromFixturescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/DatabaseFromFixture().(t, "linear-history.git")
253 r := NewRewriterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/NewRewriter().(db)
254
255 extra, err := db.WriteBlobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/ObjectDatabase#WriteBlob().(&gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#{
256 Contentsscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#Contents.: stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.25.0 strings/NewReader().("extra\n"),
257 Sizescip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#Size.: int64(len("extra\n")),
258 })
259 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, err)
260
261 tip, err := r.Rewritescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/Rewriter#Rewrite().(&RewriteOptionsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#{Includescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#Include.: []string{"refs/heads/master"},
262 BlobFnscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#BlobFn.: func(path string, b *gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#) (*gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#, error) {
263 return b, nil
264 },
265
266 TreeCallbackFnscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#TreeCallbackFn.: func(path string, tr *gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Treescip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Tree#) (*gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Treescip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Tree#, error) {
267 return &gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Treescip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Tree#{
268 Entriesscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Tree#Entries.: append(tr.Entriesscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Tree#Entries., &gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.TreeEntryscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/TreeEntry#{
269 Namescip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/TreeEntry#Name.: "extra.txt",
270 Filemodescip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/TreeEntry#Filemode.: 0100644,
271 Oidscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/TreeEntry#Oid.: extra,
272 }),
273 }, nil
274 },
275 })
276
277 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, err)
278
279 tree1 := "40c2eb627a3b8e84b82a47a973d32960f3898b6a"
280 tree2 := "d7a5bcb69f2cd2652a014663a948952ea603c2c0"
281 tree3 := "45b752554d128f85bf23d7c3ddf48c47cbc345c8"
282
283 // After rewriting, the HEAD state of the repository should contain a
284 // tree identical to:
285 //
286 // 100644 blob e440e5c842586965a7fb77deda2eca68612b1f53 hello.txt
287 // 100644 blob 0f2287157f7cb0dd40498c7a92f74b6975fa2d57 extra.txt
288
289 AssertCommitTreescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertCommitTree().(t, db, hexscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/.EncodeToStringscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/EncodeToString().(tip), tree1)
290
291 AssertBlobContentsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertBlobContents().(t, db, tree1, "hello.txt", "3")
292 AssertBlobContentsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertBlobContents().(t, db, tree1, "extra.txt", "extra\n")
293
294 // After rewriting, the HEAD~1 state of the repository should contain a
295 // tree identical to:
296 //
297 // 100644 blob d8263ee9860594d2806b0dfd1bfd17528b0ba2a4 hello.txt
298 // 100644 blob 0f2287157f7cb0dd40498c7a92f74b6975fa2d57 extra.txt
299
300 AssertCommitParentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertCommitParent().(t, db, hexscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/.EncodeToStringscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/EncodeToString().(tip), "45af5deb9a25bc4069b15c1f5bdccb0340978707")
301 AssertCommitTreescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertCommitTree().(t, db, "45af5deb9a25bc4069b15c1f5bdccb0340978707", tree2)
302
303 AssertBlobContentsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertBlobContents().(t, db, tree2, "hello.txt", "2")
304 AssertBlobContentsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertBlobContents().(t, db, tree2, "extra.txt", "extra\n")
305
306 // After rewriting, the HEAD~2 state of the repository should contain a
307 // tree identical to:
308 //
309 // 100644 blob 56a6051ca2b02b04ef92d5150c9ef600403cb1de hello.txt
310 // 100644 blob 0f2287157f7cb0dd40498c7a92f74b6975fa2d57 extra.txt
311
312 AssertCommitParentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertCommitParent().(t, db, "45af5deb9a25bc4069b15c1f5bdccb0340978707", "99f6bd7cd69b45494afed95b026f3e450de8304f")
313 AssertCommitTreescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertCommitTree().(t, db, "99f6bd7cd69b45494afed95b026f3e450de8304f", tree3)
314
315 AssertBlobContentsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertBlobContents().(t, db, tree3, "hello.txt", "1")
316 AssertBlobContentsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertBlobContents().(t, db, tree3, "extra.txt", "extra\n")
317 }
318
319 // CallbackCall is a structure recording information pertinent to when a
320 // *githistory.Rewrite called either BlobFn, TreePreCallbackFn, or
321 // TreeCallbackFn.
322 type CallbackCallscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall# struct {
323 Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Type. string
324 Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Path. string
325 }
326
327 var (
328 // collectCalls is a function that returns a *RewriteOptions that
329 // updates a pointer to a slice of `*CallbackCall`'s with each call that
330 // is received.
331 collectCallsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/collectCalls. = func(callsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/collectCalls:calls. *[]*CallbackCallscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#) *RewriteOptionsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions# {
332 return &RewriteOptionsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#{Includescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#Include.: []string{"refs/heads/master"},
333 BlobFnscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#BlobFn.: func(pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/collectCalls:path. string, bscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/collectCalls:b. *gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#) (*gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#, error) {
334 *callsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/collectCalls:calls. = append(*callsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/collectCalls:calls., &CallbackCallscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#{
335 Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Type.: "blob",
336 Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Path.: pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/collectCalls:path.,
337 })
338 return bscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/collectCalls:b., nil
339 },
340
341 TreePreCallbackFnscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#TreePreCallbackFn.: func(pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/collectCalls:path. string, tscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/collectCalls:t. *gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Treescip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Tree#) error {
342 *callsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/collectCalls:calls. = append(*callsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/collectCalls:calls., &CallbackCallscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#{
343 Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Type.: "tree-pre",
344 Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Path.: pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/collectCalls:path.,
345 })
346 return nil
347 },
348
349 TreeCallbackFnscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#TreeCallbackFn.: func(pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/collectCalls:path. string, tscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/collectCalls:t. *gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Treescip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Tree#) (*gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Treescip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Tree#, error) {
350 *callsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/collectCalls:calls. = append(*callsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/collectCalls:calls., &CallbackCallscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#{
351 Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Type.: "tree-post",
352 Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Path.: pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/collectCalls:path.,
353 })
354 return tscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/collectCalls:t., nil
355 },
356 }
357 }
358 )
359
360 func TestHistoryRewriterCallbacksscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/TestHistoryRewriterCallbacks().(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#) {
361 var calls []*CallbackCallscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#
362
363 db := DatabaseFromFixturescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/DatabaseFromFixture().(t, "linear-history.git")
364 r := NewRewriterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/NewRewriter().(db)
365
366 _, err := r.Rewritescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/Rewriter#Rewrite().(collectCallsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/collectCalls.(&calls))
367
368 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, err)
369
370 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Lenscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Len().(t, calls, 9)
371 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, calls[0], &CallbackCallscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#{Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Type.: "tree-pre", Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Path.: "/"})
372 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, calls[1], &CallbackCallscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#{Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Type.: "blob", Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Path.: "hello.txt"})
373 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, calls[2], &CallbackCallscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#{Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Type.: "tree-post", Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Path.: "/"})
374 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, calls[3], &CallbackCallscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#{Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Type.: "tree-pre", Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Path.: "/"})
375 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, calls[4], &CallbackCallscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#{Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Type.: "blob", Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Path.: "hello.txt"})
376 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, calls[5], &CallbackCallscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#{Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Type.: "tree-post", Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Path.: "/"})
377 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, calls[6], &CallbackCallscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#{Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Type.: "tree-pre", Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Path.: "/"})
378 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, calls[7], &CallbackCallscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#{Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Type.: "blob", Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Path.: "hello.txt"})
379 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, calls[8], &CallbackCallscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#{Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Type.: "tree-post", Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Path.: "/"})
380 }
381
382 func TestHistoryRewriterCallbacksSubtreesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/TestHistoryRewriterCallbacksSubtrees().(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#) {
383 var calls []*CallbackCallscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#
384
385 db := DatabaseFromFixturescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/DatabaseFromFixture().(t, "non-repeated-subtrees.git")
386 r := NewRewriterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/NewRewriter().(db)
387
388 _, err := r.Rewritescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/Rewriter#Rewrite().(collectCallsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/collectCalls.(&calls))
389
390 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, err)
391
392 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Lenscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Len().(t, calls, 8)
393 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, calls[0], &CallbackCallscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#{Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Type.: "tree-pre", Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Path.: "/"})
394 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, calls[1], &CallbackCallscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#{Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Type.: "blob", Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Path.: "a.txt"})
395 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, calls[2], &CallbackCallscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#{Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Type.: "tree-post", Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Path.: "/"})
396 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, calls[3], &CallbackCallscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#{Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Type.: "tree-pre", Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Path.: "/"})
397 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, calls[4], &CallbackCallscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#{Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Type.: "tree-pre", Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Path.: "/subdir"})
398 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, calls[5], &CallbackCallscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#{Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Type.: "blob", Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Path.: "subdir/b.txt"})
399 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, calls[6], &CallbackCallscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#{Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Type.: "tree-post", Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Path.: "/subdir"})
400 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, calls[7], &CallbackCallscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#{Typescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Type.: "tree-post", Pathscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/CallbackCall#Path.: "/"})
401 }
402
403 func TestHistoryRewriterTreePreCallbackPropagatesErrorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/TestHistoryRewriterTreePreCallbackPropagatesErrors().(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#) {
404 expected := errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/New().("my error")
405
406 db := DatabaseFromFixturescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/DatabaseFromFixture().(t, "linear-history.git")
407 r := NewRewriterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/NewRewriter().(db)
408
409 _, err := r.Rewritescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/Rewriter#Rewrite().(&RewriteOptionsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#{Includescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#Include.: []string{"refs/heads/master"},
410 BlobFnscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#BlobFn.: func(path string, b *gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#) (*gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#, error) {
411 return b, nil
412 },
413
414 TreePreCallbackFnscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#TreePreCallbackFn.: func(path string, t *gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Treescip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Tree#) error {
415 return expected
416 },
417 })
418
419 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, err, expected)
420 }
421
422 func TestHistoryRewriterUseOriginalParentsForPartialMigrationscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/TestHistoryRewriterUseOriginalParentsForPartialMigration().(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#) {
423 db := DatabaseFromFixturescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/DatabaseFromFixture().(t, "linear-history-with-tags.git")
424 r := NewRewriterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/NewRewriter().(db)
425
426 tip, err := r.Rewritescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/Rewriter#Rewrite().(&RewriteOptionsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#{
427 Includescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#Include.: []string{"refs/heads/master"},
428 Excludescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#Exclude.: []string{"refs/tags/middle"},
429
430 BlobFnscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#BlobFn.: func(path string, b *gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#) (*gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#, error) {
431 return b, nil
432 },
433 })
434
435 // After rewriting, the rewriter should have only modified the latest
436 // commit (HEAD), and excluded the first two, both reachable by
437 // refs/tags/middle.
438 //
439 // This should modify one commit, and appropriately link the parent as
440 // follows:
441 //
442 // tree 20ecedad3e74a113695fe5f00ab003694e2e1e9c
443 // parent 228afe30855933151f7a88e70d9d88314fd2f191
444 // author Taylor Blau <[email protected]> 1496954214 -0600
445 // committer Taylor Blau <[email protected]> 1496954214 -0600
446 //
447 // some.txt: c
448
449 expectedParent := "228afe30855933151f7a88e70d9d88314fd2f191"
450
451 assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.NoErrorscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/NoError().(t, err)
452 AssertCommitParentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertCommitParent().(t, db, hexscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/.EncodeToStringscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/EncodeToString().(tip), expectedParent)
453 }
454
455 func TestHistoryRewriterUpdatesRefsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/TestHistoryRewriterUpdatesRefs().(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#) {
456 db := DatabaseFromFixturescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/DatabaseFromFixture().(t, "linear-history.git")
457 r := NewRewriterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/NewRewriter().(db)
458
459 AssertRefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertRef().(t, db,
460 "refs/heads/master", HexDecodescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/HexDecode().(t, "e669b63f829bfb0b91fc52a5bcea53dd7977a0ee"))
461
462 tip, err := r.Rewritescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/Rewriter#Rewrite().(&RewriteOptionsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#{
463 Includescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#Include.: []string{"refs/heads/master"},
464
465 UpdateRefsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#UpdateRefs.: true,
466
467 BlobFnscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/RewriteOptions#BlobFn.: func(path string, b *gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#) (*gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#, error) {
468 suffix := stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.NewReaderscip-go gomod github.com/golang/go/src go1.25.0 strings/NewReader().("_suffix")
469
470 return &gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.Blobscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#{
471 Contentsscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#Contents.: ioscip-go gomod github.com/golang/go/src go1.25.0 io/.MultiReaderscip-go gomod github.com/golang/go/src go1.25.0 io/MultiReader().(b.Contentsscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#Contents., suffix),
472 Sizescip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#Size.: b.Sizescip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/Blob#Size. + int64(suffix.Lenscip-go gomod github.com/golang/go/src go1.25.0 strings/Reader#Len().()),
473 }, nil
474 },
475 })
476
477 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, err)
478
479 c1 := hexscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/.EncodeToStringscip-go gomod github.com/golang/go/src go1.25.0 `encoding/hex`/EncodeToString().(tip)
480 c2 := "66561fe3ae68651658e18e48053dcfe66a2e9da1"
481 c3 := "8268d8486c48024a871fa42fc487dbeabd6e3d86"
482
483 AssertRefscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertRef().(t, db, "refs/heads/master", tip)
484
485 AssertCommitParentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertCommitParent().(t, db, c1, c2)
486 AssertCommitParentscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/AssertCommitParent().(t, db, c2, c3)
487 }
488
489 func TestHistoryRewriterReturnsFilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/TestHistoryRewriterReturnsFilter().(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#) {
490 f := filepathfilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/New().([]string{"a"}, []string{"b"}, filepathfilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/.GitIgnorescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/filepathfilter`/GitIgnore., nil)
491 r := NewRewriterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/NewRewriter().(nil, WithFilterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/WithFilter.(f))
492
493 expected := reflectscip-go gomod github.com/golang/go/src go1.25.0 reflect/.ValueOfscip-go gomod github.com/golang/go/src go1.25.0 reflect/ValueOf().(f).Elemscip-go gomod github.com/golang/go/src go1.25.0 reflect/Value#Elem().().Addrscip-go gomod github.com/golang/go/src go1.25.0 reflect/Value#Addr().().Pointerscip-go gomod github.com/golang/go/src go1.25.0 reflect/Value#Pointer().()
494 got := reflectscip-go gomod github.com/golang/go/src go1.25.0 reflect/.ValueOfscip-go gomod github.com/golang/go/src go1.25.0 reflect/ValueOf().(r.Filterscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/Rewriter#Filter().()).Elemscip-go gomod github.com/golang/go/src go1.25.0 reflect/Value#Elem().().Addrscip-go gomod github.com/golang/go/src go1.25.0 reflect/Value#Addr().().Pointerscip-go gomod github.com/golang/go/src go1.25.0 reflect/Value#Pointer().()
495
496 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, expected, got,
497 "git/githistory: expected Rewriter.Filter() to return same *filepathfilter.Filter instance")
498 }
499
500 // debug is meant to be called from a defer statement to aide in debugging a
501 // test failure among any in this file.
502 //
503 // Callers are expected to call it immediately after calling the Rewrite()
504 // function.
505 func debugscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/git/githistory`/debug().(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#, db *gitobjscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/.ObjectDatabasescip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/ObjectDatabase#, tip []byte, err error) {
506 root, ok := db.Rootscip-go gomod github.com/git-lfs/gitobj/v2 v2.1.1 `github.com/git-lfs/gitobj/v2`/ObjectDatabase#Root().()
507
508 t.Logscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Log().(stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Repeatscip-go gomod github.com/golang/go/src go1.25.0 strings/Repeat().("*", 80))
509 t.Logfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Logf().("* root=%s, ok=%t\n", root, ok)
510 t.Logfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Logf().("* tip=%x\n", tip)
511 t.Logfscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Logf().("* err=%s\n", err)
512 t.Logscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Log().(stringsscip-go gomod github.com/golang/go/src go1.25.0 strings/.Repeatscip-go gomod github.com/golang/go/src go1.25.0 strings/Repeat().("*", 80))
513 }