lib/open_project/gitolite/gitolite_wrapper/repositories_helper.rb
def handle_repositories_move(projects_list)
      # We'll need the repository root directory.
      gitolite_repos_root = OpenProject::Gitolite::GitoliteWrapper.gitolite_global_storage_path
      projects_list.each do |project|
        # Old name is the <path> section of above, thus extract it from url.
        # But remove the '.git' part.

        # Get the path (where the repo actually is) from the database in OpenProject
        old_repository_path = project.repository.url
        old_repository_relative_path = Pathname.new(old_repository_path).relative_path_from(Pathname.new(gitolite_repos_root))
        if File.dirname(old_repository_path).to_s == gitolite_repos_root.to_s.chomp("/")
          old_repository_name = File.basename(old_repository_relative_path.to_s, '.git')
        else
          old_repository_name = File.join(File.dirname(old_repository_relative_path.to_s), File.basename(old_repository_relative_path.to_s, '.git'))
        end

        # Actually move the repository
        do_move_repository(project.repository, old_repository_path, old_repository_name)

        gitolite_admin_repo_commit("#{@action} : #{project.identifier}")
      end
    end
# Move a list of git repositories to their new location
#
# The old repository location is expected to be available from its url.
# Upon moving the project (e.g., to a subproject),
# the repository's url will still reflect its old location.
Move a list of git repositories to their new location
The old repository location is expected to be available from its url.
Upon moving the project ,
the repository's url will still reflect its old location.
Move a list of git repositories to their new location The old repository location is expected to be available from its url . Upon moving the project the repository ' s url will still reflect its old location .
def handle_repositories_move(projects_list)
      gitolite_repos_root = OpenProject::Gitolite::GitoliteWrapper.gitolite_global_storage_path
      projects_list.each do |project|
        old_repository_path = project.repository.url
        old_repository_relative_path = Pathname.new(old_repository_path).relative_path_from(Pathname.new(gitolite_repos_root))
        if File.dirname(old_repository_path).to_s == gitolite_repos_root.to_s.chomp("/")
          old_repository_name = File.basename(old_repository_relative_path.to_s, '.git')
        else
          old_repository_name = File.join(File.dirname(old_repository_relative_path.to_s), File.basename(old_repository_relative_path.to_s, '.git'))
        end
        do_move_repository(project.repository, old_repository_path, old_repository_name)
        gitolite_admin_repo_commit("#{@action} : #{project.identifier}")
      end
    end
def handle_repositories_move ( projects_list ) gitolite_repos_root = OpenProject :: Gitolite :: GitoliteWrapper . gitolite_global_storage_path projects_list . each do | project | old_repository_path = project . repository . url old_repository_relative_path = Pathname . new ( old_repository_path ) . relative_path_from ( Pathname . new ( gitolite_repos_root ) ) if File . dirname ( old_repository_path ) . to_s == gitolite_repos_root . to_s . chomp ( "/" ) old_repository_name = File . basename ( old_repository_relative_path . to_s , '.git' ) else old_repository_name = File . join ( File . dirname ( old_repository_relative_path . to_s ) , File . basename ( old_repository_relative_path . to_s , '.git' ) ) end do_move_repository ( project . repository , old_repository_path , old_repository_name ) gitolite_admin_repo_commit ( "#{@action} : #{project.identifier}" ) end end
Move a list of git repositories to their new location
The old repository location is expected to be available from its url.
Move a list of git repositories to their new location The old repository location is expected to be available from its url .
# We'll need the repository root directory. # Old name is the <path> section of above, thus extract it from url. # But remove the '.git' part. # Get the path (where the repo actually is) from the database in OpenProject # Actually move the repository
projects_list