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
49cf9bad
Commit
49cf9bad
authored
Feb 14, 2013
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Gitlab::ShellEnv added
parent
b698094d
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
22 additions
and
3 deletions
+22
-3
lib/gitlab/backend/grack_auth.rb
lib/gitlab/backend/grack_auth.rb
+1
-2
lib/gitlab/backend/shell.rb
lib/gitlab/backend/shell.rb
+0
-1
lib/gitlab/backend/shell_env.rb
lib/gitlab/backend/shell_env.rb
+17
-0
lib/gitlab/satellite/action.rb
lib/gitlab/satellite/action.rb
+4
-0
No files found.
lib/gitlab/backend/grack_auth.rb
View file @
49cf9bad
...
...
@@ -32,8 +32,7 @@ module Grack
self
.
user
=
User
.
find_by_email
(
login
)
||
User
.
find_by_username
(
login
)
return
false
unless
user
.
try
(
:valid_password?
,
password
)
# Set GL_ID env variable
ENV
[
'GL_ID'
]
=
"user-
#{
user
.
id
}
"
Gitlab
::
ShellEnv
.
set_env
(
user
)
end
# Git upload and receive
...
...
lib/gitlab/backend/shell.rb
View file @
49cf9bad
...
...
@@ -53,7 +53,6 @@ module Gitlab
system
(
"/home/git/gitlab-shell/bin/gitlab-keys rm-key
#{
key_id
}
\"
#{
key_content
}
\"
"
)
end
def
url_to_repo
path
Gitlab
.
config
.
gitlab_shell
.
ssh_path_prefix
+
"
#{
path
}
.git"
end
...
...
lib/gitlab/backend/shell_env.rb
0 → 100644
View file @
49cf9bad
module
Gitlab
# This module provide 2 methods
# to set specific ENV variabled for GitLab Shell
module
ShellEnv
extend
self
def
set_env
(
user
)
# Set GL_ID env variable
ENV
[
'GL_ID'
]
=
"user-
#{
user
.
id
}
"
end
def
reset_env
# Reset GL_ID env variable
ENV
[
'GL_ID'
]
=
nil
end
end
end
lib/gitlab/satellite/action.rb
View file @
49cf9bad
...
...
@@ -17,6 +17,8 @@ module Gitlab
# * Locks the satellite repo
# * Yields the prepared satellite repo
def
in_locked_and_timed_satellite
Gitlab
::
ShellEnv
.
set_env
(
user
)
Grit
::
Git
.
with_timeout
(
options
[
:git_timeout
])
do
project
.
satellite
.
lock
do
return
yield
project
.
satellite
.
repo
...
...
@@ -28,6 +30,8 @@ module Gitlab
rescue
Grit
::
Git
::
GitTimeout
=>
ex
Gitlab
::
GitLogger
.
error
(
ex
.
message
)
return
false
ensure
Gitlab
::
ShellEnv
.
reset_env
end
# * Clears the satellite
...
...
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