2014-02-27 18:36:44 -06:00
|
|
|
package git
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
2014-12-12 17:25:11 -06:00
|
|
|
func TestRemotePush(t *testing.T) {
|
2016-08-27 12:21:05 -05:00
|
|
|
t.Parallel()
|
2014-12-12 17:25:11 -06:00
|
|
|
repo := createBareTestRepo(t)
|
2015-04-24 05:59:29 -05:00
|
|
|
defer cleanupTestRepo(t, repo)
|
|
|
|
|
2014-12-12 17:25:11 -06:00
|
|
|
localRepo := createTestRepo(t)
|
2015-04-24 05:59:29 -05:00
|
|
|
defer cleanupTestRepo(t, localRepo)
|
2014-12-12 17:25:11 -06:00
|
|
|
|
2015-06-27 17:51:17 -05:00
|
|
|
remote, err := localRepo.Remotes.Create("test_push", repo.Path())
|
2014-12-12 17:25:11 -06:00
|
|
|
checkFatal(t, err)
|
|
|
|
|
|
|
|
seedTestRepo(t, localRepo)
|
|
|
|
|
2015-03-14 19:49:32 -05:00
|
|
|
err = remote.Push([]string{"refs/heads/master"}, nil)
|
2014-12-12 17:25:11 -06:00
|
|
|
checkFatal(t, err)
|
|
|
|
|
2015-06-27 18:12:32 -05:00
|
|
|
_, err = localRepo.References.Lookup("refs/remotes/test_push/master")
|
2014-12-12 17:25:11 -06:00
|
|
|
checkFatal(t, err)
|
|
|
|
|
2015-06-27 18:12:32 -05:00
|
|
|
_, err = repo.References.Lookup("refs/heads/master")
|
2014-12-12 17:25:11 -06:00
|
|
|
checkFatal(t, err)
|
|
|
|
}
|