Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/app
diff options
context:
space:
mode:
authorrandx <dmitriy.zaporozhets@gmail.com>2012-08-11 16:59:36 +0400
committerrandx <dmitriy.zaporozhets@gmail.com>2012-08-11 16:59:36 +0400
commit731b6be9c929d9117c322c605a7f53a8319751cd (patch)
tree42de1835fbbda6ddec70cdb234ff6cfe13b92004 /app
parentac525a74ee2862d0012a443059954288d4634acd (diff)
Handle app crash on huge commits
Diffstat (limited to 'app')
-rw-r--r--app/contexts/commit_load.rb11
-rw-r--r--app/controllers/commits_controller.rb5
2 files changed, 12 insertions, 4 deletions
diff --git a/app/contexts/commit_load.rb b/app/contexts/commit_load.rb
index f57c49692ca..81fb4925cc8 100644
--- a/app/contexts/commit_load.rb
+++ b/app/contexts/commit_load.rb
@@ -5,7 +5,8 @@ class CommitLoad < BaseContext
suppress_diff: false,
line_notes: [],
notes_count: 0,
- note: nil
+ note: nil,
+ status: :ok
}
commit = project.commit(params[:id])
@@ -14,11 +15,17 @@ class CommitLoad < BaseContext
commit = CommitDecorator.decorate(commit)
line_notes = project.commit_line_notes(commit)
- result[:suppress_diff] = true if commit.diffs.size > 200 && !params[:force_show_diff]
result[:commit] = commit
result[:note] = project.build_commit_note(commit)
result[:line_notes] = line_notes
result[:notes_count] = line_notes.count + project.commit_notes(commit).count
+
+ begin
+ result[:suppress_diff] = true if commit.diffs.size > 200 && !params[:force_show_diff]
+ rescue Grit::Git::GitTimeout
+ result[:suppress_diff] = true
+ result[:status] = :huge_commit
+ end
end
result
diff --git a/app/controllers/commits_controller.rb b/app/controllers/commits_controller.rb
index 861fc3245a9..717912d9e92 100644
--- a/app/controllers/commits_controller.rb
+++ b/app/controllers/commits_controller.rb
@@ -41,8 +41,9 @@ class CommitsController < ApplicationController
return git_not_found!
end
- rescue Grit::Git::GitTimeout
- render "huge_commit"
+ if result[:status] == :huge_commit
+ render "huge_commit" and return
+ end
end
def compare