quilt-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Quilt-dev] [PATCH v2 5/7] quilt.el: Make quilt-patches-directory return


From: Ondřej Lysoněk
Subject: [Quilt-dev] [PATCH v2 5/7] quilt.el: Make quilt-patches-directory return per-project setting
Date: Sat, 30 May 2020 18:17:22 +0200

When creating the .pc/ directory, quilt writes the value of
QUILT_PATCHES to .pc/.quilt_patches. On all subsequent invocations,
quilt uses the contents of .pc/.quilt_patches as the value of
QUILT_PATCHES, rather than the value set in quiltrc.

All the callers in quilt.el really expect the per-project setting from
.pc/.quilt_patches, so return the value set therein if present.

Signed-off-by: Ondřej Lysoněk <olysonek@redhat.com>
---
 lib/quilt.el | 13 ++++++++++++-
 1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/lib/quilt.el b/lib/quilt.el
index ca55980..fb6df35 100644
--- a/lib/quilt.el
+++ b/lib/quilt.el
@@ -48,9 +48,20 @@
           (kill-buffer (current-buffer))))
       (getenv var)))
 
+(defun quilt--per-project-patches-directory ()
+  (let ((qd (quilt-dir)))
+    (if qd
+        (let ((project-config (concat qd "/"
+                                      (quilt-pc-directory) "/.quilt_patches")))
+          (if (file-readable-p project-config)
+              (with-temp-buffer
+                (insert-file-contents-literally project-config)
+                (substring (buffer-string) 0 -1)))))))
+
 (defun quilt-patches-directory ()
   "Return the location of patch files."
-  (or (quilt--get-config-variable "QUILT_PATCHES")
+  (or (quilt--per-project-patches-directory)
+      (quilt--get-config-variable "QUILT_PATCHES")
       "patches"))
 
 (defun quilt-pc-directory ()
-- 
2.25.4




reply via email to

[Prev in Thread] Current Thread [Next in Thread]