From patchwork Wed Mar 13 17:42:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Ludovic_Court=C3=A8s?= X-Patchwork-Id: 24829 Return-Path: X-Original-To: patchwork@mira.cbaines.net Delivered-To: patchwork@mira.cbaines.net Received: by mira.cbaines.net (Postfix, from userid 113) id 3A89427BBEB; Wed, 13 Mar 2024 17:45:35 +0000 (GMT) X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on mira.cbaines.net X-Spam-Level: X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,MAILING_LIST_MULTI,SPF_HELO_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mira.cbaines.net (Postfix) with ESMTPS id C36FD27BBE9 for ; Wed, 13 Mar 2024 17:45:34 +0000 (GMT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rkSfQ-0000Vq-RE; Wed, 13 Mar 2024 13:45:28 -0400 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 1rkSfP-0000Vh-Q8 for guix-patches@gnu.org; Wed, 13 Mar 2024 13:45:27 -0400 Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1rkSfP-0001mB-Fv; Wed, 13 Mar 2024 13:45:27 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rkSfy-0008Jy-E1; Wed, 13 Mar 2024 13:46:02 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69780] [PATCH 2/4] git authenticate: Discover the repository. Resent-From: Ludovic =?utf-8?q?Court=C3=A8s?= Original-Sender: "Debbugs-submit" Resent-CC: guix@cbaines.net, dev@jpoiret.xyz, ludo@gnu.org, othacehe@gnu.org, rekado@elephly.net, zimon.toutoune@gmail.com, me@tobias.gr, guix-patches@gnu.org Resent-Date: Wed, 13 Mar 2024 17:46:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 69780 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 69780@debbugs.gnu.org Cc: Ludovic =?utf-8?q?Court=C3=A8s?= , Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice X-Debbugs-Original-Xcc: Christopher Baines , Josselin Poiret , Ludovic =?utf-8?q?Court=C3=A8s?= , Mathieu Othacehe , Ricardo Wurmus , Simon Tournier , Tobias Geerinckx-Rice Received: via spool by 69780-submit@debbugs.gnu.org id=B69780.171035193031910 (code B ref 69780); Wed, 13 Mar 2024 17:46:02 +0000 Received: (at 69780) by debbugs.gnu.org; 13 Mar 2024 17:45:30 +0000 Received: from localhost ([127.0.0.1]:47354 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rkSfS-0008Ia-3R for submit@debbugs.gnu.org; Wed, 13 Mar 2024 13:45:30 -0400 Received: from eggs.gnu.org ([209.51.188.92]:48732) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rkSfQ-0008IG-6s for 69780@debbugs.gnu.org; Wed, 13 Mar 2024 13:45:28 -0400 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 1rkScf-0000vc-Gr; Wed, 13 Mar 2024 13:42:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-Version:References:In-Reply-To:Date:Subject:To: From; bh=wYNpMwy3YvfILQnVZiWDF4E+radtE/xWwh0rzUXvgCE=; b=FMb8R1hHalOuy0m9ucPx 5/qztgEv8zjWe3kpIkuKb4S4/At6PC7cM//ptKr9hoThslbCbPLkAkAcmrbTyi/kXMU9kTm/4gTG1 EbgmSR2c0KKjb13XPisT27nqp1hSZ2qswvmK7KIjEnDlK5h+ql0OlPFwX1EHudR/J+YzQqhu33ROs zarWmKUE4AOcdt6cDfuVQH5qRqvw9laAz+fuNCnSOiq/ntdBnQXqaz8E4AaT8z+fttZk5vMkSibT3 MB64ukxAIHOC6hG1XWwVn4It63RPNYWBYlce8YQd5j9L6q+xYB9X7yNd6Pdh90R9ahS+A3/r018Fs JpW6WS2+tl4HZw==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Wed, 13 Mar 2024 18:42:20 +0100 Message-ID: X-Mailer: git-send-email 2.41.0 In-Reply-To: References: MIME-Version: 1.0 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+patchwork=mira.cbaines.net@gnu.org Sender: guix-patches-bounces+patchwork=mira.cbaines.net@gnu.org X-getmail-retrieved-from-mailbox: Patches This allows one to run ‘guix git authenticate’ from a sub-directory of the checkout. * guix/scripts/git/authenticate.scm (%default-options): Remove ‘directory’ key. (guix-git-authenticate): Use ‘repository-discover’ when ‘directory’ option is missing. Change-Id: Ifada00d559254971ed7eeb8c0a8d4ae74ff3defc --- guix/scripts/git/authenticate.scm | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/guix/scripts/git/authenticate.scm b/guix/scripts/git/authenticate.scm index d3cc4065df..36e1aa6228 100644 --- a/guix/scripts/git/authenticate.scm +++ b/guix/scripts/git/authenticate.scm @@ -74,7 +74,7 @@ (define %options (alist-cons 'show-stats? #t result))))) (define %default-options - '((directory . "."))) + '()) (define (config-value config key) "Return the config value associated with KEY, or #f if no such config was @@ -215,9 +215,9 @@ (define (guix-git-authenticate . args) (with-error-handling (with-git-error-handling - (let* ((directory (assoc-ref options 'directory)) - (show-stats? (assoc-ref options 'show-stats?)) - (repository (repository-open directory)) + (let* ((show-stats? (assoc-ref options 'show-stats?)) + (repository (repository-open (or (assoc-ref options 'directory) + (repository-discover ".")))) (commit signer (match (command-line-arguments options) ((commit signer) (values commit signer))