aboutsummaryrefslogtreecommitdiffstats
path: root/remote_test.go
diff options
context:
space:
mode:
Diffstat (limited to 'remote_test.go')
-rw-r--r--remote_test.go31
1 files changed, 30 insertions, 1 deletions
diff --git a/remote_test.go b/remote_test.go
index 6766514..0fc3449 100644
--- a/remote_test.go
+++ b/remote_test.go
@@ -20,8 +20,8 @@ import (
"github.com/go-git/go-git/v5/storage/memory"
"github.com/go-git/go-billy/v5/osfs"
- . "gopkg.in/check.v1"
fixtures "github.com/go-git/go-git-fixtures/v4"
+ . "gopkg.in/check.v1"
)
type RemoteSuite struct {
@@ -71,6 +71,35 @@ func (s *RemoteSuite) TestFetchWildcard(c *C) {
})
}
+func (s *RemoteSuite) TestFetchExactSHA1(c *C) {
+ r := NewRemote(memory.NewStorage(), &config.RemoteConfig{
+ URLs: []string{"https://github.com/git-fixtures/basic.git"},
+ })
+
+ s.testFetch(c, r, &FetchOptions{
+ RefSpecs: []config.RefSpec{
+ config.RefSpec("35e85108805c84807bc66a02d91535e1e24b38b9:refs/heads/foo"),
+ },
+ }, []*plumbing.Reference{
+ plumbing.NewReferenceFromStrings("refs/heads/foo", "35e85108805c84807bc66a02d91535e1e24b38b9"),
+ })
+}
+
+func (s *RemoteSuite) TestFetchExactSHA1_NotSoported(c *C) {
+ r := NewRemote(memory.NewStorage(), &config.RemoteConfig{
+ URLs: []string{s.GetBasicLocalRepositoryURL()},
+ })
+
+ err := r.Fetch(&FetchOptions{
+ RefSpecs: []config.RefSpec{
+ config.RefSpec("35e85108805c84807bc66a02d91535e1e24b38b9:refs/heads/foo"),
+ },
+ })
+
+ c.Assert(err, Equals, ErrExactSHA1NotSupported)
+
+}
+
func (s *RemoteSuite) TestFetchWildcardTags(c *C) {
r := NewRemote(memory.NewStorage(), &config.RemoteConfig{
URLs: []string{s.GetLocalRepositoryURL(fixtures.ByTag("tags").One())},