From 408b2b21439ad88551e61766eec6fa713e047528 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dominik=20Pant=C5=AF=C4=8Dek?= Date: Sat, 13 May 2023 18:01:07 +0200 Subject: [PATCH] Preliminary work on annotations. --- src/util-git.scm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/util-git.scm b/src/util-git.scm index cbadf81..f217e5c 100644 --- a/src/util-git.scm +++ b/src/util-git.scm @@ -99,4 +99,22 @@ (cons fname (ldict-ref res status '()))))))))) + ;; Returns detailed file annotation with each line being represented + ;; by dictionary with keys from git output + (define (git-blame repo fname) + (let loop ((lines ((git repo) 'annotate '--porcelain fname)) + (blames '())) + (if (null? lines) + blames + (let ((line (car lines)) + (rblames (if (null? blames) + '() + (cdr blames))) + (blame (if (null? blames) + (make-ldict) + (car blames)))) + (loop (cdr lines) + (cons blame + rblames)))))) + )