Removed file git history (#128)

This commit is contained in:
Domas Monkus 2020-10-09 10:52:05 +03:00 committed by GitHub
parent 57f7843ae1
commit 5eb33f8675
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 171 additions and 44 deletions

View file

@ -8,8 +8,10 @@ import (
"os"
"path/filepath"
git "gopkg.in/src-d/go-git.v4"
"gopkg.in/src-d/go-git.v4/plumbing/object"
git "github.com/go-git/go-git/v5"
"github.com/go-git/go-git/v5/plumbing"
"github.com/go-git/go-git/v5/plumbing/object"
"github.com/pkg/errors"
)
// ErrNotFound signifies the file was not found.
@ -22,6 +24,9 @@ func FileHistory(path string, repo *git.Repository) ([]string, error) {
FileName: &path,
}
commits, err := repo.Log(&logOpts)
if errors.Is(err, plumbing.ErrReferenceNotFound) {
return nil, ErrNotFound
}
if err != nil {
return nil, fmt.Errorf("failed to get commits for path %q: %v", path, err)
}