From c79445b4a5ef742cb42515988c7f878eb38693ff Mon Sep 17 00:00:00 2001 From: Samuel Marchal Date: Tue, 13 Sep 2022 11:16:58 +0200 Subject: [PATCH] Use the Unison 'Name' prefix for default ignores We cannot rely on `sync_excludes_type` for default ignores, at the user can and will override it for his needs. --- lib/docker-sync/sync_strategy/unison.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/docker-sync/sync_strategy/unison.rb b/lib/docker-sync/sync_strategy/unison.rb index 7969031..67e39fa 100644 --- a/lib/docker-sync/sync_strategy/unison.rb +++ b/lib/docker-sync/sync_strategy/unison.rb @@ -101,8 +101,16 @@ def expand_ignore_strings exclude_type = 'Name' exclude_type = @options['sync_excludes_type'] unless @options['sync_excludes_type'].nil? + # use the 'Name' exclude type for all default ignores + # to prevent conflicts with the sync_excludes_type settings + unless Environment.default_ignores.nil? + expanded_ignore_strings = Environment.default_ignores.map do |pattern| + "-ignore='Name #{pattern}'" + end + end + unless @options['sync_excludes'].nil? - expanded_ignore_strings = @options['sync_excludes'].append(Environment.default_ignores).flatten!.map do |pattern| + expanded_ignore_strings = @options['sync_excludes'].map do |pattern| ignore_string = if exclude_type == 'none' # the ignore type like Name / Path are part of the pattern pattern.to_s