@@ -150,34 +150,32 @@ if lfs.attributes(remote_config_dir, 'mode') == 'directory' then
150150 -- if there's no backup of the file yet, create one
151151 if not utils .file_exists (stored_path ) then
152152 os.execute (' cp ' .. standard_path .. ' ' .. stored_path )
153- if utils .file_exists (remote_path ) then
154- for key , section in pairs (stored :get_all (file )) do
155- -- check if section is in remote configuration
156- local section_check = check :get (file , section [' .name' ])
157- if section_check then
158- -- check if options is in remote configuration
159- for option , value in pairs (section ) do
160- if not utils .starts_with_dot (option ) then
161- local option_check = check :get (file , section [' .name' ], option )
162- if option_check then
163- -- if option is in remote configuration, remove it
164- stored :delete (file , section [' .name' ], option )
165- end
153+ for key , section in pairs (stored :get_all (file )) do
154+ -- check if section is in remote configuration
155+ local section_check = check :get (file , section [' .name' ])
156+ if section_check then
157+ -- check if options is in remote configuration
158+ for option , value in pairs (section ) do
159+ if not utils .starts_with_dot (option ) then
160+ local option_check = check :get (file , section [' .name' ], option )
161+ if option_check then
162+ -- if option is in remote configuration, remove it
163+ stored :delete (file , section [' .name' ], option )
166164 end
167165 end
168- -- remove entire section if empty
169- local result = stored : get_all ( file , section [ ' .name ' ])
170- if result and utils . is_uci_empty ( result ) then
171- stored : delete ( file , section [ ' .name ' ])
172- end
166+ end
167+ -- remove entire section if empty
168+ local result = stored : get_all ( file , section [ ' .name ' ])
169+ if result and utils . is_uci_empty ( result ) then
170+ stored : delete ( file , section [ ' .name ' ])
173171 end
174172 end
175- stored : commit ( file )
176- -- remove uci file if empty
177- local uci_file = stored : get_all ( file )
178- if uci_file and utils . is_table_empty ( uci_file ) then
179- os.remove ( stored_path )
180- end
173+ end
174+ stored : commit ( file )
175+ -- remove uci file if empty
176+ local uci_file = stored : get_all ( file )
177+ if uci_file and utils . is_table_empty ( uci_file ) then
178+ os.remove ( stored_path )
181179 end
182180 end
183181 -- MERGE mode
0 commit comments