This repository was archived by the owner on Sep 11, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -1252,3 +1252,33 @@ func (s *WorktreeSuite) TestMoveToExistent(c *C) {
1252
1252
c .Assert (hash .IsZero (), Equals , true )
1253
1253
c .Assert (err , Equals , ErrDestinationExists )
1254
1254
}
1255
+
1256
+ func (s * WorktreeSuite ) TestAlternatesRepo (c * C ) {
1257
+ fs := fixtures .ByTag ("alternates" ).One ().Worktree ()
1258
+
1259
+ // Open 1st repo.
1260
+ rep1fs , err := fs .Chroot ("rep1" )
1261
+ c .Assert (err , IsNil )
1262
+ rep1 , err := PlainOpen (rep1fs .Root ())
1263
+ c .Assert (err , IsNil )
1264
+
1265
+ // Open 2nd repo.
1266
+ rep2fs , err := fs .Chroot ("rep2" )
1267
+ c .Assert (err , IsNil )
1268
+ rep2 , err := PlainOpen (rep2fs .Root ())
1269
+ c .Assert (err , IsNil )
1270
+
1271
+ // Get the HEAD commit from the main repo.
1272
+ h , err := rep1 .Head ()
1273
+ c .Assert (err , IsNil )
1274
+ commit1 , err := rep1 .CommitObject (h .Hash ())
1275
+ c .Assert (err , IsNil )
1276
+
1277
+ // Get the HEAD commit from the shared repo.
1278
+ h , err = rep2 .Head ()
1279
+ c .Assert (err , IsNil )
1280
+ commit2 , err := rep2 .CommitObject (h .Hash ())
1281
+ c .Assert (err , IsNil )
1282
+
1283
+ c .Assert (commit1 .String (), Equals , commit2 .String ())
1284
+ }
You can’t perform that action at this time.
0 commit comments