From 994cce30de89826673fe7d6484743a12c5934f33 Mon Sep 17 00:00:00 2001 From: Brian Olson Date: Tue, 17 Dec 2024 11:45:29 -0500 Subject: [PATCH] fix usage of ImportNewRepo --- indexer/repofetch.go | 4 +++- repomgr/repomgr.go | 3 +++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/indexer/repofetch.go b/indexer/repofetch.go index 0e72f7cb..5e8c8df2 100644 --- a/indexer/repofetch.go +++ b/indexer/repofetch.go @@ -162,8 +162,10 @@ func (rf *RepoFetcher) FetchAndIndexRepo(ctx context.Context, job *crawlWork) er } } + revp := &rev if rev == "" { span.SetAttributes(attribute.Bool("full", true)) + revp = nil } c := models.ClientForPds(&pds) @@ -174,7 +176,7 @@ func (rf *RepoFetcher) FetchAndIndexRepo(ctx context.Context, job *crawlWork) er return err } - if err := rf.repoman.ImportNewRepo(ctx, ai.Uid, ai.Did, bytes.NewReader(repo), &rev); err != nil { + if err := rf.repoman.ImportNewRepo(ctx, ai.Uid, ai.Did, bytes.NewReader(repo), revp); err != nil { span.RecordError(err) if ipld.IsNotFound(err) || errors.Is(err, io.EOF) || errors.Is(err, fs.ErrNotExist) { diff --git a/repomgr/repomgr.go b/repomgr/repomgr.go index d2c3766f..6c349a1c 100644 --- a/repomgr/repomgr.go +++ b/repomgr/repomgr.go @@ -912,6 +912,9 @@ func (rm *RepoManager) ImportNewRepo(ctx context.Context, user models.Uid, repoD return err } + if rev != nil && *rev == "" { + rev = nil + } if rev == nil { // if 'rev' is nil, this implies a fresh sync. // in this case, ignore any existing blocks we have and treat this like a clean import.