File: push_test.go

package info (click to toggle)
golang-github-libgit2-git2go 34.0.0-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 920 kB
  • sloc: ansic: 471; sh: 85; makefile: 39
file content (31 lines) | stat: -rw-r--r-- 643 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package git

import (
	"testing"
)

func TestRemotePush(t *testing.T) {
	t.Parallel()
	repo := createBareTestRepo(t)
	defer cleanupTestRepo(t, repo)

	localRepo := createTestRepo(t)
	defer cleanupTestRepo(t, localRepo)

	remote, err := localRepo.Remotes.Create("test_push", repo.Path())
	checkFatal(t, err)
	defer remote.Free()

	seedTestRepo(t, localRepo)

	err = remote.Push([]string{"refs/heads/master"}, nil)
	checkFatal(t, err)

	ref, err := localRepo.References.Lookup("refs/remotes/test_push/master")
	checkFatal(t, err)
	defer ref.Free()

	ref, err = repo.References.Lookup("refs/heads/master")
	checkFatal(t, err)
	defer ref.Free()
}