summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-05-27 11:16:50 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-05-27 11:16:50 +0300
commit10ee137e9c13271d49d7046723b1e473d62a578f (patch)
tree6067fc4be800061ef5d10e4e1ddf02c401d7ac69 /lib
parent242291850d7513731355c42e67c2f8c3cc727451 (diff)
downloadgitlab-ce-10ee137e9c13271d49d7046723b1e473d62a578f.tar.gz
Expose timeout and same_ref compare fields
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/api/entities.rb6
-rw-r--r--lib/api/repositories.rb2
2 files changed, 7 insertions, 1 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb
index eead8b18ebd..4a9220a7f49 100644
--- a/lib/api/entities.rb
+++ b/lib/api/entities.rb
@@ -210,6 +210,12 @@ module API
expose :diffs, using: Entities::RepoDiff do |compare, options|
compare.diffs
end
+
+ expose :compare_timeout do |compare, options|
+ compare.timeout
+ end
+
+ expose :same, as: :compare_same_ref
end
end
end
diff --git a/lib/api/repositories.rb b/lib/api/repositories.rb
index d59c25cf316..a587d4a7bdf 100644
--- a/lib/api/repositories.rb
+++ b/lib/api/repositories.rb
@@ -130,8 +130,8 @@ module API
# GET /projects/:id/repository/compare?from=master&to=feature
get ':id/repository/compare' do
authorize! :download_code, user_project
+ required_attributes! [:from, :to]
compare = Gitlab::Git::Compare.new(user_project.repository.raw_repository, params[:from], params[:to], MergeRequestDiff::COMMITS_SAFE_SIZE)
-
present compare, with: Entities::Compare
end
end