akinsho / git-conflict.nvim

A plugin to visualise and resolve merge conflicts in neovim
1k stars 35 forks source link

Fix #30, add support for git worktrees #81

Closed chase closed 5 months ago

chase commented 6 months ago

For git worktrees, .git is actually a file, not a directory.

I modified create_conflict.sh for testing it with worktrees:

#!/bin/bash
[ -d ./../conflict-test/ ] && rm -rf ./conflict-test/
mkdir conflict-test
cd conflict-test || exit
git init
touch conflicted.lua
git add conflicted.lua
echo "local value = 1 + 1" > conflicted.lua
git commit -am 'initial'
git checkout -b new_branch
echo "local value = 1 - 1" > conflicted.lua
git commit -am 'first commit on new_branch'
git checkout main
cat > conflicted.lua<< EOF
local value = 5 + 7
print(value)
print(string.format("value is %d", value))
EOF
git commit -am 'second commit on main'
git switch new_branch
git worktree add ../worktree-test main
(cd ../worktree-test && git merge new_branch)
b0o commented 5 months ago

Thanks, this fixes the issue for me too!

partounian commented 5 months ago

Awesome work