Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix worktree test when git dir includes symlinks #522

Merged
merged 1 commit into from Jul 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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