From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:43121) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1d6Zu9-0002rJ-2B for guix-patches@gnu.org; Fri, 05 May 2017 05:52:05 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1d6Zu6-0008S6-1i for guix-patches@gnu.org; Fri, 05 May 2017 05:52:05 -0400 Received: from debbugs.gnu.org ([208.118.235.43]:57196) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1d6Zu5-0008S1-V0 for guix-patches@gnu.org; Fri, 05 May 2017 05:52:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1d6Zu5-00041b-OO for guix-patches@gnu.org; Fri, 05 May 2017 05:52:01 -0400 Subject: bug#26777: [PATCH] guix: git: Add new module. Resent-Message-ID: From: ludo@gnu.org (Ludovic =?UTF-8?Q?Court=C3=A8s?=) References: <20170504144944.8635-1-m.othacehe@gmail.com> <20170505090401.9036-1-m.othacehe@gmail.com> Date: Fri, 05 May 2017 11:51:09 +0200 In-Reply-To: <20170505090401.9036-1-m.othacehe@gmail.com> (Mathieu Othacehe's message of "Fri, 5 May 2017 11:04:01 +0200") Message-ID: <87y3ubaaya.fsf@gnu.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+kyle=kyleam.com@gnu.org Sender: "Guix-patches" To: Mathieu Othacehe Cc: 26777@debbugs.gnu.org Hi! Mathieu Othacehe skribis: > * guix/git.scm: New file. > * configure.ac: Check for (guile git). > * Makefile.am: Build guix/git.scm if (guile git) is available. [...] > +(define* (copy-to-store cache-directory store #:key url repository) > + "Copy items in cache-directory to store. URL and REPOSITORY are used > +to forge store directory name." Could you make =E2=80=98store=E2=80=99 the first parameter, as is done else= where? > +(define (switch-to-ref repository ref) > + "Switch to REPOSITORY's branch, commit or tag specified by REF." > + (let* ((oid (match ref > + (('branch . branch) > + (reference-target > + (branch-lookup repository branch BRANCH-REMOTE))) > + (('commit . commit) > + (string->oid commit)) > + (('tag . tag) > + (reference-name->oid repository > + (string-append "refs/tags/" tag)))= )) > + (obj (object-lookup repository oid))) > + ;; guile-git checkout binding seems broken. > + (reset repository obj RESET_HARD))) Could you add an XXX to this comment and perhaps say why this is broken? Regardless of brokenness, it sounds safer to always hard-reset the checkout to make sure we=E2=80=99re in the right state, no? So maybe you c= an even remove the comment. :-) > +(define* (latest-repository-commit url store > + #:key > + (ref '(branch . "origin/master"))) > + "Return two values: the content of the git repository at URL copied in= to a > +store directory and the sha1 of the top level commit in this directory. = The > +reference to be checkout, once the repository is fetched, is specified b= y REF. > +REF is pair whose key is [branch | commit | tag] and value the associated > +data, respectively [ | | ]. Please make =E2=80=98store=E2=80=99 the first argument, and add #:key (cache-directory (%repository-cache-directory)) OK for =E2=80=98master=E2=80=99 with changes along these lines. Thank you! Ludo=E2=80=99.