From patchwork Sun Apr 7 20:38:27 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: 62829 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 5001D27BBEC; Sun, 7 Apr 2024 21:40:27 +0100 (BST) 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=unavailable 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 CE46727BBE2 for ; Sun, 7 Apr 2024 21:40:26 +0100 (BST) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rtZJ5-00018b-IY; Sun, 07 Apr 2024 16:40:03 -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 1rtZJ4-00017c-8m for guix-patches@gnu.org; Sun, 07 Apr 2024 16:40:02 -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 1rtZJ3-0005xm-U8; Sun, 07 Apr 2024 16:40:01 -0400 Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rtZJ8-00013C-3o; Sun, 07 Apr 2024 16:40:06 -0400 X-Loop: help-debbugs@gnu.org Subject: [bug#69780] [PATCH v2 2/5] 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: Sun, 07 Apr 2024 20:40:06 +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.17125223513696 (code B ref 69780); Sun, 07 Apr 2024 20:40:06 +0000 Received: (at 69780) by debbugs.gnu.org; 7 Apr 2024 20:39:11 +0000 Received: from localhost ([127.0.0.1]:44802 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rtZIE-0000xR-Aq for submit@debbugs.gnu.org; Sun, 07 Apr 2024 16:39:10 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:40928) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rtZI6-0000v2-F6 for 69780@debbugs.gnu.org; Sun, 07 Apr 2024 16:39:05 -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 1rtZHt-0005px-VS; Sun, 07 Apr 2024 16:38:50 -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=cvGa88s4XJOzrayXoaISyWAvNilcSrEZUuWaY33U+Qc=; b=GmcFKdTR7EdoGqUa45mU 1tuQO0nGxf6XNWa0fZHYEkS3Po3Ig+mW13fo2OkJvPdAKKy8MIr/PjoUFQtpWO7Mdn41u/DKHwObj zrOXe1DOUOWSdR7SWiFrk6VJnz0dztTfjVUL5dMAA/3VxiiswqMyCbizz0U1synvkBtUfT1lJj49L XSBTkURnPOPu6EJPBTsoLDGF5yo3J0tnsH600mF2FxjXzDNbwF0ikMMvJqNvr9aFnz00zs9nniXl4 iWjUgXUKkY7X+yfBTjO5tjbC8xCCCo89C15A0T19D4Pj9Uy8dOGfELsnP6p0XhLF4fLAZS1qQmCY6 Jq1MBPEReYAEDA==; From: Ludovic =?utf-8?q?Court=C3=A8s?= Date: Sun, 7 Apr 2024 22:38:27 +0200 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 a606f1c146..d81a0e1ffb 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 (current-branch repository) "Return the name of the checked out branch of REPOSITORY or #f if it could @@ -236,9 +236,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))