gitolite-rugged 1.2.1.pre.devel → 1.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +1 -1
- data/gitolite.gemspec +1 -1
- data/lib/gitolite/gitolite_admin.rb +39 -24
- data/lib/gitolite/ssh_key.rb +1 -1
- data/lib/gitolite/version.rb +1 -1
- data/spec/dirty_proxy_spec.rb +5 -5
- data/spec/gitolite_admin_spec.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b28ad4995956104cd037104756e8edf41bea5f2
|
4
|
+
data.tar.gz: 831314b52bccf8ac936cc72b4084da9c3f054212
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ad57b09cded9f42d1d3b99ad04080e19fb5a4201bdd9bbde3d3e123b36a7542b58ff9f76209e1a2936ed3d9952836dbd630e818e59e976a29bba1bbba86c172
|
7
|
+
data.tar.gz: 3e77c292b569df1c3fa376d6a4c0abbbc9c3f30d0d0bee0026d26ef39208c129044820e9a09456f942c7328dcce3255c304fe2b51ec846267942ad1f06ad42d3
|
data/Gemfile
CHANGED
@@ -2,4 +2,4 @@ source "http://rubygems.org"
|
|
2
2
|
|
3
3
|
# Specify your gem's dependencies in gitolite.gemspec
|
4
4
|
gemspec
|
5
|
-
gem 'rugged',
|
5
|
+
gem 'rugged', :github => 'libgit2/rugged', :tag => 'v0.21.0', :submodules => true
|
data/README.md
CHANGED
@@ -17,7 +17,7 @@ It provides these functionalities :
|
|
17
17
|
## Requirements ##
|
18
18
|
* Ruby 1.9.x or 2.0.x
|
19
19
|
* a working [gitolite](https://github.com/sitaramc/gitolite) installation
|
20
|
-
* The [rugged](https://github.com/libgit2/rugged) bindings to libgit2 with SSH-key credentials added (
|
20
|
+
* The [rugged](https://github.com/libgit2/rugged) bindings to libgit2 with SSH-key credentials added (Version >= 0.21 or dev branch).
|
21
21
|
|
22
22
|
## Installation ##
|
23
23
|
|
data/gitolite.gemspec
CHANGED
@@ -26,7 +26,7 @@ Gem::Specification.new do |s|
|
|
26
26
|
|
27
27
|
s.add_development_dependency "rspec_junit_formatter", "~> 0.1", ">= 0.1.6"
|
28
28
|
|
29
|
-
s.add_dependency "rugged", "~> 0.
|
29
|
+
s.add_dependency "rugged", "~> 0.21", ">= 0.21.0"
|
30
30
|
s.add_dependency "gratr19", "~> 0.4.4", ">= 0.4.4.1"
|
31
31
|
|
32
32
|
s.files = `git ls-files`.split("\n")
|
@@ -20,7 +20,11 @@ module Gitolite
|
|
20
20
|
key_dir: "keydir",
|
21
21
|
key_subdir: "",
|
22
22
|
config_file: "gitolite.conf",
|
23
|
-
lock_file_path: '.lock'
|
23
|
+
lock_file_path: '.lock',
|
24
|
+
|
25
|
+
# Repo settings
|
26
|
+
update_on_init: true,
|
27
|
+
reset_before_update: true
|
24
28
|
}
|
25
29
|
|
26
30
|
class << self
|
@@ -33,7 +37,7 @@ module Gitolite
|
|
33
37
|
begin
|
34
38
|
repo = Rugged::Repository.new(dir)
|
35
39
|
return false if repo.empty?
|
36
|
-
rescue Rugged::RepositoryError
|
40
|
+
rescue Rugged::RepositoryError, Rugged::OSError
|
37
41
|
return false
|
38
42
|
end
|
39
43
|
|
@@ -46,7 +50,7 @@ module Gitolite
|
|
46
50
|
end
|
47
51
|
|
48
52
|
def admin_url(settings)
|
49
|
-
[settings[:git_user], '@', settings[:host], '/gitolite-admin.git'].join
|
53
|
+
['ssh://', settings[:git_user], '@', settings[:host], '/gitolite-admin.git'].join
|
50
54
|
end
|
51
55
|
end
|
52
56
|
|
@@ -79,21 +83,26 @@ module Gitolite
|
|
79
83
|
|
80
84
|
# setup credentials
|
81
85
|
@credentials = Rugged::Credentials::SshKey.new(
|
82
|
-
username: settings[:git_user],
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
if self.class.is_gitolite_admin_repo?(path)
|
87
|
-
Rugged::Repository.new(path, credentials: @credentials)
|
88
|
-
else
|
89
|
-
clone
|
90
|
-
end
|
86
|
+
username: @settings[:git_user],
|
87
|
+
publickey: settings[:public_key],
|
88
|
+
privatekey: settings[:private_key]
|
89
|
+
)
|
91
90
|
|
92
91
|
@config_dir_path = File.join(@path, @settings[:config_dir])
|
93
92
|
@config_file_path = File.join(@config_dir_path, @settings[:config_file])
|
94
93
|
@key_dir_path = File.join(@path, relative_key_dir)
|
95
94
|
|
96
|
-
@commit_author = { email: settings[:author_email], name: settings[:author_name] }
|
95
|
+
@commit_author = { email: @settings[:author_email], name: @settings[:author_name] }
|
96
|
+
|
97
|
+
if self.class.is_gitolite_admin_repo?(path)
|
98
|
+
@repo = Rugged::Repository.new(path, credentials: @credentials )
|
99
|
+
# Update repository
|
100
|
+
if @settings[:update_on_init]
|
101
|
+
update
|
102
|
+
end
|
103
|
+
else
|
104
|
+
@repo = clone
|
105
|
+
end
|
97
106
|
|
98
107
|
reload!
|
99
108
|
end
|
@@ -149,10 +158,9 @@ module Gitolite
|
|
149
158
|
|
150
159
|
|
151
160
|
# This method will destroy all local tracked changes, resetting the local gitolite
|
152
|
-
# git repo to HEAD
|
161
|
+
# git repo to HEAD
|
153
162
|
def reset!
|
154
163
|
@repo.reset('origin/master', :hard)
|
155
|
-
reload!
|
156
164
|
end
|
157
165
|
|
158
166
|
|
@@ -201,7 +209,7 @@ module Gitolite
|
|
201
209
|
commit_tree = index.write_tree @repo
|
202
210
|
index.write
|
203
211
|
|
204
|
-
commit_author =
|
212
|
+
commit_author = @commit_author.merge(time: Time.now)
|
205
213
|
|
206
214
|
Rugged::Commit.create(@repo,
|
207
215
|
author: commit_author,
|
@@ -242,12 +250,19 @@ module Gitolite
|
|
242
250
|
|
243
251
|
# Updates the repo with changes from remote master
|
244
252
|
# Warning: This resets the repo before pulling in the changes.
|
245
|
-
def update(
|
246
|
-
|
253
|
+
def update()
|
254
|
+
|
255
|
+
# Reset --hard repo before update
|
256
|
+
if @settings[:reset_before_update]
|
257
|
+
reset!
|
258
|
+
end
|
259
|
+
|
260
|
+
# Fetch changes from origin
|
261
|
+
@repo.fetch('origin', credentials: @credentials )
|
247
262
|
|
248
|
-
# Currently,
|
249
|
-
master = repo.
|
250
|
-
origin_master = repo.
|
263
|
+
# Currently, only merging from origin/master into master is supported.
|
264
|
+
master = @repo.references["refs/heads/master"].target
|
265
|
+
origin_master = @repo.references["refs/remotes/origin/master"].target
|
251
266
|
|
252
267
|
# Create the merged index in memory
|
253
268
|
merge_index = repo.merge_commits(master, origin_master)
|
@@ -259,7 +274,7 @@ module Gitolite
|
|
259
274
|
message: '[gitolite-rugged] Merged `origin/master` into `master`',
|
260
275
|
author: @commit_author,
|
261
276
|
committer: @commit_author,
|
262
|
-
update_ref: 'master'
|
277
|
+
update_ref: 'refs/heads/master'
|
263
278
|
)
|
264
279
|
|
265
280
|
reload!
|
@@ -278,8 +293,8 @@ module Gitolite
|
|
278
293
|
# The hostname may use an optional :port to allow for custom SSH ports.
|
279
294
|
# E.g., +git@localhost:2222/gitolite-admin.git+
|
280
295
|
#
|
281
|
-
def clone
|
282
|
-
Rugged::Repository.clone_at(admin_url(@settings), File.expand_path(@path), credentials: @credentials)
|
296
|
+
def clone
|
297
|
+
Rugged::Repository.clone_at(GitoliteAdmin.admin_url(@settings), File.expand_path(@path), credentials: @credentials )
|
283
298
|
end
|
284
299
|
|
285
300
|
|
data/lib/gitolite/ssh_key.rb
CHANGED
@@ -50,7 +50,7 @@ module Gitolite
|
|
50
50
|
self.new(type, blob, email, owner, location)
|
51
51
|
end
|
52
52
|
|
53
|
-
|
53
|
+
# Parse the key path above the key to be read.
|
54
54
|
# As we can omit the location, there are two possible options:
|
55
55
|
#
|
56
56
|
# 1. Location is empty. Path is <keydir>/<owner>/
|
data/lib/gitolite/version.rb
CHANGED
data/spec/dirty_proxy_spec.rb
CHANGED
@@ -28,27 +28,27 @@ describe Gitolite::DirtyProxy do
|
|
28
28
|
|
29
29
|
describe 'dirty checking methods' do
|
30
30
|
it 'should respond to clean_up!' do
|
31
|
-
proxy.respond_to?(:clean_up!).should
|
31
|
+
proxy.respond_to?(:clean_up!).should be true
|
32
32
|
end
|
33
33
|
|
34
34
|
it 'should respond to dirty?' do
|
35
|
-
proxy.respond_to?(:dirty?).should
|
35
|
+
proxy.respond_to?(:dirty?).should be true
|
36
36
|
end
|
37
37
|
|
38
38
|
context 'when just initialized' do
|
39
39
|
it 'should be clean' do
|
40
|
-
proxy.dirty?.should
|
40
|
+
proxy.dirty?.should be false
|
41
41
|
end
|
42
42
|
end
|
43
43
|
|
44
44
|
shared_examples 'dirty? clean_up!' do
|
45
45
|
it 'should be dirty' do
|
46
|
-
proxy.dirty?.should
|
46
|
+
proxy.dirty?.should be true
|
47
47
|
end
|
48
48
|
|
49
49
|
it 'should be clean again after clean_up!' do
|
50
50
|
proxy.clean_up!
|
51
|
-
proxy.dirty?.should
|
51
|
+
proxy.dirty?.should be false
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
data/spec/gitolite_admin_spec.rb
CHANGED
@@ -5,7 +5,7 @@ describe Gitolite::GitoliteAdmin do
|
|
5
5
|
repo_dir = File.join(File.dirname(__FILE__), 'fixtures', 'gitolite-admin')
|
6
6
|
|
7
7
|
# Rugged doesn't complain when giving nil keys for testing
|
8
|
-
settings = {private_key: nil, public_key: nil}
|
8
|
+
settings = {private_key: nil, public_key: nil, update_on_init: false}
|
9
9
|
|
10
10
|
describe '#is_gitolite_admin_repo?' do
|
11
11
|
it 'should detect a non gitolite-admin repository' do
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gitolite-rugged
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oliver Günther
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -216,20 +216,20 @@ dependencies:
|
|
216
216
|
requirements:
|
217
217
|
- - "~>"
|
218
218
|
- !ruby/object:Gem::Version
|
219
|
-
version: '0.
|
219
|
+
version: '0.21'
|
220
220
|
- - ">="
|
221
221
|
- !ruby/object:Gem::Version
|
222
|
-
version: 0.
|
222
|
+
version: 0.21.0
|
223
223
|
type: :runtime
|
224
224
|
prerelease: false
|
225
225
|
version_requirements: !ruby/object:Gem::Requirement
|
226
226
|
requirements:
|
227
227
|
- - "~>"
|
228
228
|
- !ruby/object:Gem::Version
|
229
|
-
version: '0.
|
229
|
+
version: '0.21'
|
230
230
|
- - ">="
|
231
231
|
- !ruby/object:Gem::Version
|
232
|
-
version: 0.
|
232
|
+
version: 0.21.0
|
233
233
|
- !ruby/object:Gem::Dependency
|
234
234
|
name: gratr19
|
235
235
|
requirement: !ruby/object:Gem::Requirement
|
@@ -358,9 +358,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
358
358
|
version: '0'
|
359
359
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
360
360
|
requirements:
|
361
|
-
- - "
|
361
|
+
- - ">="
|
362
362
|
- !ruby/object:Gem::Version
|
363
|
-
version:
|
363
|
+
version: '0'
|
364
364
|
requirements: []
|
365
365
|
rubyforge_project:
|
366
366
|
rubygems_version: 2.2.2
|