MCPcopy Create free account
hub / github.com/chainreactors/EvilProxy / advanceRemoteBranch

Function advanceRemoteBranch

internal/store/gitstore_test.go:430–453  ·  view source on GitHub ↗
(t *testing.T, seedDir, remoteDir, branch, contents, message string)

Source from the content-addressed store, hash-verified

428}
429
430func advanceRemoteBranch(t *testing.T, seedDir, remoteDir, branch, contents, message string) {
431 t.Helper()
432
433 seedRepo, err := git.PlainOpen(seedDir)
434 if err != nil {
435 t.Fatalf("open seed repo: %v", err)
436 }
437 worktree, err := seedRepo.Worktree()
438 if err != nil {
439 t.Fatalf("open seed worktree: %v", err)
440 }
441 if err := worktree.Checkout(&git.CheckoutOptions{Branch: plumbing.NewBranchReferenceName(branch)}); err != nil {
442 t.Fatalf("checkout branch %s: %v", branch, err)
443 }
444 commitBranchMarker(t, seedDir, worktree, testBranchSpec{name: branch, contents: contents}, message)
445 if err := seedRepo.Push(&git.PushOptions{
446 RemoteName: "origin",
447 RefSpecs: []gitconfig.RefSpec{
448 gitconfig.RefSpec(plumbing.NewBranchReferenceName(branch).String() + ":" + plumbing.NewBranchReferenceName(branch).String()),
449 },
450 }); err != nil {
451 t.Fatalf("push branch %s update to %s: %v", branch, remoteDir, err)
452 }
453}
454
455func advanceRemoteBranchFromNewBranch(t *testing.T, seedDir, remoteDir, branch, contents, message string) {
456 t.Helper()

Calls 3

commitBranchMarkerFunction · 0.85
PushMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected