From 9ce2e5be41c0a1dc509037534a57918bc7a724d2 Mon Sep 17 00:00:00 2001 From: Arun Isaac Date: Wed, 4 Oct 2023 16:21:45 +0100 Subject: forge: Set repository ownership only when user field is set. * guix/forge/forge.scm (forge-activation): Set repository ownership only when user field is set. --- guix/forge/forge.scm | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'guix') diff --git a/guix/forge/forge.scm b/guix/forge/forge.scm index e3a6504..ca8128c 100644 --- a/guix/forge/forge.scm +++ b/guix/forge/forge.scm @@ -158,11 +158,16 @@ (when description (call-with-output-file (string-append repository "/description") (cut put-string <> description))) - ;; Set ownership of repository files. - (for-each (lambda (file) - (let ((user (getpw username))) - (chown file (passwd:uid user) (passwd:gid user)))) - (append (find-regular-files repository)))) + ;; Set ownership of repository files when the + ;; user field is set. This enables setups where + ;; ownership is manually managed. TODO: Rethink + ;; this when we move to repositories owned and + ;; operated on by virtual users. + (when username + (for-each (lambda (file) + (let ((user (getpw username))) + (chown file (passwd:uid user) (passwd:gid user)))) + (append (find-regular-files repository))))) ;; Install post receive hook. (when (eq? ci-jobs-trigger-type 'post-receive-hook) (let ((hook-link (string-append repository "/hooks/post-receive"))) -- cgit v1.2.3