MCPcopy Index your code
hub / github.com/cli/cli / Test_parseBranchConfig

Function Test_parseBranchConfig

git/client_test.go:806–903  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

804}
805
806func Test_parseBranchConfig(t *testing.T) {
807 tests := []struct {
808 name string
809 configLines []string
810 wantBranchConfig BranchConfig
811 }{
812 {
813 name: "remote branch",
814 configLines: []string{"branch.trunk.remote origin"},
815 wantBranchConfig: BranchConfig{
816 RemoteName: "origin",
817 },
818 },
819 {
820 name: "merge ref",
821 configLines: []string{"branch.trunk.merge refs/heads/trunk"},
822 wantBranchConfig: BranchConfig{
823 MergeRef: "refs/heads/trunk",
824 },
825 },
826 {
827 name: "merge base",
828 configLines: []string{"branch.trunk.gh-merge-base gh-merge-base"},
829 wantBranchConfig: BranchConfig{
830 MergeBase: "gh-merge-base",
831 },
832 },
833 {
834 name: "pushremote",
835 configLines: []string{"branch.trunk.pushremote pushremote"},
836 wantBranchConfig: BranchConfig{
837 PushRemoteName: "pushremote",
838 },
839 },
840 {
841 name: "remote and pushremote are specified by name",
842 configLines: []string{
843 "branch.trunk.remote upstream",
844 "branch.trunk.pushremote origin",
845 },
846 wantBranchConfig: BranchConfig{
847 RemoteName: "upstream",
848 PushRemoteName: "origin",
849 },
850 },
851 {
852 name: "remote and pushremote are specified by url",
853 configLines: []string{
854 "branch.trunk.remote git@github.com:UPSTREAMOWNER/REPO.git",
855 "branch.trunk.pushremote git@github.com:ORIGINOWNER/REPO.git",
856 },
857 wantBranchConfig: BranchConfig{
858 RemoteURL: &url.URL{
859 Scheme: "ssh",
860 User: url.User("git"),
861 Host: "github.com",
862 Path: "/UPSTREAMOWNER/REPO.git",
863 },

Callers

nothing calls this directly

Calls 3

parseBranchConfigFunction · 0.85
RunMethod · 0.65
StringMethod · 0.45

Tested by

no test coverage detected