Skip to content

Commit

Permalink
Fix worktree test when git dir includes symlinks (#522)
Browse files Browse the repository at this point in the history
Signed-off-by: James Couball <jcouball@yahoo.com>
  • Loading branch information
jcouball committed Jul 6, 2021
1 parent 0cef8ac commit 8fe479b
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions tests/units/test_worktree.rb
Expand Up @@ -32,23 +32,24 @@ def create_temp_repo(clone_path)

def setup
@git = Git.open(git_working_dir)

@commit = @git.object('1cc8667014381')
@tree = @git.object('1cc8667014381^{tree}')
@blob = @git.object('v2.5:example.txt')

@worktrees = @git.worktrees
end

def test_worktrees_all
assert(@git.worktrees.is_a?(Git::Worktrees))
assert(@git.worktrees.first.is_a?(Git::Worktree))
assert_equal(@git.worktrees.size, 2)
end

def test_worktrees_single
worktree = @git.worktrees.first
assert_equal(worktree.dir, @git.dir.to_s)
git_dir = Pathname.new(@git.dir.to_s).realpath.to_s
assert_equal(worktree.dir, git_dir)
assert_equal(worktree.gcommit, SAMPLE_LAST_COMMIT)
end

Expand Down

0 comments on commit 8fe479b

Please sign in to comment.