decodeRefs pulls the sha1s out of the line read from the pre-push hook's stdin.
(input string)
| 98 | // decodeRefs pulls the sha1s out of the line read from the pre-push |
| 99 | // hook's stdin. |
| 100 | func decodeRefs(input string) (*git.Ref, *git.Ref) { |
| 101 | refs := strings.Split(strings.TrimSpace(input), " ") |
| 102 | for len(refs) < 4 { |
| 103 | refs = append(refs, "") |
| 104 | } |
| 105 | |
| 106 | localRef := git.ParseRef(refs[0], refs[1]) |
| 107 | remoteRef := git.ParseRef(refs[2], refs[3]) |
| 108 | return localRef, remoteRef |
| 109 | } |
| 110 | |
| 111 | func init() { |
| 112 | RegisterCommand("pre-push", prePushCommand, func(cmd *cobra.Command) { |
no test coverage detected