Skip to content

Commit 3644088

Browse files
Cleaning up warnings
* unused local variables * redefined methods on the same file and class
1 parent fbbfe07 commit 3644088

File tree

8 files changed

+10
-29
lines changed

8 files changed

+10
-29
lines changed

lib/git/base.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,9 @@ def chdir # :yields: the Git::Path
115115

116116
# returns the repository size in bytes
117117
def repo_size
118-
size = 0
119118
Dir.chdir(repo.path) do
120-
(size, dot) = `du -s`.chomp.split
119+
return `du -s`.chomp.split.first.to_i
121120
end
122-
size.to_i
123121
end
124122

125123
#g.config('user.name', 'Scott Chacon') # sets value

lib/git/branch.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def determine_current
110110
# param [String] name branch full name.
111111
# return [<Git::Remote,NilClass,String>] an Array containing the remote and branch names.
112112
def parse_name(name)
113-
if name.match /^(?:remotes)?\/([^\/]+)\/(.+)/
113+
if name.match(/^(?:remotes)?\/([^\/]+)\/(.+)/)
114114
return [Git::Remote.new(@base, $1), $2]
115115
end
116116

lib/git/lib.rb

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -363,24 +363,7 @@ def parse_config_list(lines)
363363
end
364364

365365
def parse_config(file)
366-
hsh = {}
367366
parse_config_list command_lines('config', ['--list', '--file', file], false)
368-
#hsh = {}
369-
#file = File.expand_path(file)
370-
#if File.file?(file)
371-
# current_section = nil
372-
# File.readlines(file).each do |line|
373-
# if m = /\[(\w+)\]/.match(line)
374-
# current_section = m[1]
375-
# elsif m = /\[(\w+?) "(.*?)"\]/.match(line)
376-
# current_section = "#{m[1]}.#{m[2]}"
377-
# elsif m = /(\w+?) = (.*)/.match(line)
378-
# key = "#{current_section}.#{m[1]}"
379-
# hsh[key] = m[2]
380-
# end
381-
# end
382-
#end
383-
#hsh
384367
end
385368

386369
## WRITE COMMANDS ##

lib/git/object.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ class GitTagNameDoesNotExist< StandardError
77
class Object
88

99
class AbstractObject
10-
attr_accessor :objectish, :size, :type, :mode
10+
attr_accessor :objectish, :type, :mode
11+
12+
attr_writer :size
1113

1214
def initialize(base, objectish)
1315
@base = base

lib/git/remote.rb

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ def initialize(base, name)
1111
@fetch_opts = config['fetch']
1212
end
1313

14-
def remove
15-
@base.remote_remove(@name)
16-
end
17-
1814
def fetch
1915
@base.fetch(@name)
2016
end

tests/units/test_init.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def test_git_clone_config
7777
# trying to open a git project using a bare repo - rather than using Git.repo
7878
def test_git_open_error
7979
assert_raise ArgumentError do
80-
g = Git.open @wbare
80+
Git.open @wbare
8181
end
8282
end
8383

tests/units/test_remotes.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ def test_push
8686
loc = Git.clone(@wbare, 'local')
8787
rem = Git.clone(@wbare, 'remote', :config => 'receive.denyCurrentBranch=ignore')
8888

89-
r = loc.add_remote('testrem', rem)
89+
loc.add_remote('testrem', rem)
9090

9191
loc.chdir do
9292
new_file('test-file1', 'blahblahblah1')

tests/units/test_tree_ops.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,14 +91,16 @@ def test_read_tree
9191
tmp = Tempfile.new('tesxt')
9292
tmppath = tmp.path
9393
tmp.unlink
94-
tr2 = g.with_index(tmppath) do
94+
95+
g.with_index(tmppath) do
9596
g.read_tree('testbranch1', :prefix => 'b1/')
9697
g.read_tree('testbranch3', :prefix => 'b3/')
9798
index = g.ls_files
9899
assert(!index['b2/test-file2'])
99100
assert(index['b3/test-file3'])
100101
g.commit('hi')
101102
end
103+
102104
assert(c.commit?)
103105

104106
files = g.ls_files

0 commit comments

Comments
 (0)