From b5e567bb2b277f89af493ba8cd0799fdb368a184 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ludovic=20Court=C3=A8s?= Date: Mon, 14 Apr 2025 16:54:45 +0200 Subject: [PATCH] =?UTF-8?q?git:=20Override=20the=20user=E2=80=99s=20?= =?UTF-8?q?=E2=80=98core.autocrlf=E2=80=99=20settings.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes . Fixes a bug whereby setting ‘core.autocrlf’ to ‘true’ in ~/.gitconfig would lead ‘guix pull’ & co. to obtain non-bit-identical files, including possibly syntactically-invalid Scheme files. * guix/git.scm (clone*): Set ‘core.autocrlf’ to ‘input’. Reported-by: Jodi Jodingtonstinski Change-Id: I11fb20813a9fc1e14828ca8ebf5092c4b1181e5c --- guix/git.scm | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/guix/git.scm b/guix/git.scm index 4164531c0b6..01e09185885 100644 --- a/guix/git.scm +++ b/guix/git.scm @@ -1,6 +1,6 @@ ;;; GNU Guix --- Functional package management for GNU ;;; Copyright © 2017, 2020 Mathieu Othacehe -;;; Copyright © 2018-2024 Ludovic Courtès +;;; Copyright © 2018-2025 Ludovic Courtès ;;; Copyright © 2021 Kyle Meyer ;;; Copyright © 2021 Marius Bakke ;;; Copyright © 2022 Maxime Devos @@ -236,10 +236,18 @@ make sure no empty directory is left behind." (lambda () (mkdir-p directory) - (clone url directory - (make-clone-options - #:fetch-options (make-default-fetch-options - #:verify-certificate? verify-certificate?)))) + (let* ((repository + (clone url directory + (make-clone-options + #:fetch-options (make-default-fetch-options + #:verify-certificate? + verify-certificate?)))) + (config (repository-config repository))) + ;; Override 'core.autocrlf' as set in ~/.gitconfig to ensure files are + ;; left unchanged when cloning and pulling. + (set-config-string config "core.autocrlf" "input") + + repository)) (lambda _ (false-if-exception (rmdir directory)))))