Follow up to #513 (#521)

This reverts changes from #513 which ended up not being necessary.
This commit is contained in:
Pieter Noordhuis 2023-06-23 12:51:31 +02:00 committed by GitHub
parent d23d4aef3a
commit ae13135fc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 4 deletions

View File

@ -76,9 +76,6 @@ func (l profileFromHostLoader) Configure(cfg *config.Config) error {
// Normalized version of the configured host.
host := normalizeHost(cfg.Host)
match, err := findMatchingProfile(configFile, func(s *ini.Section) bool {
if cfg.Profile != "" {
return cfg.Profile == s.Name()
}
key, err := s.GetKey("host")
if err != nil {
log.Tracef(ctx, "section %s: %s", s.Name(), err)

View File

@ -89,6 +89,8 @@ func SaveToProfile(ctx context.Context, cfg *config.Config) error {
return err
}
// zeroval profile name before adding it to a section
cfg.Profile = ""
cfg.ConfigFile = ""
// clear old keys in case we're overriding the section
@ -97,7 +99,7 @@ func SaveToProfile(ctx context.Context, cfg *config.Config) error {
}
for _, attr := range config.ConfigAttributes {
if attr.IsZero(cfg) || attr.Name == "profile" {
if attr.IsZero(cfg) {
continue
}
key := section.Key(attr.Name)