unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: zimoun <zimon.toutoune@gmail.com>
To: Mathieu Othacehe <othacehe@gnu.org>
Cc: Guix Devel <guix-devel@gnu.org>
Subject: Re: [outreachy] Walk through the Git history (guix git {authenticate,log})
Date: Sat, 12 Dec 2020 13:10:57 +0100	[thread overview]
Message-ID: <86o8izfcmm.fsf@gmail.com> (raw)
In-Reply-To: <87czzfpg8k.fsf@gnu.org>

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	other threads:[~2020-12-12 20:57 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-11 17:41 [outreachy] Walk through the Git history (guix git {authenticate, log}) zimoun
2020-12-11 19:01 ` [outreachy] Walk through the Git history (guix git {authenticate,log}) Magali
2020-12-12 12:24   ` zimoun
2020-12-12 17:24     ` Magali
2020-12-12 17:49       ` [outreachy] Walk through the Git history zimoun
2020-12-14 10:20         ` Ludovic Courtès
2020-12-15 15:20     ` [outreachy] Walk through the Git history (guix git {authenticate,log}) Magali
2020-12-16  9:35       ` zimoun
2020-12-18 15:34       ` Ludovic Courtès
2020-12-19  3:18         ` Magali
2020-12-12  8:42 ` Mathieu Othacehe
2020-12-12 12:10   ` zimoun [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=86o8izfcmm.fsf@gmail.com \
    --to=zimon.toutoune@gmail.com \
    --cc=guix-devel@gnu.org \
    --cc=othacehe@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).