Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ rvm:
- 1.9.2
- 1.9.3
- 2.0.0
- 2.1
- jruby-18mode
- jruby-19mode
- jruby-head
Expand Down
4 changes: 2 additions & 2 deletions lib/git/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -446,13 +446,13 @@ def gc
end

def apply(file)
if File.exists?(file)
if File.exist?(file)
self.lib.apply(file)
end
end

def apply_mail(file)
self.lib.apply_mail(file) if File.exists?(file)
self.lib.apply_mail(file) if File.exist?(file)
end

## LOWER LEVEL INDEX OPERATIONS ##
Expand Down
2 changes: 1 addition & 1 deletion lib/git/lib.rb
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ def pull(remote='origin', branch='master')

def tag_sha(tag_name)
head = File.join(@git_dir, 'refs', 'tags', tag_name)
return File.read(head).chomp if File.exists?(head)
return File.read(head).chomp if File.exist?(head)

command('show-ref', ['--tags', '-s', tag_name])
end
Expand Down
2 changes: 1 addition & 1 deletion lib/git/path.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Path
def initialize(path, check_path=true)
path = File.expand_path(path)

if check_path && !File.exists?(path)
if check_path && !File.exist?(path)
raise ArgumentError, 'path does not exist', [path]
end

Expand Down
14 changes: 7 additions & 7 deletions tests/units/test_archive.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ def tempfile

def test_archive
f = @git.archive('v2.6', tempfile)
assert(File.exists?(f))
assert(File.exist?(f))

f = @git.object('v2.6').archive(tempfile) # writes to given file
assert(File.exists?(f))
assert(File.exist?(f))

f = @git.object('v2.6').archive # returns path to temp file
assert(File.exists?(f))
assert(File.exist?(f))

f = @git.object('v2.6').archive(nil, :format => 'tar') # returns path to temp file
assert(File.exists?(f))
assert(File.exist?(f))

lines = `cd /tmp; tar xvpf #{f}`.split("\n")
assert_equal('ex_dir/', lines[0])
Expand All @@ -34,10 +34,10 @@ def test_archive
assert(File.file?(f))

f = @git.object('v2.6').archive(tempfile, :format => 'tgz', :prefix => 'test/')
assert(File.exists?(f))
assert(File.exist?(f))

f = @git.object('v2.6').archive(tempfile, :format => 'tar', :prefix => 'test/', :path => 'ex_dir/')
assert(File.exists?(f))
assert(File.exist?(f))

lines = `cd /tmp; tar xvpf #{f}`.split("\n")
assert_equal('test/', lines[0])
Expand All @@ -47,7 +47,7 @@ def test_archive
c = Git.clone(@wbare, 'new')
c.chdir do
f = @git.remote('origin').branch('master').archive(tempfile, :format => 'tgz')
assert(File.exists?(f))
assert(File.exist?(f))
end
end
end
Expand Down
22 changes: 11 additions & 11 deletions tests/units/test_index_ops.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,26 +56,26 @@ def test_clean
new_file('clean-me-too', 'blablahbla')
end

assert(File.exists?('file-to-clean'))
assert(File.exists?('dir_to_clean'))
assert(File.exists?('ignored_file'))
assert(File.exist?('file-to-clean'))
assert(File.exist?('dir_to_clean'))
assert(File.exist?('ignored_file'))

g.clean(:force => true)

assert(!File.exists?('file-to-clean'))
assert(File.exists?('dir_to_clean'))
assert(File.exists?('ignored_file'))
assert(!File.exist?('file-to-clean'))
assert(File.exist?('dir_to_clean'))
assert(File.exist?('ignored_file'))

new_file('file-to-clean', 'blablahbla')

g.clean(:force => true, :d => true)

assert(!File.exists?('file-to-clean'))
assert(!File.exists?('dir_to_clean'))
assert(File.exists?('ignored_file'))
assert(!File.exist?('file-to-clean'))
assert(!File.exist?('dir_to_clean'))
assert(File.exist?('ignored_file'))

g.clean(:force => true, :x => true)
assert(!File.exists?('ignored_file'))
assert(!File.exist?('ignored_file'))
end
end
end
Expand All @@ -97,7 +97,7 @@ def test_revert
commits = g.log(1e4).count
g.revert(first_commit.sha)
assert_equal(commits + 1, g.log(1e4).count)
assert(!File.exists?('test-file2'))
assert(!File.exist?('test-file2'))
end
end
end
Expand Down
14 changes: 7 additions & 7 deletions tests/units/test_init.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def test_git_init
in_temp_dir do |path|
repo = Git.init(path)
assert(File.directory?(File.join(path, '.git')))
assert(File.exists?(File.join(path, '.git', 'config')))
assert(File.exist?(File.join(path, '.git', 'config')))
assert_equal('false', repo.config('core.bare'))
end
end
Expand All @@ -43,34 +43,34 @@ def test_git_init_bare
in_temp_dir do |path|
repo = Git.init(path, :bare => true)
assert(File.directory?(File.join(path, '.git')))
assert(File.exists?(File.join(path, '.git', 'config')))
assert(File.exist?(File.join(path, '.git', 'config')))
assert_equal('true', repo.config('core.bare'))
end
end

def test_git_init_remote_git
in_temp_dir do |dir|
assert(!File.exists?(File.join(dir, 'config')))
assert(!File.exist?(File.join(dir, 'config')))

in_temp_dir do |path|
Git.init(path, :repository => dir)
assert(File.exists?(File.join(dir, 'config')))
assert(File.exist?(File.join(dir, 'config')))
end
end
end

def test_git_clone
in_temp_dir do |path|
g = Git.clone(@wbare, 'bare-co')
assert(File.exists?(File.join(g.repo.path, 'config')))
assert(File.exist?(File.join(g.repo.path, 'config')))
assert(g.dir)
end
end

def test_git_clone_bare
in_temp_dir do |path|
g = Git.clone(@wbare, 'bare.git', :bare => true)
assert(File.exists?(File.join(g.repo.path, 'config')))
assert(File.exist?(File.join(g.repo.path, 'config')))
assert_nil(g.dir)
end
end
Expand All @@ -79,7 +79,7 @@ def test_git_clone_config
in_temp_dir do |path|
g = Git.clone(@wbare, 'config.git', :config => "receive.denyCurrentBranch=ignore")
assert_equal('ignore', g.config['receive.denycurrentbranch'])
assert(File.exists?(File.join(g.repo.path, 'config')))
assert(File.exist?(File.join(g.repo.path, 'config')))
assert(g.dir)
end
end
Expand Down