@@ -3,6 +3,7 @@ package git
3
3
import (
4
4
"bytes"
5
5
"context"
6
+ "fmt"
6
7
"io"
7
8
"io/ioutil"
8
9
"os"
@@ -55,6 +56,37 @@ func (s *RemoteSuite) TestFetchInvalidFetchOptions(c *C) {
55
56
c .Assert (err , Equals , config .ErrRefSpecMalformedSeparator )
56
57
}
57
58
59
+ func (s * RemoteSuite ) TestFetchUnrelated (c * C ) {
60
+ fmt .Println (fixtures .RootFolder )
61
+ mem := memory .NewStorage ()
62
+ r1 := newRemote (mem , & config.RemoteConfig {
63
+ URLs : []string {s .GetBasicLocalRepositoryURL ()},
64
+ })
65
+ r2 := newRemote (mem , & config.RemoteConfig {
66
+ URLs : []string {s .GetLocalRepositoryURL (fixtures .ByTag ("tags" ).One ())},
67
+ })
68
+
69
+ // Fetch both repos into the same storage but under different remote names.
70
+ s .testFetch (c , r1 , & FetchOptions {
71
+ RefSpecs : []config.RefSpec {
72
+ config .RefSpec ("+refs/heads/master:refs/remotes/r1/master" ),
73
+ },
74
+ Depth : 1 ,
75
+ }, []* plumbing.Reference {
76
+ plumbing .NewReferenceFromStrings ("refs/remotes/r1/master" , "6ecf0ef2c2dffb796033e5a02219af86ec6584e5" ),
77
+ })
78
+ s .testFetch (c , r2 , & FetchOptions {
79
+ RefSpecs : []config.RefSpec {
80
+ config .RefSpec ("+refs/heads/master:refs/remotes/r2/master" ),
81
+ },
82
+ Depth : 1 ,
83
+ }, []* plumbing.Reference {
84
+ plumbing .NewReferenceFromStrings ("refs/remotes/r1/master" , "6ecf0ef2c2dffb796033e5a02219af86ec6584e5" ),
85
+ plumbing .NewReferenceFromStrings ("refs/remotes/r2/master" , "f7b877701fbf855b44c0a9e86f3fdce2c298b07f" ),
86
+ })
87
+
88
+ }
89
+
58
90
func (s * RemoteSuite ) TestFetchWildcard (c * C ) {
59
91
r := newRemote (memory .NewStorage (), & config.RemoteConfig {
60
92
URLs : []string {s .GetBasicLocalRepositoryURL ()},
0 commit comments