Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-shell
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
nexedi
gitlab-shell
Commits
872c66e9
Commit
872c66e9
authored
Nov 16, 2016
by
Elan Ruusamäe
Committed by
Sean McGivern
Dec 01, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
avoid Dir.exists? duplication by moving the check to match_hook_files
parent
d87c4b9c
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
6 deletions
+4
-6
lib/gitlab_custom_hook.rb
lib/gitlab_custom_hook.rb
+4
-6
No files found.
lib/gitlab_custom_hook.rb
View file @
872c66e9
...
...
@@ -72,15 +72,11 @@ class GitlabCustomHook
# <repository>.git/custom_hooks/<hook_name>.d/*
hook_path
=
File
.
join
(
@repo_path
,
'custom_hooks'
,
"
#{
hook_name
}
.d"
)
if
Dir
.
exist?
(
hook_path
)
hook_files
+=
match_hook_files
(
hook_path
)
end
# <repository>.git/hooks/<hook_name>.d/*
hook_path
=
File
.
join
(
@repo_path
,
'hooks'
,
"
#{
hook_name
}
.d"
)
if
Dir
.
exist?
(
hook_path
)
hook_files
+=
match_hook_files
(
hook_path
)
end
hook_files
end
...
...
@@ -91,6 +87,8 @@ class GitlabCustomHook
#
# the resulting list is sorted
def
match_hook_files
(
path
)
return
[]
unless
Dir
.
exist?
(
path
)
Dir
[
"
#{
path
}
/*"
].
select
do
|
f
|
!
f
.
end_with?
(
'~'
)
&&
File
.
executable?
(
f
)
end
.
sort
...
...
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