blob: ecdb7f07744fb553028cbf50ef8da1e66cb71ee2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
|
# Call out to the `git rev-list` command
module Gitlab
module Git
class RevList
def initialize(oldrev, newrev, project:, env: nil)
@args = [Gitlab.config.git.bin_path,
"--git-dir=#{project.repository.path_to_repo}",
"rev-list",
"--max-count=1",
oldrev,
"^#{newrev}"]
@env = env.slice(*allowed_environment_variables)
end
def execute
Gitlab::Popen.popen(@args, nil, @env.slice(*allowed_environment_variables))
end
private
def allowed_environment_variables
%w(GIT_ALTERNATE_OBJECT_DIRECTORIES GIT_OBJECT_DIRECTORY)
end
end
end
end
|