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

Method updateRemoteConfigIfNeeded

repository.go:1040–1054  ·  view source on GitHub ↗
(o *CloneOptions, c *config.RemoteConfig, head *plumbing.Reference)

Source from the content-addressed store, hash-verified

1038}
1039
1040func (r *Repository) updateRemoteConfigIfNeeded(o *CloneOptions, c *config.RemoteConfig, head *plumbing.Reference) error {
1041 if !o.SingleBranch {
1042 return nil
1043 }
1044
1045 c.Fetch = r.cloneRefSpec(o)
1046
1047 cfg, err := r.Config()
1048 if err != nil {
1049 return err
1050 }
1051
1052 cfg.Remotes[c.Name] = c
1053 return r.Storer.SetConfig(cfg)
1054}
1055
1056func (r *Repository) fetchAndUpdateReferences(
1057 ctx context.Context, o *FetchOptions, ref plumbing.ReferenceName,

Callers 1

cloneMethod · 0.95

Calls 3

cloneRefSpecMethod · 0.95
ConfigMethod · 0.95
SetConfigMethod · 0.65

Tested by

no test coverage detected