BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
G
gitlab-ce
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
gitlab-ce
Commits
4e93cb9c
Commit
4e93cb9c
authored
Dec 15, 2016
by
Hiroyuki Sato
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Cache last commit sha for path
parent
c1dbae90
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
2 deletions
+13
-2
repository.rb
app/models/repository.rb
+13
-2
No files found.
app/models/repository.rb
View file @
4e93cb9c
...
@@ -654,11 +654,22 @@ class Repository
...
@@ -654,11 +654,22 @@ class Repository
end
end
def
last_commit_for_path
(
sha
,
path
)
def
last_commit_for_path
(
sha
,
path
)
args
=
%W(
#{
Gitlab
.
config
.
git
.
bin_path
}
rev-list --max-count=1
#{
sha
}
--
#{
path
}
)
sha
=
cache_last_commit_sha_for_path
(
sha
,
path
)
sha
=
Gitlab
::
Popen
.
popen
(
args
,
path_to_repo
).
first
.
strip
commit
(
sha
)
commit
(
sha
)
end
end
def
last_commit_sha_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
)
}
"
cache
.
fetch
(
key
)
do
last_commit_sha_for_path
(
sha
,
path
)
end
end
def
next_branch
(
name
,
opts
=
{})
def
next_branch
(
name
,
opts
=
{})
branch_ids
=
self
.
branch_names
.
map
do
|
n
|
branch_ids
=
self
.
branch_names
.
map
do
|
n
|
next
1
if
n
==
name
next
1
if
n
==
name
...
...
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