MCPcopy Index your code
hub / github.com/git-lfs/git-lfs / TestRefUpdateExplicitLocalAndRemoteRefs

Function TestRefUpdateExplicitLocalAndRemoteRefs

git/refs_test.go:51–67  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

49}
50
51func TestRefUpdateExplicitLocalAndRemoteRefs(t *testing.T) {
52 u := NewRefUpdate(nil, "", ParseRef("refs/heads/local", "abc123"), ParseRef("refs/heads/remote", "def456"))
53 assert.Equal(t, "local", u.LocalRef().Name)
54 assert.Equal(t, "abc123", u.LocalRef().Sha)
55 assert.Equal(t, "abc123", u.LocalRefCommitish())
56 assert.Equal(t, "remote", u.RemoteRef().Name)
57 assert.Equal(t, "def456", u.RemoteRef().Sha)
58 assert.Equal(t, "def456", u.RemoteRefCommitish())
59
60 u = NewRefUpdate(nil, "", ParseRef("refs/heads/local", ""), ParseRef("refs/heads/remote", ""))
61 assert.Equal(t, "local", u.LocalRef().Name)
62 assert.Equal(t, "", u.LocalRef().Sha)
63 assert.Equal(t, "local", u.LocalRefCommitish())
64 assert.Equal(t, "remote", u.RemoteRef().Name)
65 assert.Equal(t, "", u.RemoteRef().Sha)
66 assert.Equal(t, "remote", u.RemoteRefCommitish())
67}
68
69func newEnv(m map[string][]string) *mapEnv {
70 return &mapEnv{data: m}

Callers

nothing calls this directly

Calls 7

LocalRefMethod · 0.95
LocalRefCommitishMethod · 0.95
RemoteRefMethod · 0.95
RemoteRefCommitishMethod · 0.95
NewRefUpdateFunction · 0.85
ParseRefFunction · 0.85
EqualMethod · 0.45

Tested by

no test coverage detected