guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [outreachy] Walk through the Git history (guix git {authenticate,log


From: zimoun
Subject: Re: [outreachy] Walk through the Git history (guix git {authenticate,log})
Date: Sat, 12 Dec 2020 13:10:57 +0100

Hi Mathieu,

On Sat, 12 Dec 2020 at 09:42, Mathieu Othacehe <othacehe@gnu.org> wrote:

>>  1. Loop with commit-parents as it is done for ’commit-closure’ in
>>     guix/git.scm.
>>
>>  2. Bind git_revwalk_* and use it instead.
>>
>> WDYT?
>>
>> Well, #1 is more straightforward but less efficient, IIUC.
>
> Running something like:
>
> --8<---------------cut here---------------start------------->8---
> (let loop ((commit (commit-lookup r (string->oid "cf53ea79d")))
>            (res '()))
>      (let ((parents (commit-parents commit)))
>        (if (null? parents)
>            res
>          (loop (car parents) (cons (car parents) res)))))
> --8<---------------cut here---------------end--------------->8---
>
> takes 1.45s to go over 53391 commits. The "revwalk" API may be more
> efficient but I would say that what's currently implemented could be a
> fine starting point.

It does not work for complex history where multiple branches are merged.
For example, the snippet excludes one of the master or core-updates at
the merge points; or I miss something.

Therefore, the loop should explore the different branches at the merge
points, keeping somehow a list of already visited commit, implementing
bit of graph stuff, and all in all, it is git_revwalk_*, IIUC.

I agree that looping with commit-parents is a good starting point.


All the best,
simon



reply via email to

[Prev in Thread] Current Thread [Next in Thread]