From unknown Mon Jun 23 13:12:15 2025 X-Loop: help-debbugs@gnu.org Subject: [bug#48699] [PATCH] git-download: Support submodules in 'git-predicate'. Resent-From: Andrew Whatson Original-Sender: "Debbugs-submit" Resent-CC: guix-patches@gnu.org Resent-Date: Thu, 27 May 2021 14:19:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 48699 X-GNU-PR-Package: guix-patches X-GNU-PR-Keywords: patch To: 48699@debbugs.gnu.org Cc: Andrew Whatson X-Debbugs-Original-To: guix-patches@gnu.org Received: via spool by submit@debbugs.gnu.org id=B.162212513019179 (code B ref -1); Thu, 27 May 2021 14:19:02 +0000 Received: (at submit) by debbugs.gnu.org; 27 May 2021 14:18:50 +0000 Received: from localhost ([127.0.0.1]:52481 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmGqX-0004zH-GS for submit@debbugs.gnu.org; Thu, 27 May 2021 10:18:49 -0400 Received: from lists.gnu.org ([209.51.188.17]:37852) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmGqV-0004z8-MY for submit@debbugs.gnu.org; Thu, 27 May 2021 10:18:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60030) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lmGqS-0000HW-3L for guix-patches@gnu.org; Thu, 27 May 2021 10:18:45 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]:41723) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lmGqP-0000qW-Uw for guix-patches@gnu.org; Thu, 27 May 2021 10:18:43 -0400 Received: by mail-pl1-x632.google.com with SMTP id z4so36792plg.8 for ; Thu, 27 May 2021 07:18:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=LxIRvnkQu52Rd9EyviM+kO435ObL1ipfudmxHdSHhBE=; b=lpkilXelZAc0rZUM6ljMY+q7gSdZypK2uOstUyN+rBHQ+TMDnYv2tEBXYiTC4lVlak MzmrMu741gItpORMxPBM6zdIYbKBe4Zn9LspJ8t1UMg6H4RzlaUge5Usw9bYKrswariJ 7JAUlCd0wkYNzy42CoVfNiaczCFdFG9FxiF//Xmbrai//Eckp0qjJiE7cRhwtdpdEx4y BVU+jqjT/mQiNmUGEp3PKpxFzFEs0vBUFFhbMjbl//fxts4egbz7sj1qvMZ7rhrH2rWQ 8a03U05Y+j5gwGPN99uGyM2HaYOUUxL2IVWv3pcs16AylAig5xbr6+NZD7cta2nczHlc i84Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=LxIRvnkQu52Rd9EyviM+kO435ObL1ipfudmxHdSHhBE=; b=eNw9TU3Sgrhabh4nB0AE9/OqD+7R/Ko7M6tWaWxoyG02Yn0mgwIjns+mnkAmgE1lgu 7SvIjifWjdsDOuTZ1D4foFkQ82V1IxxkNpfxcYocBD4vLutes0PPo5iGdShiC9xalNuW xmWTztunJ0C7oqDspgDQEoqson9pLa1P8LlsY5DCp5T6jkcr1JzUWt50Rcj1MBP/blrH PzGlkF9KvKObXIG+ovTtMXt2y17VqY1y9TbH6UjZNCv/6+1RNKAOnSC+YM+pwcslbsAy PQbiO1ab306rgxYdF3b+hEaU9zQOf6CM4m3USjgndz6S5PPL2a8PVcQ5YFYhyXegX64w VZOA== X-Gm-Message-State: AOAM532oA/epa1UUpBz/d/qfkFMGjU3K1MbGN4jpiMVJUimHBd3A9I9Q fB2uf0keu4dIufNqEvRJOXJC92XGk0s= X-Google-Smtp-Source: ABdhPJywvP7KnrmZJQ4/ndRKwknMl2gD157JYxOlV2HwbY2JdEkvdTCtETnLWxNeKOn3PDxH+W+3AQ== X-Received: by 2002:a17:902:7244:b029:f5:2ffd:37f9 with SMTP id c4-20020a1709027244b02900f52ffd37f9mr3449020pll.26.1622125120068; Thu, 27 May 2021 07:18:40 -0700 (PDT) Received: from muon.fritz.box ([203.221.113.127]) by smtp.gmail.com with ESMTPSA id g202sm2203966pfb.54.2021.05.27.07.18.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 May 2021 07:18:39 -0700 (PDT) From: Andrew Whatson Date: Fri, 28 May 2021 00:18:27 +1000 Message-Id: <20210527141827.2868641-1-whatson@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=whatson@gmail.com; helo=mail-pl1-x632.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) * guix/git-download.scm (git-file-list): Add prefix and recursive? arguments. Recurse into submodules when requested. (git-predicate): Add recursive? argument. --- guix/git-download.scm | 67 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 53 insertions(+), 14 deletions(-) diff --git a/guix/git-download.scm b/guix/git-download.scm index 8d8e1c865f..8094e5e5c7 100644 --- a/guix/git-download.scm +++ b/guix/git-download.scm @@ -33,6 +33,9 @@ repository-discover repository-head repository-working-directory) + #:autoload (git submodule) (repository-submodules + submodule-lookup + submodule-path) #:autoload (git commit) (commit-lookup commit-tree) #:autoload (git reference) (reference-target) #:autoload (git tree) (tree-list) @@ -194,11 +197,17 @@ HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #f." ;;; 'git-predicate'. ;;; -(define (git-file-list directory) +(define* (git-file-list directory #:optional prefix #:key (recursive? #t)) "Return the list of files checked in in the Git repository at DIRECTORY. The result is similar to that of the 'git ls-files' command, except that it -also includes directories, not just regular files. The returned file names -are relative to DIRECTORY, which is not necessarily the root of the checkout." +also includes directories, not just regular files. + +When RECURSIVE? is true, also list files in submodules, similar to the 'git +ls-files --recurse-submodules' command. This is enabled by default. + +The returned file names are relative to DIRECTORY, which is not necessarily +the root of the checkout. If a PREFIX is provided, it is prepended to each +file name." (let* (;; 'repository-working-directory' always returns a trailing "/", ;; so add one here to ease the comparisons below. (directory (string-append (canonicalize-path directory) "/")) @@ -209,27 +218,57 @@ are relative to DIRECTORY, which is not necessarily the root of the checkout." (oid (reference-target head)) (commit (commit-lookup repository oid)) (tree (commit-tree commit)) - (files (tree-list tree))) + (files (tree-list tree)) + (submodules (if recursive? + (map (lambda (name) + (submodule-path + (submodule-lookup repository name))) + (repository-submodules repository)) + '())) + (relative (and (not (string=? workdir directory)) + (string-drop directory (string-length workdir)))) + (included? (lambda (path) + (or (not relative) + (string-prefix? relative path)))) + (make-relative (lambda (path) + (if relative + (string-drop path (string-length relative)) + path))) + (add-prefix (lambda (path) + (if prefix + (string-append prefix "/" path) + path))) + (rectify (compose add-prefix make-relative))) (repository-close! repository) - (if (string=? workdir directory) - files - (let ((relative (string-drop directory (string-length workdir)))) - (filter-map (lambda (file) - (and (string-prefix? relative file) - (string-drop file (string-length relative)))) - files))))) - -(define (git-predicate directory) + (append + (if (or relative prefix) + (filter-map (lambda (file) + (and (included? file) + (rectify file))) + files) + files) + (append-map (lambda (submodule) + (if (included? submodule) + (git-file-list + (string-append workdir submodule) + (rectify submodule)) + '())) + submodules)))) + +(define* (git-predicate directory #:key (recursive? #t)) "Return a predicate that returns true if a file is part of the Git checkout living at DIRECTORY. If DIRECTORY does not lie within a Git checkout, and upon Git errors, return #f instead of a predicate. +When RECURSIVE? is true, the predicate also returns true if a file is part of +any Git submodule under DIRECTORY. This is enabled by default. + The returned predicate takes two arguments FILE and STAT where FILE is an absolute file name and STAT is the result of 'lstat'." (libgit2-init!) (catch 'git-error (lambda () - (let* ((files (git-file-list directory)) + (let* ((files (git-file-list directory #:recursive? recursive?)) (inodes (fold (lambda (file result) (let* ((path (string-append directory "/" file)) (stat (and (file-exists? path) -- 2.31.1 From unknown Mon Jun 23 13:12:15 2025 MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) X-Loop: help-debbugs@gnu.org From: help-debbugs@gnu.org (GNU bug Tracking System) To: Andrew Whatson Subject: bug#48699: closed (Re: bug#48699: [PATCH] git-download: Support submodules in 'git-predicate'.) Message-ID: References: <87r1hri2xy.fsf@gnu.org> <20210527141827.2868641-1-whatson@gmail.com> X-Gnu-PR-Message: they-closed 48699 X-Gnu-PR-Package: guix-patches X-Gnu-PR-Keywords: patch Reply-To: 48699@debbugs.gnu.org Date: Fri, 28 May 2021 10:11:02 +0000 Content-Type: multipart/mixed; boundary="----------=_1622196662-12183-1" This is a multi-part message in MIME format... ------------=_1622196662-12183-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Your bug report #48699: [PATCH] git-download: Support submodules in 'git-predicate'. which was filed against the guix-patches package, has been closed. The explanation is attached below, along with your original report. If you require more details, please reply to 48699@debbugs.gnu.org. --=20 48699: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D48699 GNU Bug Tracking System Contact help-debbugs@gnu.org with problems ------------=_1622196662-12183-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at 48699-done) by debbugs.gnu.org; 28 May 2021 10:10:43 +0000 Received: from localhost ([127.0.0.1]:53672 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmZRz-00039Y-Hl for submit@debbugs.gnu.org; Fri, 28 May 2021 06:10:43 -0400 Received: from eggs.gnu.org ([209.51.188.92]:44676) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmZRx-00039I-ST for 48699-done@debbugs.gnu.org; Fri, 28 May 2021 06:10:42 -0400 Received: from fencepost.gnu.org ([2001:470:142:3::e]:34768) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lmZRs-0005o1-Nd; Fri, 28 May 2021 06:10:36 -0400 Received: from [2a01:e0a:1d:7270:af76:b9b:ca24:c465] (port=36946 helo=ribbon) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lmZRq-0003OG-TN; Fri, 28 May 2021 06:10:36 -0400 From: =?utf-8?Q?Ludovic_Court=C3=A8s?= To: Andrew Whatson Subject: Re: bug#48699: [PATCH] git-download: Support submodules in 'git-predicate'. References: <20210527141827.2868641-1-whatson@gmail.com> Date: Fri, 28 May 2021 12:10:33 +0200 In-Reply-To: <20210527141827.2868641-1-whatson@gmail.com> (Andrew Whatson's message of "Fri, 28 May 2021 00:18:27 +1000") Message-ID: <87r1hri2xy.fsf@gnu.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 48699-done Cc: 48699-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) Andrew Whatson skribis: > * guix/git-download.scm (git-file-list): Add prefix and recursive? > arguments. Recurse into submodules when requested. > (git-predicate): Add recursive? argument. Pushed as ebbfee880c1def28b77aeb2eee640998b9fa7d5f, thanks! Ludo=E2=80=99. ------------=_1622196662-12183-1 Content-Type: message/rfc822 Content-Disposition: inline Content-Transfer-Encoding: 7bit Received: (at submit) by debbugs.gnu.org; 27 May 2021 14:18:50 +0000 Received: from localhost ([127.0.0.1]:52481 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmGqX-0004zH-GS for submit@debbugs.gnu.org; Thu, 27 May 2021 10:18:49 -0400 Received: from lists.gnu.org ([209.51.188.17]:37852) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lmGqV-0004z8-MY for submit@debbugs.gnu.org; Thu, 27 May 2021 10:18:48 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60030) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lmGqS-0000HW-3L for guix-patches@gnu.org; Thu, 27 May 2021 10:18:45 -0400 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]:41723) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lmGqP-0000qW-Uw for guix-patches@gnu.org; Thu, 27 May 2021 10:18:43 -0400 Received: by mail-pl1-x632.google.com with SMTP id z4so36792plg.8 for ; Thu, 27 May 2021 07:18:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=LxIRvnkQu52Rd9EyviM+kO435ObL1ipfudmxHdSHhBE=; b=lpkilXelZAc0rZUM6ljMY+q7gSdZypK2uOstUyN+rBHQ+TMDnYv2tEBXYiTC4lVlak MzmrMu741gItpORMxPBM6zdIYbKBe4Zn9LspJ8t1UMg6H4RzlaUge5Usw9bYKrswariJ 7JAUlCd0wkYNzy42CoVfNiaczCFdFG9FxiF//Xmbrai//Eckp0qjJiE7cRhwtdpdEx4y BVU+jqjT/mQiNmUGEp3PKpxFzFEs0vBUFFhbMjbl//fxts4egbz7sj1qvMZ7rhrH2rWQ 8a03U05Y+j5gwGPN99uGyM2HaYOUUxL2IVWv3pcs16AylAig5xbr6+NZD7cta2nczHlc i84Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=LxIRvnkQu52Rd9EyviM+kO435ObL1ipfudmxHdSHhBE=; b=eNw9TU3Sgrhabh4nB0AE9/OqD+7R/Ko7M6tWaWxoyG02Yn0mgwIjns+mnkAmgE1lgu 7SvIjifWjdsDOuTZ1D4foFkQ82V1IxxkNpfxcYocBD4vLutes0PPo5iGdShiC9xalNuW xmWTztunJ0C7oqDspgDQEoqson9pLa1P8LlsY5DCp5T6jkcr1JzUWt50Rcj1MBP/blrH PzGlkF9KvKObXIG+ovTtMXt2y17VqY1y9TbH6UjZNCv/6+1RNKAOnSC+YM+pwcslbsAy PQbiO1ab306rgxYdF3b+hEaU9zQOf6CM4m3USjgndz6S5PPL2a8PVcQ5YFYhyXegX64w VZOA== X-Gm-Message-State: AOAM532oA/epa1UUpBz/d/qfkFMGjU3K1MbGN4jpiMVJUimHBd3A9I9Q fB2uf0keu4dIufNqEvRJOXJC92XGk0s= X-Google-Smtp-Source: ABdhPJywvP7KnrmZJQ4/ndRKwknMl2gD157JYxOlV2HwbY2JdEkvdTCtETnLWxNeKOn3PDxH+W+3AQ== X-Received: by 2002:a17:902:7244:b029:f5:2ffd:37f9 with SMTP id c4-20020a1709027244b02900f52ffd37f9mr3449020pll.26.1622125120068; Thu, 27 May 2021 07:18:40 -0700 (PDT) Received: from muon.fritz.box ([203.221.113.127]) by smtp.gmail.com with ESMTPSA id g202sm2203966pfb.54.2021.05.27.07.18.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 27 May 2021 07:18:39 -0700 (PDT) From: Andrew Whatson To: guix-patches@gnu.org Subject: [PATCH] git-download: Support submodules in 'git-predicate'. Date: Fri, 28 May 2021 00:18:27 +1000 Message-Id: <20210527141827.2868641-1-whatson@gmail.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=2607:f8b0:4864:20::632; envelope-from=whatson@gmail.com; helo=mail-pl1-x632.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit Cc: Andrew Whatson X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) * guix/git-download.scm (git-file-list): Add prefix and recursive? arguments. Recurse into submodules when requested. (git-predicate): Add recursive? argument. --- guix/git-download.scm | 67 ++++++++++++++++++++++++++++++++++--------- 1 file changed, 53 insertions(+), 14 deletions(-) diff --git a/guix/git-download.scm b/guix/git-download.scm index 8d8e1c865f..8094e5e5c7 100644 --- a/guix/git-download.scm +++ b/guix/git-download.scm @@ -33,6 +33,9 @@ repository-discover repository-head repository-working-directory) + #:autoload (git submodule) (repository-submodules + submodule-lookup + submodule-path) #:autoload (git commit) (commit-lookup commit-tree) #:autoload (git reference) (reference-target) #:autoload (git tree) (tree-list) @@ -194,11 +197,17 @@ HASH-ALGO (a symbol). Use NAME as the file name, or a generic name if #f." ;;; 'git-predicate'. ;;; -(define (git-file-list directory) +(define* (git-file-list directory #:optional prefix #:key (recursive? #t)) "Return the list of files checked in in the Git repository at DIRECTORY. The result is similar to that of the 'git ls-files' command, except that it -also includes directories, not just regular files. The returned file names -are relative to DIRECTORY, which is not necessarily the root of the checkout." +also includes directories, not just regular files. + +When RECURSIVE? is true, also list files in submodules, similar to the 'git +ls-files --recurse-submodules' command. This is enabled by default. + +The returned file names are relative to DIRECTORY, which is not necessarily +the root of the checkout. If a PREFIX is provided, it is prepended to each +file name." (let* (;; 'repository-working-directory' always returns a trailing "/", ;; so add one here to ease the comparisons below. (directory (string-append (canonicalize-path directory) "/")) @@ -209,27 +218,57 @@ are relative to DIRECTORY, which is not necessarily the root of the checkout." (oid (reference-target head)) (commit (commit-lookup repository oid)) (tree (commit-tree commit)) - (files (tree-list tree))) + (files (tree-list tree)) + (submodules (if recursive? + (map (lambda (name) + (submodule-path + (submodule-lookup repository name))) + (repository-submodules repository)) + '())) + (relative (and (not (string=? workdir directory)) + (string-drop directory (string-length workdir)))) + (included? (lambda (path) + (or (not relative) + (string-prefix? relative path)))) + (make-relative (lambda (path) + (if relative + (string-drop path (string-length relative)) + path))) + (add-prefix (lambda (path) + (if prefix + (string-append prefix "/" path) + path))) + (rectify (compose add-prefix make-relative))) (repository-close! repository) - (if (string=? workdir directory) - files - (let ((relative (string-drop directory (string-length workdir)))) - (filter-map (lambda (file) - (and (string-prefix? relative file) - (string-drop file (string-length relative)))) - files))))) - -(define (git-predicate directory) + (append + (if (or relative prefix) + (filter-map (lambda (file) + (and (included? file) + (rectify file))) + files) + files) + (append-map (lambda (submodule) + (if (included? submodule) + (git-file-list + (string-append workdir submodule) + (rectify submodule)) + '())) + submodules)))) + +(define* (git-predicate directory #:key (recursive? #t)) "Return a predicate that returns true if a file is part of the Git checkout living at DIRECTORY. If DIRECTORY does not lie within a Git checkout, and upon Git errors, return #f instead of a predicate. +When RECURSIVE? is true, the predicate also returns true if a file is part of +any Git submodule under DIRECTORY. This is enabled by default. + The returned predicate takes two arguments FILE and STAT where FILE is an absolute file name and STAT is the result of 'lstat'." (libgit2-init!) (catch 'git-error (lambda () - (let* ((files (git-file-list directory)) + (let* ((files (git-file-list directory #:recursive? recursive?)) (inodes (fold (lambda (file result) (let* ((path (string-append directory "/" file)) (stat (and (file-exists? path) -- 2.31.1 ------------=_1622196662-12183-1--