MCPcopy Create free account
hub / github.com/go-git/go-git / encodeOptions

Method encodeOptions

plumbing/format/config/encoder.go:62–77  ·  view source on GitHub ↗
(opts Options)

Source from the content-addressed store, hash-verified

60}
61
62func (e *Encoder) encodeOptions(opts Options) error {
63 for _, o := range opts {
64 var value string
65 if strings.ContainsAny(o.Value, "#;\"\t\n\\") || strings.HasPrefix(o.Value, " ") || strings.HasSuffix(o.Value, " ") {
66 value = `"`+valueReplacer.Replace(o.Value)+`"`
67 } else {
68 value = o.Value
69 }
70
71 if err := e.printf("\t%s = %s\n", o.Key, value); err != nil {
72 return err
73 }
74 }
75
76 return nil
77}
78
79func (e *Encoder) printf(msg string, args ...interface{}) error {
80 _, err := fmt.Fprintf(e.w, msg, args...)

Callers 2

encodeSectionMethod · 0.95
encodeSubsectionMethod · 0.95

Calls 1

printfMethod · 0.95

Tested by

no test coverage detected