Do not delete other folders/files in top level destination when syncing
jnboehm opened this issue · comments
I have other folders in the top-level directory of the destination wehre I want to publish my blog. When I sync with the provided command, it will delete all files in the directory. What I would like is that only those files that are touched by hugo itself. rsync
provides this capability when globbing (*
operator) the source files. This means that there might be orphaned files created by hugo in the top-level directory, but I think the trade-off is worth it, as it prevents the surprised of finding unrelated files in the same directory deleted.
I have pasted a patch created with git format-patch
.
From 023140b71cf1d1f98774405cd6628c9a848f3cc7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan=20Niklas=20B=C3=B6hm?= <mail@jnboehm.com>
Date: Thu, 4 Jan 2018 03:20:48 +0100
Subject: [PATCH] Do not delete other top level dirs in sync folder
---
easy-hugo.el | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/easy-hugo.el b/easy-hugo.el
index 9e0537f..d3c607a 100644
--- a/easy-hugo.el
+++ b/easy-hugo.el
@@ -453,7 +453,7 @@ Report an error if hugo is not installed, or if `easy-hugo-basedir' is unset."
(error "'hugo --destination public' command does not end normally")))
(when (get-buffer "*hugo-publish*")
(kill-buffer "*hugo-publish*"))
- (shell-command-to-string (concat "rsync -rtpl --chmod=" easy-hugo-publish-chmod " --delete public/ " easy-hugo-sshdomain ":" (shell-quote-argument easy-hugo-root)))
+ (shell-command-to-string (concat "rsync -rtpl --chmod=" easy-hugo-publish-chmod " --delete public/* " easy-hugo-sshdomain ":" (shell-quote-argument easy-hugo-root)))
(message "Blog published")
(when easy-hugo-url
(browse-url easy-hugo-url))))
--
2.15.1
Okay, that looks good and works for me as expected. Thanks!