Skip to content

Commit d3f3a9d

Browse files
committed
chore: add frozen_string_literal: true magic comment
1 parent 81932be commit d3f3a9d

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

79 files changed

+171
-102
lines changed

lib/git.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'active_support'
24
require 'active_support/deprecation'
35

lib/git/author.rb

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1+
# frozen_string_literal: true
2+
13
module Git
24
class Author
35
attr_accessor :name, :email, :date
4-
6+
57
def initialize(author_string)
68
if m = /(.*?) <(.*?)> (\d+) (.*)/.match(author_string)
79
@name = m[1]
810
@email = m[2]
911
@date = Time.at(m[3].to_i)
1012
end
1113
end
12-
1314
end
1415
end

lib/git/base.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'logger'
24
require 'open3'
35

lib/git/branch.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'git/path'
24

35
module Git

lib/git/branches.rb

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,17 @@
1+
# frozen_string_literal: true
2+
13
module Git
2-
4+
35
# object that holds all the available branches
46
class Branches
57

68
include Enumerable
7-
9+
810
def initialize(base)
911
@branches = {}
10-
12+
1113
@base = base
12-
14+
1315
@base.lib.branches_all.each do |b|
1416
@branches[b[0]] = Git::Branch.new(@base, b[0])
1517
end
@@ -18,21 +20,21 @@ def initialize(base)
1820
def local
1921
self.select { |b| !b.remote }
2022
end
21-
23+
2224
def remote
2325
self.select { |b| b.remote }
2426
end
25-
27+
2628
# array like methods
2729

2830
def size
2931
@branches.size
30-
end
31-
32+
end
33+
3234
def each(&block)
3335
@branches.values.each(&block)
3436
end
35-
37+
3638
# Returns the target branch
3739
#
3840
# Example:
@@ -50,22 +52,21 @@ def [](branch_name)
5052
@branches.values.inject(@branches) do |branches, branch|
5153
branches[branch.full] ||= branch
5254

53-
# This is how Git (version 1.7.9.5) works.
54-
# Lets you ignore the 'remotes' if its at the beginning of the branch full name (even if is not a real remote branch).
55+
# This is how Git (version 1.7.9.5) works.
56+
# Lets you ignore the 'remotes' if its at the beginning of the branch full name (even if is not a real remote branch).
5557
branches[branch.full.sub('remotes/', '')] ||= branch if branch.full =~ /^remotes\/.+/
56-
58+
5759
branches
5860
end[branch_name.to_s]
5961
end
60-
62+
6163
def to_s
6264
out = ''
6365
@branches.each do |k, b|
6466
out << (b.current ? '* ' : ' ') << b.to_s << "\n"
6567
end
6668
out
6769
end
68-
6970
end
7071

7172
end

lib/git/config.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module Git
24

35
class Config

lib/git/diff.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module Git
24

35
# object that holds the last X commits on given branch

lib/git/index.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
1+
# frozen_string_literal: true
2+
13
module Git
24
class Index < Git::Path
3-
45
end
56
end

lib/git/lib.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'git/command_line'
24
require 'git/errors'
35
require 'logger'
@@ -570,7 +572,7 @@ def process_commit_log_data(data)
570572
case key
571573
when 'commit'
572574
hsh_array << hsh if hsh
573-
hsh = {'sha' => value, 'message' => '', 'parent' => []}
575+
hsh = {'sha' => value, 'message' => +'', 'parent' => []}
574576
when 'parent'
575577
hsh['parent'] << value
576578
else

lib/git/log.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module Git
24

35
# Return the last n commits that match the specified criteria

lib/git/object.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'git/author'
24
require 'git/diff'
35
require 'git/errors'

lib/git/path.rb

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,32 @@
1+
# frozen_string_literal: true
2+
13
module Git
2-
4+
35
class Path
4-
6+
57
attr_accessor :path
6-
8+
79
def initialize(path, check_path=true)
810
path = File.expand_path(path)
9-
11+
1012
if check_path && !File.exist?(path)
1113
raise ArgumentError, 'path does not exist', [path]
1214
end
13-
15+
1416
@path = path
1517
end
16-
18+
1719
def readable?
1820
File.readable?(@path)
1921
end
2022

2123
def writable?
2224
File.writable?(@path)
2325
end
24-
26+
2527
def to_s
2628
@path
2729
end
28-
2930
end
3031

3132
end

lib/git/remote.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module Git
24
class Remote < Path
35

lib/git/repository.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module Git
24

35
class Repository < Path

lib/git/stash.rb

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,28 @@
1+
# frozen_string_literal: true
2+
13
module Git
24
class Stash
3-
5+
46
def initialize(base, message, existing=false)
57
@base = base
68
@message = message
79
save unless existing
810
end
9-
11+
1012
def save
1113
@saved = @base.lib.stash_save(@message)
1214
end
13-
15+
1416
def saved?
1517
@saved
1618
end
17-
19+
1820
def message
1921
@message
2022
end
21-
23+
2224
def to_s
2325
message
2426
end
25-
2627
end
2728
end

lib/git/stashes.rb

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
1+
# frozen_string_literal: true
2+
13
module Git
2-
4+
35
# object that holds all the available stashes
46
class Stashes
57
include Enumerable
6-
8+
79
def initialize(base)
810
@stashes = []
9-
11+
1012
@base = base
11-
13+
1214
@base.lib.stashes_all.each do |id, message|
1315
@stashes.unshift(Git::Stash.new(@base, message, true))
1416
end
@@ -24,16 +26,16 @@ def initialize(base)
2426
def all
2527
@base.lib.stashes_all
2628
end
27-
29+
2830
def save(message)
2931
s = Git::Stash.new(@base, message)
3032
@stashes.unshift(s) if s.saved?
3133
end
32-
34+
3335
def apply(index=nil)
3436
@base.lib.stash_apply(index)
3537
end
36-
38+
3739
def clear
3840
@base.lib.stash_clear
3941
@stashes = []
@@ -42,14 +44,13 @@ def clear
4244
def size
4345
@stashes.size
4446
end
45-
47+
4648
def each(&block)
4749
@stashes.each(&block)
4850
end
49-
51+
5052
def [](index)
5153
@stashes[index.to_i]
5254
end
53-
5455
end
5556
end

lib/git/status.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module Git
24
# The status class gets the status of a git repository
35
#
@@ -100,7 +102,7 @@ def untracked?(file)
100102
end
101103

102104
def pretty
103-
out = ''
105+
out = +''
104106
each do |file|
105107
out << pretty_file(file)
106108
end

lib/git/version.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module Git
24
# The current gem version
35
# @return [String] the current gem version.

lib/git/working_directory.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module Git
24
class WorkingDirectory < Git::Path
35
end

lib/git/worktree.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'git/path'
24

35
module Git

lib/git/worktrees.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
module Git
24
# object that holds all the available worktrees
35
class Worktrees

tests/test_helper.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# frozen_string_literal: true
2+
13
require 'date'
24
require 'fileutils'
35
require 'minitar'

tests/units/test_archive.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env ruby
1+
# frozen_string_literal: true
22

33
require 'test_helper'
44

tests/units/test_bare.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#!/usr/bin/env ruby
1+
# frozen_string_literal: true
22

33
require 'test_helper'
44

0 commit comments

Comments
 (0)