gollum-rugged_adapter 0.99.2 → 1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae443605ad0dd343310fee4b9bac502bc21654108468f91002a1686be978a587
4
- data.tar.gz: 957d8466bed97f5287131cde9aa63a7f88629ace4363680c8c0d1b90e30775b7
3
+ metadata.gz: 37cb3c6ab907f0e07284c8e86a4846fbc50835b1077ec78317ec8c6fe1338b8a
4
+ data.tar.gz: 4d55049d3ef2801916730be8544843a301f692cd077795cce15048c605a4ea3b
5
5
  SHA512:
6
- metadata.gz: d4f70708545e36a1b0695ee0ea02860ca60187439e1c23d506ba3b11cb7d902666c943d6f0abcce4ccb0c7c0c3374bb3b4dda444200bf3e57ca0ad32ec23b1ee
7
- data.tar.gz: 7a1b3a517bf612f7dd019b68b31ee4e0cb0eae6a8dd282e14b6a09e511957239663ddd1e3a0075dfd97d0492c8967d1f3d11186574937e6836a50cea737e3674
6
+ metadata.gz: 1564a85095a897ed8b4acb0fa5ccbdbd502ddde945945687edea68ddabfae008e0a566b0198ade261da1d49d1f7c763f2842018a1751b857a0a823773c15cbd7
7
+ data.tar.gz: 95a38d72f09c71de0145084f8afeb7ef97ee204967794fe97c30b0528f6c7a8a207ea6271f3e92f35c883226c02d6b901cddbeb8ef968bb9947dad29c66c68de
data/README.md CHANGED
@@ -4,9 +4,7 @@
4
4
 
5
5
  ## DESCRIPTION
6
6
 
7
- Adapter for [gollum](https://github.com/gollum/gollum) to use [Rugged](https://github.com/libgit2/rugged) (libgit2) at the backend. See the [gollum wiki](https://github.com/gollum/gollum/wiki/Git-adapters) for more information on adapters. Currently gollum uses grit as a backend by default, but since that is abandonware, the plan is to make this adapter the default in the future.
8
-
9
- **Please note that this adapter is currently in beta. It passes the unit tests for gollum and [gollum-lib](https://github.com/gollum/gollum-lib), but it needs more comprehensive testing. Please [report any issues](https://github.com/gollum/rugged_adapter/issues) that you encounter.**
7
+ Adapter for [gollum](https://github.com/gollum/gollum) to use [Rugged](https://github.com/libgit2/rugged) (libgit2) at the backend. See the [gollum wiki](https://github.com/gollum/gollum/wiki/Git-adapters) for more information on adapters. Currently this is the default adapter for gollum.
10
8
 
11
9
  ## USAGE
12
10
 
@@ -19,15 +19,16 @@ module Gollum
19
19
 
20
20
  class Actor
21
21
 
22
- attr_accessor :name, :email
22
+ attr_accessor :name, :email, :time
23
23
 
24
24
  def self.default_actor
25
25
  self.new("Gollum", "Gollum@wiki")
26
26
  end
27
27
 
28
- def initialize(name, email)
28
+ def initialize(name, email, time = nil)
29
29
  @name = name
30
30
  @email = email
31
+ @time = time
31
32
  end
32
33
 
33
34
  def output(time)
@@ -42,7 +43,7 @@ module Gollum
42
43
  end
43
44
 
44
45
  def to_h
45
- {:name => @name, :email => @email}
46
+ {:name => @name, :email => @email, :time => @time}
46
47
  end
47
48
 
48
49
  end
@@ -126,6 +127,10 @@ module Gollum
126
127
  @stats ||= build_stats
127
128
  end
128
129
 
130
+ def parent
131
+ @commit.parents.empty? ? nil : Gollum::Git::Commit.new(@commit.parents.first)
132
+ end
133
+
129
134
  private
130
135
 
131
136
  def build_stats
@@ -227,10 +232,10 @@ module Gollum
227
232
  path = path.nil? ? path : [path]
228
233
  options = options.merge({:paths => path, :strategy => :force})
229
234
  if ref == 'HEAD'
230
- @repo.checkout_head(options)
235
+ @repo.checkout_head(**options)
231
236
  else
232
237
  ref = "refs/heads/#{ref}" unless ref =~ /^refs\/heads\//
233
- @repo.checkout_tree(sha_from_ref(ref), options)
238
+ @repo.checkout_tree(sha_from_ref(ref), **options)
234
239
  end
235
240
  end
236
241
 
@@ -305,13 +310,13 @@ module Gollum
305
310
 
306
311
  def push(remote, branches = nil, options = {})
307
312
  branches = [branches].flatten.map {|branch| "refs/heads/#{branch}" unless branch =~ /^refs\/heads\//}
308
- @repo.push(remote, branches, options)
313
+ @repo.push(remote, branches, **options)
309
314
  end
310
315
 
311
316
  def pull(remote, branches = nil, options = {})
312
317
  branches = [branches].flatten.map {|branch| "refs/heads/#{branch}" unless branch =~ /^refs\/heads\//}
313
318
  r = @repo.remotes[remote]
314
- r.fetch(branches, options)
319
+ r.fetch(branches, **options)
315
320
  branches.each do |branch|
316
321
  branch_name = branch.match(/^refs\/heads\/(.*)/)[1]
317
322
  remote_name = remote.match(/^(refs\/heads\/)?(.*)/)[2]
@@ -346,6 +351,7 @@ module Gollum
346
351
  skipped = 0
347
352
  current_path = options[:path].dup if options[:path]
348
353
  current_path = nil if current_path == ''
354
+ renamed_path = current_path.nil? ? nil : current_path.dup
349
355
  track_pathnames = true if current_path && options[:follow]
350
356
  limit = options[:limit].to_i
351
357
  offset = options[:offset].to_i
@@ -358,12 +364,13 @@ module Gollum
358
364
  # Skip merge commits
359
365
  next if c.parents.length > 1
360
366
  end
361
-
362
367
  if !current_path || commit_touches_path?(c, current_path, options[:follow], walker)
363
368
  # This is a commit we care about, unless we haven't skipped enough
364
369
  # yet
365
370
  skipped += 1
366
- commits.push(Gollum::Git::Commit.new(c, track_pathnames ? current_path.dup : nil)) if skipped > offset
371
+
372
+ commits.push(Gollum::Git::Commit.new(c, track_pathnames ? renamed_path : nil)) if skipped > offset
373
+ renamed_path = current_path.nil? ? nil : current_path.dup
367
374
  end
368
375
  end
369
376
  walker.reset
@@ -483,7 +490,7 @@ module Gollum
483
490
  commit_options[:message] = message.to_s
484
491
  commit_options[:parents] = parents
485
492
  commit_options[:update_ref] = head
486
- Rugged::Commit.create(@rugged_repo, commit_options)
493
+ Rugged::Commit.create(@rugged_repo, **commit_options)
487
494
  end
488
495
 
489
496
  def tree
@@ -557,7 +564,7 @@ module Gollum
557
564
  class Repo
558
565
 
559
566
  def initialize(path, options)
560
- @repo = Rugged::Repository.new(path, options)
567
+ @repo = Rugged::Repository.new(path, **options)
561
568
  end
562
569
 
563
570
  def self.init(path)
@@ -612,7 +619,7 @@ module Gollum
612
619
  end
613
620
 
614
621
  def log(commit = 'refs/heads/master', path = nil, options = {})
615
- git.log(commit, path, options)
622
+ git.log(commit, path, **options)
616
623
  end
617
624
 
618
625
  def lstree(sha, options = {})
@@ -1,7 +1,7 @@
1
1
  module Gollum
2
2
  module Lib
3
3
  module Git
4
- VERSION = '0.99.2'
4
+ VERSION = '1.1'
5
5
  end
6
6
  end
7
7
  end
@@ -13,8 +13,8 @@ Gem::Specification.new do |s|
13
13
  s.description = %q{Adapter for Gollum to use Rugged (libgit2) at the backend.}
14
14
  s.license = "MIT"
15
15
 
16
- s.add_runtime_dependency 'rugged', '~> 0.99'
17
- s.add_runtime_dependency 'mime-types', '>= 1.15'
16
+ s.add_runtime_dependency 'rugged', '~> 1.1.0'
17
+ s.add_runtime_dependency 'mime-types', '~> 1.15'
18
18
  s.add_development_dependency 'rspec', "3.4.0"
19
19
 
20
20
  s.files = Dir['lib/**/*.rb'] + ["README.md", "Gemfile"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gollum-rugged_adapter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.99.2
4
+ version: '1.1'
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bart Kamphorst, Dawa Ometto
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-03-15 00:00:00.000000000 Z
11
+ date: 2021-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rugged
@@ -16,26 +16,26 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '0.99'
19
+ version: 1.1.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '0.99'
26
+ version: 1.1.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: mime-types
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ">="
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.15'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ">="
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.15'
41
41
  - !ruby/object:Gem::Dependency
@@ -71,7 +71,7 @@ homepage: https://github.com/gollum/rugged_adapter
71
71
  licenses:
72
72
  - MIT
73
73
  metadata: {}
74
- post_install_message:
74
+ post_install_message:
75
75
  rdoc_options: []
76
76
  require_paths:
77
77
  - lib
@@ -86,8 +86,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
86
86
  - !ruby/object:Gem::Version
87
87
  version: '0'
88
88
  requirements: []
89
- rubygems_version: 3.0.3
90
- signing_key:
89
+ rubygems_version: 3.1.4
90
+ signing_key:
91
91
  specification_version: 4
92
92
  summary: Adapter for Gollum to use Rugged (libgit2) at the backend.
93
93
  test_files: []