From 805ae5b6fdcf0cfa77fc6a7fc0fa2c9958df2c44 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 8ce68bb5f..1e93612d8 100644 --- a/indexer/repofetch.go +++ b/indexer/repofetch.go @@ -141,8 +141,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) @@ -153,7 +155,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 d2c3766f3..6c349a1c9 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.