Skip to content

Commit

Permalink
Do not pre-populate context values
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik Schulz authored and dominikschulz committed Mar 8, 2018
1 parent 1b11c57 commit ed6b788
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 28 deletions.
27 changes: 0 additions & 27 deletions context.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,36 +14,9 @@ import (
)

func initContext(ctx context.Context, cfg *config.Config) context.Context {
// autosync
ctx = sub.WithAutoSync(ctx, cfg.Root.AutoSync)

// always trust
ctx = gpg.WithAlwaysTrust(ctx, true)

// ask for more
ctx = ctxutil.WithAskForMore(ctx, cfg.Root.AskForMore)

// clipboard timeout
ctx = ctxutil.WithClipTimeout(ctx, cfg.Root.ClipTimeout)

// no confirm
ctx = ctxutil.WithNoConfirm(ctx, cfg.Root.NoConfirm)

// no pager
ctx = ctxutil.WithNoPager(ctx, cfg.Root.NoPager)

// show safe content
ctx = ctxutil.WithShowSafeContent(ctx, cfg.Root.SafeContent)

// always use symbols
ctx = ctxutil.WithUseSymbols(ctx, cfg.Root.UseSymbols)

// never use color
ctx = ctxutil.WithNoColor(ctx, cfg.Root.NoColor)

// enable desktop notifications
ctx = ctxutil.WithNotifications(ctx, cfg.Root.Notifications)

// check recipients conflicts with always trust, make sure it's not enabled
// when always trust is
if gpg.IsAlwaysTrust(ctx) {
Expand Down
2 changes: 1 addition & 1 deletion store/root/mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ func (r *Store) getStore(ctx context.Context, name string) (context.Context, *su
if sub, found := r.mounts[mp]; found {
return r.cfg.Mounts[mp].WithContext(ctx), sub, strings.TrimPrefix(name, sub.Alias())
}
return ctx, r.store, name
return r.cfg.Root.WithContext(ctx), r.store, name
}

// GetSubStore returns an exact match for a mount point or an error if this
Expand Down

0 comments on commit ed6b788

Please sign in to comment.