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
1
Merge Requests
1
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
nexedi
gitlab-ce
Commits
1f192757
Commit
1f192757
authored
Dec 15, 2016
by
Hiroyuki Sato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename sha to id
parent
b1ca2c7d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
6 deletions
+6
-6
app/models/repository.rb
app/models/repository.rb
+5
-5
lib/api/files.rb
lib/api/files.rb
+1
-1
No files found.
app/models/repository.rb
View file @
1f192757
...
...
@@ -654,19 +654,19 @@ class Repository
end
def
last_commit_for_path
(
sha
,
path
)
sha
=
cache_last_commit_
sha
_for_path
(
sha
,
path
)
sha
=
cache_last_commit_
id
_for_path
(
sha
,
path
)
commit
(
sha
)
end
def
last_commit_
sha
_for_path
(
sha
,
path
)
def
last_commit_
id
_for_path
(
sha
,
path
)
args
=
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
rev-list --max-count=1
#{
sha
}
--
#{
path
}
)
Gitlab
::
Popen
.
popen
(
args
,
path_to_repo
).
first
.
strip
end
def
cache_last_commit_
sha
_for_path
(
sha
,
path
)
key
=
path
.
blank?
?
"last_commit_
sha
_for_path:
#{
sha
}
"
:
"last_commit_id_for_path:
#{
sha
}
:
#{
Digest
::
SHA1
.
hexdigest
(
path
)
}
"
def
cache_last_commit_
id
_for_path
(
sha
,
path
)
key
=
path
.
blank?
?
"last_commit_
id
_for_path:
#{
sha
}
"
:
"last_commit_id_for_path:
#{
sha
}
:
#{
Digest
::
SHA1
.
hexdigest
(
path
)
}
"
cache
.
fetch
(
key
)
do
last_commit_
sha
_for_path
(
sha
,
path
)
last_commit_
id
_for_path
(
sha
,
path
)
end
end
...
...
lib/api/files.rb
View file @
1f192757
...
...
@@ -70,7 +70,7 @@ module API
ref:
params
[
:ref
],
blob_id:
blob
.
id
,
commit_id:
commit
.
id
,
last_commit_id:
repo
.
cache_last_commit_
sha
_for_path
(
commit
.
sha
,
params
[
:file_path
])
last_commit_id:
repo
.
cache_last_commit_
id
_for_path
(
commit
.
sha
,
params
[
:file_path
])
}
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