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
Boxiang Sun
gitlab-ce
Commits
3530274b
Commit
3530274b
authored
Jun 15, 2018
by
Phil Hughes
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
only return last_commit_sha in the JSON
parent
e906be2f
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
13 deletions
+8
-13
app/assets/javascripts/ide/stores/mutations/file.js
app/assets/javascripts/ide/stores/mutations/file.js
+1
-1
app/assets/javascripts/ide/stores/utils.js
app/assets/javascripts/ide/stores/utils.js
+2
-1
app/controllers/projects/blob_controller.rb
app/controllers/projects/blob_controller.rb
+2
-2
spec/javascripts/ide/stores/modules/commit/actions_spec.js
spec/javascripts/ide/stores/modules/commit/actions_spec.js
+1
-3
spec/javascripts/ide/stores/utils_spec.js
spec/javascripts/ide/stores/utils_spec.js
+2
-6
No files found.
app/assets/javascripts/ide/stores/mutations/file.js
View file @
3530274b
...
@@ -47,7 +47,7 @@ export default {
...
@@ -47,7 +47,7 @@ export default {
baseRaw
:
null
,
baseRaw
:
null
,
html
:
data
.
html
,
html
:
data
.
html
,
size
:
data
.
size
,
size
:
data
.
size
,
lastCommit
:
data
.
last_commit
,
lastCommit
Sha
:
data
.
last_commit_sha
,
});
});
},
},
[
types
.
SET_FILE_RAW_DATA
](
state
,
{
file
,
raw
})
{
[
types
.
SET_FILE_RAW_DATA
](
state
,
{
file
,
raw
})
{
...
...
app/assets/javascripts/ide/stores/utils.js
View file @
3530274b
...
@@ -17,6 +17,7 @@ export const dataStructure = () => ({
...
@@ -17,6 +17,7 @@ export const dataStructure = () => ({
changed
:
false
,
changed
:
false
,
staged
:
false
,
staged
:
false
,
lastCommitPath
:
''
,
lastCommitPath
:
''
,
lastCommitSha
:
''
,
lastCommit
:
{
lastCommit
:
{
id
:
''
,
id
:
''
,
url
:
''
,
url
:
''
,
...
@@ -112,7 +113,7 @@ export const createCommitPayload = ({ branch, newBranch, state, rootState }) =>
...
@@ -112,7 +113,7 @@ export const createCommitPayload = ({ branch, newBranch, state, rootState }) =>
file_path
:
f
.
path
,
file_path
:
f
.
path
,
content
:
f
.
content
,
content
:
f
.
content
,
encoding
:
f
.
base64
?
'
base64
'
:
'
text
'
,
encoding
:
f
.
base64
?
'
base64
'
:
'
text
'
,
last_commit_id
:
newBranch
?
undefined
:
f
.
lastCommit
.
id
,
last_commit_id
:
newBranch
?
undefined
:
f
.
lastCommit
Sha
,
})),
})),
start_branch
:
newBranch
?
rootState
.
currentBranchId
:
undefined
,
start_branch
:
newBranch
?
rootState
.
currentBranchId
:
undefined
,
});
});
...
...
app/controllers/projects/blob_controller.rb
View file @
3530274b
...
@@ -197,13 +197,14 @@ class Projects::BlobController < Projects::ApplicationController
...
@@ -197,13 +197,14 @@ class Projects::BlobController < Projects::ApplicationController
end
end
def
show_json
def
show_json
set_last_commit_sha
path_segments
=
@path
.
split
(
'/'
)
path_segments
=
@path
.
split
(
'/'
)
path_segments
.
pop
path_segments
.
pop
tree_path
=
path_segments
.
join
(
'/'
)
tree_path
=
path_segments
.
join
(
'/'
)
last_commit
=
@repository
.
last_commit_for_path
(
@commit
.
id
,
@blob
.
path
)
json
=
{
json
=
{
id:
@blob
.
id
,
id:
@blob
.
id
,
last_commit_sha:
@last_commit_sha
,
path:
blob
.
path
,
path:
blob
.
path
,
name:
blob
.
name
,
name:
blob
.
name
,
extension:
blob
.
extension
,
extension:
blob
.
extension
,
...
@@ -218,7 +219,6 @@ class Projects::BlobController < Projects::ApplicationController
...
@@ -218,7 +219,6 @@ class Projects::BlobController < Projects::ApplicationController
blame_path:
project_blame_path
(
project
,
@id
),
blame_path:
project_blame_path
(
project
,
@id
),
commits_path:
project_commits_path
(
project
,
@id
),
commits_path:
project_commits_path
(
project
,
@id
),
tree_path:
project_tree_path
(
project
,
File
.
join
(
@ref
,
tree_path
)),
tree_path:
project_tree_path
(
project
,
File
.
join
(
@ref
,
tree_path
)),
last_commit:
last_commit
,
permalink:
project_blob_path
(
project
,
File
.
join
(
@commit
.
id
,
@path
))
permalink:
project_blob_path
(
project
,
File
.
join
(
@commit
.
id
,
@path
))
}
}
...
...
spec/javascripts/ide/stores/modules/commit/actions_spec.js
View file @
3530274b
...
@@ -243,9 +243,7 @@ describe('IDE commit module actions', () => {
...
@@ -243,9 +243,7 @@ describe('IDE commit module actions', () => {
...
file
(
'
changed
'
),
...
file
(
'
changed
'
),
type
:
'
blob
'
,
type
:
'
blob
'
,
active
:
true
,
active
:
true
,
lastCommit
:
{
lastCommitSha
:
'
123456789
'
,
id
:
'
123456789
'
,
},
};
};
store
.
state
.
stagedFiles
.
push
(
f
);
store
.
state
.
stagedFiles
.
push
(
f
);
store
.
state
.
changedFiles
=
[
store
.
state
.
changedFiles
=
[
...
...
spec/javascripts/ide/stores/utils_spec.js
View file @
3530274b
...
@@ -76,9 +76,7 @@ describe('Multi-file store utils', () => {
...
@@ -76,9 +76,7 @@ describe('Multi-file store utils', () => {
...
file
(
'
staged
'
),
...
file
(
'
staged
'
),
path
:
'
staged
'
,
path
:
'
staged
'
,
content
:
'
updated file content
'
,
content
:
'
updated file content
'
,
lastCommit
:
{
lastCommitSha
:
'
123456789
'
,
id
:
'
123456789
'
,
},
},
},
{
{
...
file
(
'
newFile
'
),
...
file
(
'
newFile
'
),
...
@@ -86,9 +84,7 @@ describe('Multi-file store utils', () => {
...
@@ -86,9 +84,7 @@ describe('Multi-file store utils', () => {
tempFile
:
true
,
tempFile
:
true
,
content
:
'
new file content
'
,
content
:
'
new file content
'
,
base64
:
true
,
base64
:
true
,
lastCommit
:
{
lastCommitSha
:
'
123456789
'
,
id
:
'
123456789
'
,
},
},
},
],
],
currentBranchId
:
'
master
'
,
currentBranchId
:
'
master
'
,
...
...
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