From 0084b8a7763b04f432579e5a19ce0c6a06136b03 Mon Sep 17 00:00:00 2001 From: Vinnie Okada Date: Mon, 6 Oct 2014 21:42:07 -0500 Subject: Display renamed files in diff views Show both the old and new filenames when viewing the diff for a renamed file. --- app/views/projects/diffs/_file.html.haml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/views/projects/diffs/_file.html.haml b/app/views/projects/diffs/_file.html.haml index c415ae2ddc8..bf7770ceedf 100644 --- a/app/views/projects/diffs/_file.html.haml +++ b/app/views/projects/diffs/_file.html.haml @@ -10,7 +10,10 @@ - if @commit.parent_ids.present? = view_file_btn(@commit.parent_id, diff_file, project) - else - %span= diff_file.new_path + - if diff_file.renamed_file + %span= "#{diff_file.old_path} renamed to #{diff_file.new_path}" + - else + %span= diff_file.new_path - if diff_file.mode_changed? %span.file-mode= "#{diff_file.diff.a_mode} → #{diff_file.diff.b_mode}" -- cgit v1.2.1 From 6093d4fd831957a5ebac4925e4b660f629b9ee60 Mon Sep 17 00:00:00 2001 From: Ben Bodenmiller Date: Mon, 27 Oct 2014 23:28:02 -0700 Subject: fix markdown formatting fix markdown formatting issue --- doc/update/6.x-or-7.x-to-7.3.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/update/6.x-or-7.x-to-7.3.md b/doc/update/6.x-or-7.x-to-7.3.md index 66853634d38..ae086cc4435 100644 --- a/doc/update/6.x-or-7.x-to-7.3.md +++ b/doc/update/6.x-or-7.x-to-7.3.md @@ -267,6 +267,7 @@ mysql> \q # Set production -> username: git # Set production -> password: the password your replaced $password with earlier sudo -u git -H editor /home/git/gitlab/config/database.yml +``` ## Things went south? Revert to previous version (6.0) -- cgit v1.2.1 From 1f62cb3ee7c4e163472c4268016ac933de26ada5 Mon Sep 17 00:00:00 2001 From: Ben Bodenmiller Date: Wed, 29 Oct 2014 19:09:24 -0700 Subject: fix git installation --- doc/install/installation.md | 1 + 1 file changed, 1 insertion(+) diff --git a/doc/install/installation.md b/doc/install/installation.md index ac6535b0c86..94bd22818e5 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -76,6 +76,7 @@ Is the system packaged Git too old? Remove it and compile from source. cd /tmp curl -L --progress https://www.kernel.org/pub/software/scm/git/git-2.1.2.tar.gz | tar xz cd git-2.1.2/ + ./configure make prefix=/usr/local all # Install into /usr/local/bin -- cgit v1.2.1 From 87fa3f0d2efd454441b838e3fd0b3645a6052c33 Mon Sep 17 00:00:00 2001 From: Ben Bodenmiller Date: Wed, 29 Oct 2014 21:18:57 -0700 Subject: ruby -> Ruby --- doc/install/installation.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/install/installation.md b/doc/install/installation.md index ac6535b0c86..76e6835c1d3 100644 --- a/doc/install/installation.md +++ b/doc/install/installation.md @@ -91,7 +91,7 @@ Then select 'Internet Site' and press enter to confirm the hostname. ## 2. Ruby -The use of ruby version managers such as [RVM](http://rvm.io/), [rbenv](https://github.com/sstephenson/rbenv) or [chruby](https://github.com/postmodern/chruby) with GitLab in production frequently leads to hard to diagnose problems. For example, GitLab Shell is called from OpenSSH and having a version manager can prevent pushing and pulling over SSH. Version managers are not supported and we strongly advise everyone to follow the instructions below to use a system ruby. +The use of Ruby version managers such as [RVM](http://rvm.io/), [rbenv](https://github.com/sstephenson/rbenv) or [chruby](https://github.com/postmodern/chruby) with GitLab in production frequently leads to hard to diagnose problems. For example, GitLab Shell is called from OpenSSH and having a version manager can prevent pushing and pulling over SSH. Version managers are not supported and we strongly advise everyone to follow the instructions below to use a system Ruby. Remove the old Ruby 1.8 if present -- cgit v1.2.1 From 822d9aa6ba150ed1983dda3cfddaaa177f6b9f97 Mon Sep 17 00:00:00 2001 From: Sean Edge Date: Wed, 24 Sep 2014 22:30:06 -0400 Subject: Create RepoTag Grape entity and present it when doing stuff with tags via API. Update API doc for repositories. Add tag message to tag list page in UI. Update Changelog. Update spec to set .gitconfig identity, required for annotated tags. --- CHANGELOG | 1 + app/views/projects/tags/_tag.html.haml | 3 +++ doc/api/repositories.md | 4 +++- lib/api/entities.rb | 19 +++++++++++++++++++ lib/api/repositories.rb | 5 +++-- spec/requests/api/repositories_spec.rb | 33 ++++++++++++++++++--------------- 6 files changed, 47 insertions(+), 18 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index f01267c460c..aeacd37b1ef 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -4,6 +4,7 @@ v 7.5.0 - Fix LDAP authentication for Git HTTP access - Fix LDAP config lookup for provider 'ldap' - Add Atlassian Bamboo CI service (Drew Blessing) + - Tie up loose ends with annotated tags: API & UI (Sean Edge) v 7.4.2 - Fix internal snippet exposing for unauthenticated users diff --git a/app/views/projects/tags/_tag.html.haml b/app/views/projects/tags/_tag.html.haml index bce105a033b..f93c1b4211f 100644 --- a/app/views/projects/tags/_tag.html.haml +++ b/app/views/projects/tags/_tag.html.haml @@ -4,6 +4,9 @@ = link_to project_commits_path(@project, tag.name), class: "" do %i.fa.fa-tag = tag.name + - if tag.message.present? +   + = tag.message .pull-right - if can? current_user, :download_code, @project = render 'projects/repositories/download_archive', ref: tag.name, btn_class: 'btn-grouped btn-group-small' diff --git a/doc/api/repositories.md b/doc/api/repositories.md index a412f60c0d9..8acf85d21c8 100644 --- a/doc/api/repositories.md +++ b/doc/api/repositories.md @@ -56,6 +56,7 @@ Parameters: [ { "name": "v1.0.0", + "message": "Release 1.0.0", "commit": { "id": "2695effb5807a22ff3d138d593fd856244e155e7", "parents": [], @@ -67,10 +68,11 @@ Parameters: "committed_date": "2012-05-28T04:42:42-07:00", "committer_email": "jack@example.com" }, - "protected": false } ] ``` +The message will be `nil` when creating a lightweight tag otherwise +it will contain the annotation. It returns 200 if the operation succeed. In case of an error, 405 with an explaining error message is returned. diff --git a/lib/api/entities.rb b/lib/api/entities.rb index 80e9470195e..d19caf5b23a 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -73,6 +73,25 @@ module API end end + class RepoTag < Grape::Entity + expose :name + expose :message do |repo_obj, _options| + if repo_obj.respond_to?(:message) + repo_obj.message + else + nil + end + end + + expose :commit do |repo_obj, options| + if repo_obj.respond_to?(:commit) + repo_obj.commit + elsif options[:project] + options[:project].repository.commit(repo_obj.target) + end + end + end + class RepoObject < Grape::Entity expose :name diff --git a/lib/api/repositories.rb b/lib/api/repositories.rb index 626d99c2649..a1a7721b288 100644 --- a/lib/api/repositories.rb +++ b/lib/api/repositories.rb @@ -23,7 +23,8 @@ module API # Example Request: # GET /projects/:id/repository/tags get ":id/repository/tags" do - present user_project.repo.tags.sort_by(&:name).reverse, with: Entities::RepoObject, project: user_project + present user_project.repo.tags.sort_by(&:name).reverse, + with: Entities::RepoTag, project: user_project end # Create tag @@ -43,7 +44,7 @@ module API if result[:status] == :success present result[:tag], - with: Entities::RepoObject, + with: Entities::RepoTag, project: user_project else render_api_error!(result[:message], 400) diff --git a/spec/requests/api/repositories_spec.rb b/spec/requests/api/repositories_spec.rb index 6e54839b677..dd7a0fc6cc8 100644 --- a/spec/requests/api/repositories_spec.rb +++ b/spec/requests/api/repositories_spec.rb @@ -34,21 +34,24 @@ describe API::API, api: true do end end - # TODO: fix this test for CI - #context 'annotated tag' do - #it 'should create a new annotated tag' do - #post api("/projects/#{project.id}/repository/tags", user), - #tag_name: 'v7.1.0', - #ref: 'master', - #message: 'tag message' - - #response.status.should == 201 - #json_response['name'].should == 'v7.1.0' - # The message is not part of the JSON response. - # Additional changes to the gitlab_git gem may be required. - # json_response['message'].should == 'tag message' - #end - #end + context 'annotated tag' do + it 'should create a new annotated tag' do + # Identity must be set in .gitconfig to create annotated tag. + repo_path = File.join(Gitlab.config.gitlab_shell.repos_path, + project.path_with_namespace + '.git') + system(*%W(git --git-dir=#{repo_path} config user.name #{user.name})) + system(*%W(git --git-dir=#{repo_path} config user.email #{user.email})) + + post api("/projects/#{project.id}/repository/tags", user), + tag_name: 'v7.1.0', + ref: 'master', + message: 'Release 7.1.0' + + response.status.should == 201 + json_response['name'].should == 'v7.1.0' + json_response['message'].should == 'Release 7.1.0' + end + end it 'should deny for user without push access' do post api("/projects/#{project.id}/repository/tags", user2), -- cgit v1.2.1