From c18c66f1673c8956a245f7f7239079bad8368563 Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 4 May 2023 17:49:39 +0100 Subject: [PATCH] fs: when creating new fs.OverrideRemotes don't layer overrides if not needed --- fs/override.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fs/override.go b/fs/override.go index b06c0d070..9ba8c4aef 100644 --- a/fs/override.go +++ b/fs/override.go @@ -12,6 +12,13 @@ type OverrideRemote struct { // NewOverrideRemote returns an OverrideRemoteObject which will // return the remote specified func NewOverrideRemote(oi ObjectInfo, remote string) *OverrideRemote { + // re-wrap an OverrideRemote + if or, ok := oi.(*OverrideRemote); ok { + return &OverrideRemote{ + ObjectInfo: or.ObjectInfo, + remote: remote, + } + } return &OverrideRemote{ ObjectInfo: oi, remote: remote,