From 9ec542844117426e45eb0a65115045c8e7a5dd44 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Fri, 24 Jul 2020 00:48:05 -0400 Subject: [PATCH] Set core.autocrlf = true in repos on Windows #2637 Line encoding issues can plague repos with dirty worktree prompts updating packages or "Local variables entry is missing the suffix" errors when installing them. --- core/cli/packages.el | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/core/cli/packages.el b/core/cli/packages.el index 76e949d51..f00b3183e 100644 --- a/core/cli/packages.el +++ b/core/cli/packages.el @@ -143,7 +143,16 @@ declaration) or dependency thereof that hasn't already been." (when-let (commit (cdr (assoc pkg pinned))) (print! (info "Checked out %s") commit))) straight-use-package-pre-build-functions))) - (straight-use-package (intern package))) + (straight-use-package (intern package)) + ;; HACK Line encoding issues can plague repos with dirty + ;; worktree prompts when updating packages or "Local + ;; variables entry is missing the suffix" errors when + ;; installing them (see hlissner/doom-emacs#2637), so + ;; have git handle conversion by force. + (when (and IS-WINDOWS (stringp local-repo)) + (let ((default-directory (straight--repos-dir local-repo))) + (when (file-in-directory-p default-directory straight-base-dir) + (straight--call "git" "config" "core.autocrlf" "true"))))) (error (signal 'doom-package-error (list package e)))))) (print! (success "Installed %d packages")