MCPcopy
hub / github.com/mislav/hub / transformPushArgs

Function transformPushArgs

commands/push.go:41–66  ·  view source on GitHub ↗
(args *Args)

Source from the content-addressed store, hash-verified

39}
40
41func transformPushArgs(args *Args) {
42 refs := []string{}
43 if args.ParamsSize() > 1 {
44 refs = args.Params[1:]
45 }
46
47 remotes := strings.Split(args.FirstParam(), ",")
48 args.ReplaceParam(0, remotes[0])
49
50 if len(refs) == 0 {
51 localRepo, err := github.LocalRepo()
52 utils.Check(err)
53
54 head, err := localRepo.CurrentBranch()
55 utils.Check(err)
56
57 refs = []string{head.ShortName()}
58 args.AppendParams(refs...)
59 }
60
61 for _, remote := range remotes[1:] {
62 afterCmd := []string{"git", "push", remote}
63 afterCmd = append(afterCmd, refs...)
64 args.After(afterCmd...)
65 }
66}

Callers 2

pushFunction · 0.85
TestTransformPushArgsFunction · 0.85

Calls 9

LocalRepoFunction · 0.92
CheckFunction · 0.92
ParamsSizeMethod · 0.80
FirstParamMethod · 0.80
ReplaceParamMethod · 0.80
CurrentBranchMethod · 0.80
ShortNameMethod · 0.80
AppendParamsMethod · 0.80
AfterMethod · 0.80

Tested by 1

TestTransformPushArgsFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…