Skip to content

Commit

Permalink
fixup! Add first cut of git-credential-fdoss
Browse files Browse the repository at this point in the history
Make the anonymous inline function in Marshal much shorter (simpler).

Addresses: #3 (comment)
  • Loading branch information
camh- committed Aug 27, 2024
1 parent 4aebf46 commit 19e9736
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions gitcred.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,9 @@ func (gc *GitCredential) Unmarshal(r io.Reader) error {
func (gc *GitCredential) Marshal(w io.Writer) error {
var err error
marshal := func(k, v string) {
if err != nil {
return
if err == nil && v != "" {
_, err = fmt.Fprintf(w, "%s=%s\n", k, v)
}
if v == "" {
return
}
_, err = fmt.Fprintf(w, "%s=%s\n", k, v)
}
marshal("protocol", gc.Protocol)
marshal("host", gc.Host)
Expand Down

0 comments on commit 19e9736

Please sign in to comment.