remove a couple uses of lfs.ScanRefsToChan()

This commit is contained in:
risk danger olson 2016-11-16 13:33:51 -07:00
parent 69d0548956
commit 6dd78c6bca
3 changed files with 16 additions and 3 deletions

@ -29,7 +29,8 @@ func doFsck() (bool, error) {
// All we care about is the pointer OID and file name
pointerIndex := make(map[string]string)
pointerCh, err := lfs.ScanRefsToChan(ref.Sha, "", nil)
gitscanner := lfs.NewGitScanner()
pointerCh, err := gitscanner.ScanRefWithDeleted(ref.Sha)
if err != nil {
return false, err
}

@ -18,6 +18,8 @@ func statusCommand(cmd *cobra.Command, args []string) {
// tolerate errors getting ref so this works before first commit
ref, _ := git.CurrentRef()
gitscanner := lfs.NewGitScanner()
scanIndexAt := "HEAD"
if ref == nil {
scanIndexAt = git.RefBeforeFirstCommit
@ -47,8 +49,7 @@ func statusCommand(cmd *cobra.Command, args []string) {
remoteRef, err := git.CurrentRemoteRef()
if err == nil {
pointerCh, err := lfs.ScanRefsToChan(ref.Sha, "^"+remoteRef.Sha, nil)
pointerCh, err := gitscanner.ScanRefRange(ref.Sha, "^"+remoteRef.Sha)
if err != nil {
Panic(err, "Could not scan for Git LFS objects")
}

@ -7,6 +7,17 @@ func NewGitScanner() *GitScanner {
return &GitScanner{}
}
func (s *GitScanner) ScanRefRange(left, right string) (*PointerChannelWrapper, error) {
opts := NewScanRefsOptions()
opts.ScanMode = ScanRefsMode
opts.SkipDeletedBlobs = false
return ScanRefsToChan(left, right, opts)
}
func (s *GitScanner) ScanRefWithDeleted(ref string) (*PointerChannelWrapper, error) {
return s.ScanRefRange(ref, "")
}
func (s *GitScanner) ScanRef(ref string) (*PointerChannelWrapper, error) {
opts := NewScanRefsOptions()
opts.ScanMode = ScanRefsMode