@@ -350,8 +350,8 @@ def restore_git_hosting_values
350
350
@@old_valuehash [ :gitolite_ssh_private_key ] != valuehash [ :gitolite_ssh_private_key ] ||
351
351
@@old_valuehash [ :gitolite_ssh_public_key ] != valuehash [ :gitolite_ssh_public_key ] ||
352
352
@@old_valuehash [ :gitolite_server_port ] != valuehash [ :gitolite_server_port ]
353
- # Need to update scripts
354
- RedmineGitolite ::Scripts . update_scripts
353
+
354
+ RedmineGitolite ::Scripts . update_scripts
355
355
end
356
356
357
357
@@ -360,7 +360,8 @@ def restore_git_hosting_values
360
360
@@old_valuehash [ :gitolite_redmine_storage_dir ] != valuehash [ :gitolite_redmine_storage_dir ] ||
361
361
@@old_valuehash [ :hierarchical_organisation ] != valuehash [ :hierarchical_organisation ]
362
362
# Need to update everyone!
363
- projects = Project . active_or_archived . includes ( :repositories ) . all . select { |x | x if x . parent_id . nil? }
363
+ # We take all root projects (even those who are closed) and move each hierarchy individually
364
+ projects = Project . includes ( :repositories ) . all . select { |x | x if x . parent_id . nil? }
364
365
if projects . length > 0
365
366
RedmineGitolite ::GitHosting . logger . info { "Gitolite configuration has been modified : repositories hierarchy" }
366
367
RedmineGitolite ::GitHosting . logger . info { "Resync all projects (root projects : '#{ projects . length } ')..." }
@@ -371,17 +372,21 @@ def restore_git_hosting_values
371
372
372
373
## Gitolite config file has changed, create a new one!
373
374
if @@old_valuehash [ :gitolite_config_file ] != valuehash [ :gitolite_config_file ] ||
374
- @@old_valuehash [ :gitolite_config_has_admin_key ] != valuehash [ :gitolite_config_has_admin_key ] ||
375
- @@old_valuehash [ :gitolite_notify_global_prefix ] != valuehash [ :gitolite_notify_global_prefix ] ||
375
+ @@old_valuehash [ :gitolite_config_has_admin_key ] != valuehash [ :gitolite_config_has_admin_key ]
376
+
377
+ RedmineGitolite ::GitHosting . logger . info { "Gitolite configuration has been modified, resync all projects (active, closed, archived)..." }
378
+ RedmineGitolite ::GitHosting . resync_gitolite ( :update_projects , 'all' )
379
+ end
380
+
381
+
382
+ ## Gitolite default values has changed, update active projects
383
+ if @@old_valuehash [ :gitolite_notify_global_prefix ] != valuehash [ :gitolite_notify_global_prefix ] ||
376
384
@@old_valuehash [ :gitolite_notify_global_sender_address ] != valuehash [ :gitolite_notify_global_sender_address ] ||
377
385
@@old_valuehash [ :gitolite_notify_global_include ] != valuehash [ :gitolite_notify_global_include ] ||
378
386
@@old_valuehash [ :gitolite_notify_global_exclude ] != valuehash [ :gitolite_notify_global_exclude ]
379
- # Need to update everyone!
380
- projects = Project . active_or_archived . includes ( :repositories ) . all
381
- if projects . length > 0
382
- RedmineGitolite ::GitHosting . logger . info { "Gitolite configuration has been modified, resync all projects..." }
383
- RedmineGitolite ::GitHosting . resync_gitolite ( :update_projects , 'all' )
384
- end
387
+
388
+ RedmineGitolite ::GitHosting . logger . info { "Gitolite configuration has been modified, resync all active projects..." }
389
+ RedmineGitolite ::GitHosting . resync_gitolite ( :update_projects , 'active' )
385
390
end
386
391
387
392
@@ -394,13 +399,8 @@ def restore_git_hosting_values
394
399
395
400
## A resync has been asked within the interface, update all projects in force mode
396
401
if @@resync_projects == true
397
- # Need to update everyone!
398
- projects = Project . active_or_archived . includes ( :repositories ) . all
399
- if projects . length > 0
400
- RedmineGitolite ::GitHosting . logger . info { "Forced resync of all projects (#{ projects . length } )..." }
401
- RedmineGitolite ::GitHosting . resync_gitolite ( :update_projects , 'all' , { :force => true } )
402
- end
403
-
402
+ RedmineGitolite ::GitHosting . logger . info { "Forced resync of all projects (active, closed, archived)..." }
403
+ RedmineGitolite ::GitHosting . resync_gitolite ( :update_projects , 'all' , { :force => true } )
404
404
@@resync_projects = false
405
405
end
406
406
0 commit comments