[PATCH v2 compass-ci 2/2] git_mirror.rb: reload more internal files when DEFAULTS change

DEFAULTS files are used by many files in the inner directory, so when DEFAULTS files change, those inner files should also be reload. Signed-off-by: Li Yuanchao <lyc163mail@163.com> --- lib/git_mirror.rb | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/lib/git_mirror.rb b/lib/git_mirror.rb index 6417b52..017153f 100644 --- a/lib/git_mirror.rb +++ b/lib/git_mirror.rb @@ -285,10 +285,11 @@ class MirrorMain def reload(file_list, belong) system("git -C #{REPO_DIR}/#{belong} pull") + reload_defaults(file_list, belong) file_list.each_line do |file| - next if File.basename(file) == '.ignore' - file = file.chomp + next if File.basename(file) == '.ignore' || File.basename(file) == 'DEFAULTS' + repo_dir = "#{REPO_DIR}/#{belong}/#{file}" load_repo_file(repo_dir, File.dirname(file), File.basename(file), belong) if File.file?(repo_dir) end @@ -497,4 +498,15 @@ class MirrorMain end return false end + + def reload_defaults(file_list, belong) + file_list.each_line do |file| + file = file.chomp + next unless File.basename(file) == 'DEFAULTS' + + repodir = "#{REPO_DIR}/#{belong}/#{File.dirname(file)}" + load_defaults(repodir, belong) + traverse_repodir(repodir, belong) + end + end end -- 2.23.0

On Mon, Mar 01, 2021 at 08:18:25PM +0800, Li Yuanchao wrote:
DEFAULTS files are used by many files in the inner directory, so when DEFAULTS files change, those inner files should also be reload.
Signed-off-by: Li Yuanchao <lyc163mail@163.com> --- lib/git_mirror.rb | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/lib/git_mirror.rb b/lib/git_mirror.rb index 6417b52..017153f 100644 --- a/lib/git_mirror.rb +++ b/lib/git_mirror.rb @@ -285,10 +285,11 @@ class MirrorMain
def reload(file_list, belong) system("git -C #{REPO_DIR}/#{belong} pull") + reload_defaults(file_list, belong) file_list.each_line do |file| - next if File.basename(file) == '.ignore' - file = file.chomp + next if File.basename(file) == '.ignore' || File.basename(file) == 'DEFAULTS'
you can use: next if File.basename(file).match? /.ignore|DEFAULTS/ or next if %w[.ignore DEFAULTS].include? File.basename(file) Thanks, Luan Shengde
+ repo_dir = "#{REPO_DIR}/#{belong}/#{file}" load_repo_file(repo_dir, File.dirname(file), File.basename(file), belong) if File.file?(repo_dir) end @@ -497,4 +498,15 @@ class MirrorMain end return false end + + def reload_defaults(file_list, belong) + file_list.each_line do |file| + file = file.chomp + next unless File.basename(file) == 'DEFAULTS' + + repodir = "#{REPO_DIR}/#{belong}/#{File.dirname(file)}" + load_defaults(repodir, belong) + traverse_repodir(repodir, belong) + end + end end -- 2.23.0

On Tue, Mar 02, 2021 at 09:25:37AM +0800, Luan Shengde wrote:
On Mon, Mar 01, 2021 at 08:18:25PM +0800, Li Yuanchao wrote:
DEFAULTS files are used by many files in the inner directory, so when DEFAULTS files change, those inner files should also be reload.
Signed-off-by: Li Yuanchao <lyc163mail@163.com> --- lib/git_mirror.rb | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/lib/git_mirror.rb b/lib/git_mirror.rb index 6417b52..017153f 100644 --- a/lib/git_mirror.rb +++ b/lib/git_mirror.rb @@ -285,10 +285,11 @@ class MirrorMain
def reload(file_list, belong) system("git -C #{REPO_DIR}/#{belong} pull") + reload_defaults(file_list, belong) file_list.each_line do |file| - next if File.basename(file) == '.ignore' - file = file.chomp + next if File.basename(file) == '.ignore' || File.basename(file) == 'DEFAULTS'
you can use: next if File.basename(file).match? /.ignore|DEFAULTS/ or next if %w[.ignore DEFAULTS].include? File.basename(file)
ok Thanks, Yuanchao
participants (2)
-
Li Yuanchao
-
Luan Shengde