From 4c7559317d2de8008110f7e96b5104f68d4fdb5b Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Mon, 3 Aug 2015 19:08:25 -0700 Subject: [PATCH] Only mirror regular files --- error.go | 18 ++++++------------ mirror-url.go | 8 ++++++-- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/error.go b/error.go index 98bed067..2d098e38 100644 --- a/error.go +++ b/error.go @@ -17,21 +17,15 @@ func ifFatal(err *probe.Error) { } } -func ifError(err error) { - switch e := err.(type) { - case *probe.Error: - switch e { - case nil: - // nothing to print - default: - if !globalDebugFlag { - console.Errorln(e.ToError()) - } - console.Errorln(err) - } +func ifError(err *probe.Error) { + switch err { case nil: // nothing to print default: + if !globalDebugFlag { + console.Errorln(err.ToError()) + return + } console.Errorln(err) } } diff --git a/mirror-url.go b/mirror-url.go index f4a6a100..09324d54 100644 --- a/mirror-url.go +++ b/mirror-url.go @@ -128,7 +128,9 @@ func deltaSourceTargets(sourceClnt client.Client, targetClnts []client.Client) < mirrorURLsCh <- mirrorURLs{Error: sourceContentCh.Err.Trace()} return } - sourceTrie.Insert(patricia.Prefix(sourceContentCh.Content.Name), sourceContentCh.Content.Size) + if sourceContentCh.Content.Type.IsRegular() { + sourceTrie.Insert(patricia.Prefix(sourceContentCh.Content.Name), sourceContentCh.Content.Size) + } } }() @@ -142,7 +144,9 @@ func deltaSourceTargets(sourceClnt client.Client, targetClnts []client.Client) < mirrorURLsCh <- mirrorURLs{Error: targetContentCh.Err.Trace()} return } - targetTrie.Insert(patricia.Prefix(targetContentCh.Content.Name), struct{}{}) + if targetContentCh.Content.Type.IsRegular() { + targetTrie.Insert(patricia.Prefix(targetContentCh.Content.Name), struct{}{}) + } } targetTries[i] = targetTrie }(i, targetClnt)