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) {
|
|
|
|
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
|
|
|
|
|
|
|
remote, err := localRepo.CreateRemote("test_push", repo.Path())
|
|
|
|
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)
|
|
|
|
|
|
|
|
_, err = localRepo.LookupReference("refs/remotes/test_push/master")
|
|
|
|
checkFatal(t, err)
|
|
|
|
|
|
|
|
_, err = repo.LookupReference("refs/heads/master")
|
|
|
|
checkFatal(t, err)
|
|
|
|
}
|