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
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
gitlab-ce
Commits
1b8d3247
Commit
1b8d3247
authored
Nov 02, 2015
by
Valery Sizov
Committed by
Valery Sizov
Nov 02, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add ability to fetch the commit ID of the last commit that actually touched a file
parent
8f75200d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
7 additions
and
2 deletions
+7
-2
CHANGELOG
CHANGELOG
+1
-0
doc/api/repository_files.md
doc/api/repository_files.md
+2
-1
lib/api/files.rb
lib/api/files.rb
+3
-1
spec/requests/api/files_spec.rb
spec/requests/api/files_spec.rb
+1
-0
No files found.
CHANGELOG
View file @
1b8d3247
...
...
@@ -16,6 +16,7 @@ v 8.2.0 (unreleased)
- Fix: 500 error returned if destroy request without HTTP referer (Kazuki Shimizu)
- Remove deprecated CI events from project settings page
- Use issue editor as cross reference comment author when issue is edited with a new mention.
- [API] Add ability to fetch the commit ID of the last commit that actually touched a file
v 8.1.1
- Fix cloning Wiki repositories via HTTP (Stan Hu)
...
...
doc/api/repository_files.md
View file @
1b8d3247
...
...
@@ -23,7 +23,8 @@ Example response:
"content"
:
"IyA9PSBTY2hlbWEgSW5mb3..."
,
"ref"
:
"master"
,
"blob_id"
:
"79f7bbd25901e8334750839545a9bd021f0e4c83"
,
"commit_id"
:
"d5a3ff139356ce33e37e73add446f16869741b50"
"commit_id"
:
"d5a3ff139356ce33e37e73add446f16869741b50"
,
"last_commit_id"
:
"570e7b2abdd848b95f2f578043fc23bd6f6fd24d"
}
```
...
...
lib/api/files.rb
View file @
1b8d3247
...
...
@@ -43,7 +43,8 @@ module API
# "content": "IyA9PSBTY2hlbWEgSW5mb3...",
# "ref": "master",
# "blob_id": "79f7bbd25901e8334750839545a9bd021f0e4c83",
# "commit_id": "d5a3ff139356ce33e37e73add446f16869741b50"
# "commit_id": "d5a3ff139356ce33e37e73add446f16869741b50",
# "last_commit_id": "570e7b2abdd848b95f2f578043fc23bd6f6fd24d",
# }
#
get
":id/repository/files"
do
...
...
@@ -71,6 +72,7 @@ module API
ref:
ref
,
blob_id:
blob
.
id
,
commit_id:
commit
.
id
,
last_commit_id:
user_project
.
repository
.
last_commit_for_path
(
commit
.
sha
,
file_path
).
id
}
else
not_found!
'File'
...
...
spec/requests/api/files_spec.rb
View file @
1b8d3247
...
...
@@ -19,6 +19,7 @@ describe API::API, api: true do
expect
(
response
.
status
).
to
eq
(
200
)
expect
(
json_response
[
'file_path'
]).
to
eq
(
file_path
)
expect
(
json_response
[
'file_name'
]).
to
eq
(
'popen.rb'
)
expect
(
json_response
[
'last_commit_id'
]).
to
eq
(
'570e7b2abdd848b95f2f578043fc23bd6f6fd24d'
)
expect
(
Base64
.
decode64
(
json_response
[
'content'
]).
lines
.
first
).
to
eq
(
"require 'fileutils'
\n
"
)
end
...
...
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