Removed file git history (#128)
This commit is contained in:
parent
57f7843ae1
commit
5eb33f8675
9 changed files with 171 additions and 44 deletions
|
@ -3,8 +3,8 @@ package git_test
|
|||
import (
|
||||
"testing"
|
||||
|
||||
git "github.com/go-git/go-git/v5"
|
||||
"github.com/stretchr/testify/assert"
|
||||
git "gopkg.in/src-d/go-git.v4"
|
||||
|
||||
gitutil "github.com/mattermost/mattermost-plugin-starter-template/build/sync/plan/git"
|
||||
)
|
||||
|
@ -16,6 +16,7 @@ func TestFileHistory(t *testing.T) {
|
|||
DetectDotGit: true,
|
||||
})
|
||||
assert.Nil(err)
|
||||
|
||||
sums, err := gitutil.FileHistory("build/sync/plan/git/testdata/testfile.txt", repo)
|
||||
assert.Nil(err)
|
||||
assert.Contains(sums, "ba7192052d7cf77c55d3b7bf40b350b8431b208b")
|
||||
|
@ -24,4 +25,9 @@ func TestFileHistory(t *testing.T) {
|
|||
sums, err = gitutil.FileHistory("build/sync/plan/git/testdata/nosuch_testfile.txt", repo)
|
||||
assert.Equal(gitutil.ErrNotFound, err)
|
||||
assert.Nil(sums)
|
||||
|
||||
// Calling with a non-existent file that was in git history returns no error.
|
||||
sums, err = gitutil.FileHistory("build/sync/plan/git/testdata/removedfile.txt", repo)
|
||||
assert.Nil(err)
|
||||
assert.Equal([]string{"213df5d04c108c99d3ec9ffe43a53f638f0ede0b"}, sums)
|
||||
}
|
||||
|
|
Reference in a new issue