>From 2ca6e21d80e2d9986093babcd0999af00dea0504 Mon Sep 17 00:00:00 2001 From: Neil Jerram Date: Thu, 6 Apr 2017 23:15:03 +0100 Subject: [PATCH] Fix first bootstrap of compute-bogus-comments --- tekuti/comment.scm | 39 +++++++++++++++++++++------------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/tekuti/comment.scm b/tekuti/comment.scm index db3e3e8..52e5370 100644 --- a/tekuti/comment.scm +++ b/tekuti/comment.scm @@ -203,24 +203,27 @@ (define visited-trees (make-hash-table)) (define bogus (make-hash-table)) (pk 'computing-bogus) - (fold-commits - (lambda (rev commit _) - (pk 'computing-bogus rev) - (for-each - (match-lambda - ((post-name post-sha1 'tree) - (unless (hash-ref visited-trees post-sha1) - (hash-set! visited-trees post-sha1 #t) + (pk 'master-ref master-ref) + (let ((parent (assq-ref (parse-commit master-ref) 'parent))) + (if parent + (fold-commits + (lambda (rev commit _) + (pk 'computing-bogus rev) (for-each (match-lambda - ((comment-name comment-sha1 'blob) - (unless (or (hash-ref legit comment-sha1) - (hash-ref bogus comment-sha1)) - (hash-set! bogus comment-sha1 comment-name))) - (_ #f)) - (git-ls-tree (string-append post-sha1 ":comments") #f)))) - (_ #f)) - (git-ls-tree (assq-ref commit 'tree) #f))) - (assq-ref (parse-commit master-ref) 'parent) - #f) + ((post-name post-sha1 'tree) + (unless (hash-ref visited-trees post-sha1) + (hash-set! visited-trees post-sha1 #t) + (for-each + (match-lambda + ((comment-name comment-sha1 'blob) + (unless (or (hash-ref legit comment-sha1) + (hash-ref bogus comment-sha1)) + (hash-set! bogus comment-sha1 comment-name))) + (_ #f)) + (git-ls-tree (string-append post-sha1 ":comments") #f)))) + (_ #f)) + (git-ls-tree (assq-ref commit 'tree) #f))) + parent + #f))) bogus) -- 2.11.0