Commits

Eugenio Piasini committed 706d29d

Improved 'hg pull' call to avoid cd'ing to the repo directory.

  • Participants
  • Parent commits 6e26cf2

Comments (0)

Files changed (1)

File app/controllers/bitbucket_hook_controller.rb

 
     project = Project.find_by_identifier(identifier)
     raise ActiveRecord::RecordNotFound, "No project found with identifier '#{identifier}'" if project.nil?
-    
+
     repository = project.repository
     raise TypeError, "Project '#{identifier}' has no repository" if repository.nil?
     raise TypeError, "Repository for project '#{identifier}' is not a BitBucket repository" unless repository.is_a?(Repository::Mercurial) || repository.is_a?(Repository::Git)
     if repository.is_a?(Repository::Git)
       update_git_repository(repository)
     else
-      command = "cd \"#{repository.url}\" && hg pull"
+      command = "hg --repository \"#{repository.url}\" pull"
       exec(command)
     end
 
   end
 
   private
-  
+
   def exec(command)
     logger.info { "BitbucketHook: Executing command: '#{command}'" }
     output = Kernel.system("#{command}")