| 1 | package lfs_testscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs_test`/ // to avoid import cycles |
| 2 | |
| 3 | // This is for doing complete git-level tests using test utils |
| 4 | // Needs to be a separate file from scanner_test so that we can use a diff package |
| 5 | // which avoids import cycles with testutils |
| 6 | |
| 7 | import ( |
| 8 | "sortscip-go gomod github.com/golang/go/src go1.25.0 sort/" |
| 9 | "testingscip-go gomod github.com/golang/go/src go1.25.0 testing/" |
| 10 | "timescip-go gomod github.com/golang/go/src go1.25.0 time/" |
| 11 | |
| 12 | "github.com/git-lfs/git-lfs/v3/configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/" |
| 13 | "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`/" |
| 14 | . "github.com/git-lfs/git-lfs/v3/lfsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/" |
| 15 | testscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/ "github.com/git-lfs/git-lfs/v3/t/cmd/utilscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/" |
| 16 | "github.com/stretchr/testify/assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/" |
| 17 | ) |
| 18 | |
| 19 | func TestScanUnpushedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs_test`/TestScanUnpushed().(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#) { |
| 20 | repo := testscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/.NewReposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/NewRepo().(t) |
| 21 | repo.Pushdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Pushd().() |
| 22 | defer func() { |
| 23 | repo.Popdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Popd().() |
| 24 | repo.Cleanupscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Cleanup().() |
| 25 | }() |
| 26 | |
| 27 | inputs := []*testscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/.CommitInputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#{ |
| 28 | { // 0 |
| 29 | Filesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#Files.: []*testscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/.FileInputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#{ |
| 30 | {Filenamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Filename.: "file1.txt", Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Size.: 20}, |
| 31 | }, |
| 32 | }, |
| 33 | { // 1 |
| 34 | NewBranchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#NewBranch.: "branch2", |
| 35 | Filesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#Files.: []*testscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/.FileInputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#{ |
| 36 | {Filenamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Filename.: "file1.txt", Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Size.: 25}, |
| 37 | }, |
| 38 | }, |
| 39 | { // 2 |
| 40 | ParentBranchesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#ParentBranches.: []string{"master"}, // back on master |
| 41 | Filesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#Files.: []*testscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/.FileInputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#{ |
| 42 | {Filenamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Filename.: "file1.txt", Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Size.: 30}, |
| 43 | }, |
| 44 | }, |
| 45 | { // 3 |
| 46 | NewBranchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#NewBranch.: "branch3", |
| 47 | Filesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#Files.: []*testscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/.FileInputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#{ |
| 48 | {Filenamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Filename.: "file1.txt", Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Size.: 32}, |
| 49 | }, |
| 50 | }, |
| 51 | } |
| 52 | repo.AddCommitsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#AddCommits().(inputs) |
| 53 | |
| 54 | // Add a couple of remotes and test state depending on what's pushed |
| 55 | repo.AddRemotescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#AddRemote().("origin") |
| 56 | repo.AddRemotescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#AddRemote().("upstream") |
| 57 | |
| 58 | pointers, err := scanUnpushedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs_test`/scanUnpushed().("") |
| 59 | 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, "Should be no error calling ScanUnpushed") |
| 60 | 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, pointers, 4, "Should be 4 pointers because none pushed") |
| 61 | |
| 62 | testscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/.RunGitCommandscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RunGitCommand().(t, true, "push", "origin", "branch2") |
| 63 | // Branch2 will have pushed 2 commits |
| 64 | pointers, err = scanUnpushedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs_test`/scanUnpushed().("") |
| 65 | 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, "Should be no error calling ScanUnpushed") |
| 66 | 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, pointers, 2, "Should be 2 pointers") |
| 67 | |
| 68 | testscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/.RunGitCommandscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RunGitCommand().(t, true, "push", "upstream", "master") |
| 69 | // Master pushes 1 more commit |
| 70 | pointers, err = scanUnpushedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs_test`/scanUnpushed().("") |
| 71 | 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, "Should be no error calling ScanUnpushed") |
| 72 | 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, pointers, 1, "Should be 1 pointer") |
| 73 | |
| 74 | testscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/.RunGitCommandscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/RunGitCommand().(t, true, "push", "origin", "branch3") |
| 75 | // All pushed (somewhere) |
| 76 | pointers, err = scanUnpushedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs_test`/scanUnpushed().("") |
| 77 | 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, "Should be no error calling ScanUnpushed") |
| 78 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Emptyscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Empty().(t, pointers, "Should be 0 pointers unpushed") |
| 79 | |
| 80 | // Check origin |
| 81 | pointers, err = scanUnpushedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs_test`/scanUnpushed().("origin") |
| 82 | 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, "Should be no error calling ScanUnpushed") |
| 83 | assertscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/.Emptyscip-go gomod github.com/stretchr/testify v1.11.1 `github.com/stretchr/testify/assert`/Empty().(t, pointers, "Should be 0 pointers unpushed to origin") |
| 84 | |
| 85 | // Check upstream |
| 86 | pointers, err = scanUnpushedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs_test`/scanUnpushed().("upstream") |
| 87 | 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, "Should be no error calling ScanUnpushed") |
| 88 | 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, pointers, 2, "Should be 2 pointers unpushed to upstream") |
| 89 | } |
| 90 | |
| 91 | func scanUnpushedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs_test`/scanUnpushed().(remoteName string) ([]*WrappedPointerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/WrappedPointer#, error) { |
| 92 | pointers := make([]*WrappedPointerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/WrappedPointer#, 0, 10) |
| 93 | var multiErr error |
| 94 | |
| 95 | gitscanner := NewGitScannerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/NewGitScanner().(configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/New().(), func(p *WrappedPointerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/WrappedPointer#, err error) { |
| 96 | if err != nil { |
| 97 | multiErr = errorsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/.Joinscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/errors`/Join().(multiErr, err) |
| 98 | return |
| 99 | } |
| 100 | |
| 101 | pointers = append(pointers, p) |
| 102 | }) |
| 103 | |
| 104 | if err := gitscanner.ScanUnpushedscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/GitScanner#ScanUnpushed().(remoteName, nil); err != nil { |
| 105 | return nil, err |
| 106 | } |
| 107 | |
| 108 | return pointers, multiErr |
| 109 | } |
| 110 | |
| 111 | func TestScanPreviousVersionsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs_test`/TestScanPreviousVersions().(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#) { |
| 112 | repo := testscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/.NewReposcip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/NewRepo().(t) |
| 113 | repo.Pushdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Pushd().() |
| 114 | defer func() { |
| 115 | repo.Popdscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Popd().() |
| 116 | repo.Cleanupscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#Cleanup().() |
| 117 | }() |
| 118 | |
| 119 | now := timescip-go gomod github.com/golang/go/src go1.25.0 time/.Nowscip-go gomod github.com/golang/go/src go1.25.0 time/Now().() |
| 120 | |
| 121 | inputs := []*testscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/.CommitInputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#{ |
| 122 | { // 0 |
| 123 | CommitDatescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#CommitDate.: now.AddDatescip-go gomod github.com/golang/go/src go1.25.0 time/Time#AddDate().(0, 0, -20), |
| 124 | Filesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#Files.: []*testscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/.FileInputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#{ |
| 125 | {Filenamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Filename.: "file1.txt", Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Size.: 20}, |
| 126 | {Filenamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Filename.: "file2.txt", Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Size.: 30}, |
| 127 | {Filenamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Filename.: "folder/nested.txt", Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Size.: 40}, |
| 128 | {Filenamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Filename.: "folder/nested2.txt", Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Size.: 31}, |
| 129 | }, |
| 130 | }, |
| 131 | { // 1 |
| 132 | CommitDatescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#CommitDate.: now.AddDatescip-go gomod github.com/golang/go/src go1.25.0 time/Time#AddDate().(0, 0, -10), |
| 133 | Filesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#Files.: []*testscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/.FileInputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#{ |
| 134 | {Filenamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Filename.: "file2.txt", Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Size.: 22}, |
| 135 | }, |
| 136 | }, |
| 137 | { // 2 |
| 138 | NewBranchscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#NewBranch.: "excluded", |
| 139 | CommitDatescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#CommitDate.: now.AddDatescip-go gomod github.com/golang/go/src go1.25.0 time/Time#AddDate().(0, 0, -6), |
| 140 | Filesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#Files.: []*testscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/.FileInputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#{ |
| 141 | {Filenamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Filename.: "file2.txt", Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Size.: 12}, |
| 142 | {Filenamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Filename.: "folder/nested2.txt", Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Size.: 16}, |
| 143 | }, |
| 144 | }, |
| 145 | { // 3 |
| 146 | ParentBranchesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#ParentBranches.: []string{"master"}, |
| 147 | CommitDatescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#CommitDate.: now.AddDatescip-go gomod github.com/golang/go/src go1.25.0 time/Time#AddDate().(0, 0, -4), |
| 148 | Filesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#Files.: []*testscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/.FileInputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#{ |
| 149 | {Filenamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Filename.: "folder/nested.txt", Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Size.: 42}, |
| 150 | {Filenamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Filename.: "folder/nested2.txt", Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Size.: 6}, |
| 151 | }, |
| 152 | }, |
| 153 | { // 4 |
| 154 | Filesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitInput#Files.: []*testscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/.FileInputscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#{ |
| 155 | {Filenamescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Filename.: "folder/nested.txt", Sizescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/FileInput#Size.: 22}, |
| 156 | }, |
| 157 | }, |
| 158 | } |
| 159 | outputs := repo.AddCommitsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/Repo#AddCommits().(inputs) |
| 160 | |
| 161 | // Previous commits excludes final state of each file, which is: |
| 162 | // file1.txt [0] (unchanged since first commit so excluded) |
| 163 | // file2.txt [1] (because [2] is on another branch so excluded) |
| 164 | // folder/nested.txt [4] (updated at last commit) |
| 165 | // folder/nested2.txt [3] |
| 166 | |
| 167 | // The only changes which will be included are changes prior to final state |
| 168 | // where the '-' side of the diff is inside the date range |
| 169 | |
| 170 | // 7 day limit excludes [0] commit, but includes state from that if there |
| 171 | // was a subsequent chang |
| 172 | pointers, err := scanPreviousVersionsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs_test`/scanPreviousVersions().(t, "master", now.AddDatescip-go gomod github.com/golang/go/src go1.25.0 time/Time#AddDate().(0, 0, -7)) |
| 173 | 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, nil, err) |
| 174 | |
| 175 | // Includes the following 'before' state at commits: |
| 176 | // folder/nested.txt [-diff at 4, ie 3, -diff at 3 ie 0] |
| 177 | // folder/nested2.txt [-diff at 3 ie 0] |
| 178 | // others are either on diff branches, before this window, or unchanged |
| 179 | expected := []*WrappedPointerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/WrappedPointer#{ |
| 180 | {Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/WrappedPointer#Name.: "folder/nested.txt", Pointerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/WrappedPointer#Pointer.: outputs[3].Filesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitOutput#Files.[0]}, |
| 181 | {Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/WrappedPointer#Name.: "folder/nested.txt", Pointerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/WrappedPointer#Pointer.: outputs[0].Filesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitOutput#Files.[2]}, |
| 182 | {Namescip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/WrappedPointer#Name.: "folder/nested2.txt", Pointerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/WrappedPointer#Pointer.: outputs[0].Filesscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/CommitOutput#Files.[3]}, |
| 183 | } |
| 184 | // Need to sort to compare equality |
| 185 | sortscip-go gomod github.com/golang/go/src go1.25.0 sort/.Sortscip-go gomod github.com/golang/go/src go1.25.0 sort/Sort().(testscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/.WrappedPointersByOidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/WrappedPointersByOid#(expected)) |
| 186 | sortscip-go gomod github.com/golang/go/src go1.25.0 sort/.Sortscip-go gomod github.com/golang/go/src go1.25.0 sort/Sort().(testscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/.WrappedPointersByOidscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/t/cmd/util`/WrappedPointersByOid#(pointers)) |
| 187 | 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, pointers) |
| 188 | } |
| 189 | |
| 190 | func scanPreviousVersionsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs_test`/scanPreviousVersions().(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#, ref string, since timescip-go gomod github.com/golang/go/src go1.25.0 time/.Timescip-go gomod github.com/golang/go/src go1.25.0 time/Time#) ([]*WrappedPointerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/WrappedPointer#, error) { |
| 191 | pointers := make([]*WrappedPointerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/WrappedPointer#, 0, 10) |
| 192 | gitscanner := NewGitScannerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/NewGitScanner().(configscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/.Newscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/config`/New().(), func(p *WrappedPointerscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/WrappedPointer#, err error) { |
| 193 | if err != nil { |
| 194 | t.Errorscip-go gomod github.com/golang/go/src go1.25.0 testing/common#Error().(err) |
| 195 | return |
| 196 | } |
| 197 | pointers = append(pointers, p) |
| 198 | }) |
| 199 | |
| 200 | err := gitscanner.ScanPreviousVersionsscip-go gomod github.com/git-lfs/git-lfs/v3 . `github.com/git-lfs/git-lfs/v3/lfs`/GitScanner#ScanPreviousVersions().(ref, since, nil) |
| 201 | return pointers, err |
| 202 | } |