Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Tatuya Kamada
gitlab-ce
Commits
562242cb
Commit
562242cb
authored
Jul 26, 2015
by
Stan Hu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix commit data retrieval when branch name has single quotes
Closes #1724
parent
4a76cbe2
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
39 additions
and
5 deletions
+39
-5
CHANGELOG
CHANGELOG
+1
-0
app/controllers/projects/refs_controller.rb
app/controllers/projects/refs_controller.rb
+6
-0
app/views/projects/refs/logs_tree.js.haml
app/views/projects/refs/logs_tree.js.haml
+5
-3
app/views/projects/tree/_tree.html.haml
app/views/projects/tree/_tree.html.haml
+1
-1
features/project/source/browse_files.feature
features/project/source/browse_files.feature
+7
-0
features/steps/project/source/browse_files.rb
features/steps/project/source/browse_files.rb
+17
-0
spec/support/test_env.rb
spec/support/test_env.rb
+2
-1
No files found.
CHANGELOG
View file @
562242cb
Please view this file on the master branch, on stable branches it's out of date.
Please view this file on the master branch, on stable branches it's out of date.
v 7.14.0 (unreleased)
v 7.14.0 (unreleased)
- Fix commit data retrieval when branch name has single quotes (Stan Hu)
- Fix Error 500 when browsing projects with no HEAD (Stan Hu)
- Fix Error 500 when browsing projects with no HEAD (Stan Hu)
- Fix full screen mode for snippet comments (Daniel Gerhardt)
- Fix full screen mode for snippet comments (Daniel Gerhardt)
- Fix 404 error in files view after deleting the last file in a repository (Stan Hu)
- Fix 404 error in files view after deleting the last file in a repository (Stan Hu)
...
...
app/controllers/projects/refs_controller.rb
View file @
562242cb
class
Projects::RefsController
<
Projects
::
ApplicationController
class
Projects::RefsController
<
Projects
::
ApplicationController
include
ExtractsPath
include
ExtractsPath
include
TreeHelper
before_action
:require_non_empty_project
before_action
:require_non_empty_project
before_action
:assign_ref_vars
before_action
:assign_ref_vars
...
@@ -60,6 +61,11 @@ class Projects::RefsController < Projects::ApplicationController
...
@@ -60,6 +61,11 @@ class Projects::RefsController < Projects::ApplicationController
}
}
end
end
if
@logs
.
present?
@log_url
=
namespace_project_tree_url
(
@project
.
namespace
,
@project
,
tree_join
(
@ref
,
@path
||
'/'
))
@more_log_url
=
logs_file_namespace_project_ref_path
(
@project
.
namespace
,
@project
,
@ref
,
@path
||
''
,
offset:
(
@offset
+
@limit
))
end
respond_to
do
|
format
|
respond_to
do
|
format
|
format
.
html
{
render_404
}
format
.
html
{
render_404
}
format
.
js
format
.
js
...
...
app/views/projects/refs/logs_tree.js.haml
View file @
562242cb
...
@@ -11,9 +11,11 @@
...
@@ -11,9 +11,11 @@
-
if
@logs
.
present?
-
if
@logs
.
present?
:plain
:plain
var current_url = location.href.replace(/\/?$/, '/');
var current_url = location.href.replace(/\/?$/, '/');
var log_url = '
#{
namespace_project_tree_url
(
@project
.
namespace
,
@project
,
tree_join
(
@ref
,
@path
||
'/'
))
}
'.replace(/\/?$/, '/');
var log_url = "
#{
escape_javascript
(
@log_url
)
}
".replace(/\/?$/, '/');
if(current_url == log_url) {
if(current_url == log_url) {
// Load
10 more commit log
for each file in tree
// Load
more commit logs
for each file in tree
// if we still on the same page
// if we still on the same page
ajaxGet('
#{
logs_file_namespace_project_ref_path
(
@project
.
namespace
,
@project
,
@ref
,
@path
||
''
,
offset:
(
@offset
+
@limit
))
}
');
var url = "
#{
escape_javascript
(
@more_log_url
)
}
";
ajaxGet(url);
}
}
app/views/projects/tree/_tree.html.haml
View file @
562242cb
...
@@ -49,5 +49,5 @@
...
@@ -49,5 +49,5 @@
:javascript
:javascript
// Load last commit log for each file in tree
// Load last commit log for each file in tree
$
(
'
#tree-slider
'
).
waitForImages
(
function
()
{
$
(
'
#tree-slider
'
).
waitForImages
(
function
()
{
ajaxGet
(
'
#{
@logs_path
}
'
);
ajaxGet
(
"
#{
escape_javascript
(
@logs_path
)
}
"
);
});
});
features/project/source/browse_files.feature
View file @
562242cb
...
@@ -158,3 +158,10 @@ Feature: Project Source Browse Files
...
@@ -158,3 +158,10 @@ Feature: Project Source Browse Files
Given
I visit project source page for
"6d394385cf567f80a8fd85055db1ab4c5295806f"
Given
I visit project source page for
"6d394385cf567f80a8fd85055db1ab4c5295806f"
And
I click on
".gitignore"
file in repo
And
I click on
".gitignore"
file in repo
Then
I don't see the permalink link
Then
I don't see the permalink link
@javascript
Scenario
:
I
browse code with single quotes in the ref
Given
I switch ref to 'test'
And
I see the ref 'test' has been selected
And
I visit the 'test' tree
Then
I see the commit data
features/steps/project/source/browse_files.rb
View file @
562242cb
...
@@ -193,6 +193,23 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
...
@@ -193,6 +193,23 @@ class Spinach::Features::ProjectSourceBrowseFiles < Spinach::FeatureSteps
FileUtils
.
rm_f
(
File
.
join
(
@project
.
repository
.
path
,
'hooks'
,
'pre-receive'
))
FileUtils
.
rm_f
(
File
.
join
(
@project
.
repository
.
path
,
'hooks'
,
'pre-receive'
))
end
end
step
"I switch ref to 'test'"
do
select
"'test'"
,
from:
'ref'
end
step
"I see the ref 'test' has been selected"
do
expect
(
page
).
to
have_selector
'.select2-chosen'
,
text:
"'test'"
end
step
"I visit the 'test' tree"
do
visit
namespace_project_tree_path
(
@project
.
namespace
,
@project
,
"'test'"
)
end
step
'I see the commit data'
do
expect
(
page
).
to
have_css
(
'.tree-commit-link'
,
visible:
true
)
expect
(
page
).
not_to
have_content
(
'Loading commit data...'
)
end
private
private
def
set_new_content
def
set_new_content
...
...
spec/support/test_env.rb
View file @
562242cb
...
@@ -12,7 +12,8 @@ module TestEnv
...
@@ -12,7 +12,8 @@ module TestEnv
'fix'
=>
'12d65c8'
,
'fix'
=>
'12d65c8'
,
'improve/awesome'
=>
'5937ac0'
,
'improve/awesome'
=>
'5937ac0'
,
'markdown'
=>
'0ed8c6c'
,
'markdown'
=>
'0ed8c6c'
,
'master'
=>
'5937ac0'
'master'
=>
'5937ac0'
,
"'test'"
=>
'e56497b'
,
}
}
# gitlab-test-fork is a fork of gitlab-fork, but we don't necessarily
# gitlab-test-fork is a fork of gitlab-fork, but we don't necessarily
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment