From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp12.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms5.migadu.com with LMTPS id yl0GOKahAGRgLwAAbAwnHQ (envelope-from ) for ; Thu, 02 Mar 2023 14:16:22 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp12.migadu.com with LMTPS id 2P87N6ahAGSjxwAAauVa8A (envelope-from ) for ; Thu, 02 Mar 2023 14:16:22 +0100 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 88857130CB for ; Thu, 2 Mar 2023 14:16:22 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1pXin6-0000Vf-MD; Thu, 02 Mar 2023 08:16:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pXimx-0000Tl-8Q for guix-patches@gnu.org; Thu, 02 Mar 2023 08:16:03 -0500 Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1pXimw-0001PO-S3 for guix-patches@gnu.org; Thu, 02 Mar 2023 08:16:02 -0500 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1pXimw-00046A-HK for guix-patches@gnu.org; Thu, 02 Mar 2023 08:16:02 -0500 X-Loop: help-debbugs@gnu.org Subject: [bug#61910] [PATCH] git-download: Download a bare Git repository from SWH. Resent-From: Ludovic =?UTF-8?Q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 02 Mar 2023 13:16:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 61910 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: Simon Tournier Cc: 61910@debbugs.gnu.org Received: via spool by 61910-submit@debbugs.gnu.org id=B61910.167776292811597 (code B ref 61910); Thu, 02 Mar 2023 13:16:02 +0000 Received: (at 61910) by debbugs.gnu.org; 2 Mar 2023 13:15:28 +0000 Received: from localhost ([127.0.0.1]:56146 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pXimN-000307-Kk for submit@debbugs.gnu.org; Thu, 02 Mar 2023 08:15:27 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46608) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1pXimL-0002g6-Sz for 61910@debbugs.gnu.org; Thu, 02 Mar 2023 08:15:26 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pXimG-0001BL-Cg; Thu, 02 Mar 2023 08:15:20 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:In-Reply-To:Date:References:Subject:To: From; bh=umZEIRh3nHY9RZmeJBYfh3UmbG3Q9YON/qe2X4jk1E4=; b=diz9dr8PoczenqwNQk55 QFtTsSw2YMBdpcm9P7xDPtNg+Emcbb2S1COjAjsGZv1pLmHewAa6QB9QKHuSaOcU0wFeu5MnPGai7 VdxUCRNoNcYbZT5SO8SOxxzFmrCFd3Rsy3j7bgj4jCW7+IYBgmDmEEpGZljQyLK3p2ethoUFRPAs7 epqcszTpFGM1bsrH7CBMAmIrWJA53wyfSKnnjCGrWHF6rjuPSQEaKzqmr1OFwkZgebQb99fhpFLHA 7hpmkN7EvcGEPx7CoJ3dK2014Jt1ebIrrkf/p7yJx4ZzGd3oC3RAse1Kwb4v5wjDuOrXmYI6cPxzU DvtV8BnJiUvaMA==; Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1pXim3-0002wJ-Q4; Thu, 02 Mar 2023 08:15:20 -0500 From: Ludovic =?UTF-8?Q?Court=C3=A8s?= References: <20230302091233.28226-1-ludo@gnu.org> <20230302120546.1074630-1-zimon.toutoune@gmail.com> Date: Thu, 02 Mar 2023 14:15:05 +0100 In-Reply-To: <20230302120546.1074630-1-zimon.toutoune@gmail.com> (Simon Tournier's message of "Thu, 2 Mar 2023 13:05:46 +0100") Message-ID: <87cz5r5m7a.fsf_-_@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: guix-patches@gnu.org List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-patches-bounces+larch=yhetil.org@gnu.org Sender: guix-patches-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN ARC-Seal: i=1; s=key1; d=yhetil.org; t=1677762982; a=rsa-sha256; cv=none; b=VE9sFyWz+6f7NMWeva6TWt9efSOS6wR5EGodTm1paiKWutCWVYda31ddf7D2X2v+NvJvJS 2JgD9oXqAi3Cz65lGDsA39k5z/wM3yhI79sO8gTz+pc22V9GnBVAQ3WsvIFhEETHYykfUy GYSge2Jmhz06T/0TznZbs7VoK137fbjoif+J7mIKG4CdZ1+gSmQfLNigehtuQtOByeH9RW Gv0GAs18vnCe7/h8+FymA0FteUFVXD/e+5DtV3NqBCHotNmiUyymD/2XHRkw9yrEpk28RE GD6tlDI9a2+cEj4Ve+9FoH6MY7q1qvCxiBoEGDiBsfE4sXeN0ZvSNRPxaDzYgQ== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=diz9dr8P; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1677762982; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding:resent-cc: resent-from:resent-sender:resent-message-id:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post:dkim-signature; bh=umZEIRh3nHY9RZmeJBYfh3UmbG3Q9YON/qe2X4jk1E4=; b=HFfihf9oLy9Cs4Dj8iY3Mgm6dydWppEcDvbhjSTuN4+Ljrx6N2TswQLIvH9hs9IqV7gLnk Lll7yjs6loBYz3R3yLTeBCJlLUOGdJ0VaxlDzn/SOmo2GHm5vM4a2h8Um9RJcpMCNTicug UnxGDBxEfvF9VBF+YAUF/anbIF6TMSLniU1BG5fgncvE+tTTlz1fjZj5g2iF9uknJ9xPuo 8cff/kSsLRkbCEEnzBiw/H55QkYsebCglaX+9kSV/6q2Y65c4BSM781W80I/wdu72najD8 UyLYmC4jtx8TooqetwjRCIAozxkRPnd+Qy3WbtbHjf3LxyPJr7tx1oH0vOs1Iw== X-Migadu-Scanner: scn1.migadu.com X-Migadu-Spam-Score: -4.09 X-Spam-Score: -4.09 X-Migadu-Queue-Id: 88857130CB Authentication-Results: aspmx1.migadu.com; dkim=fail ("headers rsa verify failed") header.d=gnu.org header.s=fencepost-gnu-org header.b=diz9dr8P; spf=pass (aspmx1.migadu.com: domain of "guix-patches-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="guix-patches-bounces+larch=yhetil.org@gnu.org"; dmarc=pass (policy=none) header.from=gnu.org X-TUID: 9nAwMxhtPp3Y Hello! Simon Tournier skribis: [...] > (swh-download (getenv "git url") (getenv "git com= mit") > - #$output)))))))) > + #$output) > + ;; Perform CR/LF conversion if specificied by .gi= tattributes > + (when (find-files "." ".gitattributes") > + (invoke #+(file-append git "/bin/git") "-C" #$o= utput > + "init") > + (invoke #+(file-append git "/bin/git") "-C" #$o= utput > + "config" "--local" "user.email" "you@ex= ample.org") > + (invoke #+(file-append git "/bin/git") "-C" #$o= utput > + "config" "--local" "user.name" "Your Na= me") > + (invoke #+(file-append git "/bin/git") "-C" #$o= utput > + "add" ".") > + (invoke #+(file-append git "/bin/git") "-C" #$o= utput > + "commit" "-am" "'init'") > + (invoke #+(file-append git "/bin/git") "-C" #$o= utput > + "read-tree" "--empty") > + (invoke #+(file-append git "/bin/git") "-C" #$o= utput > + "reset" "--hard") > + (delete-file-recursively > + (string-append #$output "/.git")))))))))) This is much better than fetching the whole repo, well done! Should we replace (find-files =E2=80=A6) with (file-exists? ".gitattributes= ")? I wonder if we could achieve the same without creating a repo just to delete it afterwards, either by invoking a low-level =E2=80=98git=E2=80=99 = command it if exists, or using Guile-Git, or doing it ourselves in Scheme. WDYT? Thanks, Ludo=E2=80=99.