t.integer "assignee_id"
t.integer "author_id"
t.integer "project_id"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.boolean "closed", :default => false, :null => false
t.integer "position", :default => 0
t.boolean "critical", :default => false, :null => false
create_table "keys", :force => true do |t|
t.integer "user_id"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.text "key"
t.string "title"
t.string "identifier"
t.integer "assignee_id"
t.string "title"
t.boolean "closed", :default => false, :null => false
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.text "st_commits"
t.text "st_diffs"
t.boolean "merged", :default => false, :null => false
- t.integer "state", :default => 1, :null => false
+ t.boolean "auto_merge", :default => true, :null => false
end
add_index "merge_requests", ["project_id"], :name => "index_merge_requests_on_project_id"
t.string "noteable_id"
t.string "noteable_type"
t.integer "author_id"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.integer "project_id"
t.string "attachment"
t.string "line_code"
t.string "name"
t.string "path"
t.text "description"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.boolean "private_flag", :default => true, :null => false
t.string "code"
t.integer "owner_id"
t.text "content"
t.integer "author_id", :null => false
t.integer "project_id", :null => false
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.string "file_name"
t.datetime "expires_at"
end
t.datetime "last_sign_in_at"
t.string "current_sign_in_ip"
t.string "last_sign_in_ip"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.string "name"
t.boolean "admin", :default => false, :null => false
t.integer "projects_limit", :default => 10
create_table "users_projects", :force => true do |t|
t.integer "user_id", :null => false
t.integer "project_id", :null => false
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
t.integer "project_access", :default => 0, :null => false
end
create_table "web_hooks", :force => true do |t|
t.string "url"
t.integer "project_id"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
create_table "wikis", :force => true do |t|
class GitlabMerge
- attr_accessor :project, :merge_path, :merge_request
+ attr_accessor :project, :merge_path, :merge_request, :user
- def initialize(merge_request)
+ def initialize(merge_request, user)
+ self.user = user
self.merge_request = merge_request
self.project = merge_request.project
self.merge_path = File.join(Rails.root, "tmp", "merge_repo", project.path, merge_request.id.to_s)
self.project.repo.git.clone({:branch => merge_request.target_branch}, project.url_to_repo, merge_path)
Dir.chdir(merge_path) do
merge_repo = Grit::Repo.new('.')
- output = merge_repo.git.pull({}, "origin", merge_request.source_branch)
+ merge_repo.git.sh "git config user.name \"#{user.name}\""
+ merge_repo.git.sh "git config user.email \"#{user.email}\""
+ output = merge_repo.git.pull({}, "--no-ff", "origin", merge_request.source_branch)
yield(merge_repo, output)
end
end