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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added failing unit test for most common case; switching while file not in cwd #40

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

TamaMcGlinn
Copy link

@TamaMcGlinn TamaMcGlinn commented May 5, 2021

it is clear in this test that we would want to open file A.txt in the target dir, since we were editing A and A exists in the target. However, what actually happens is that '../featC/A.txt' is not found to be present in featD and hence it opens the root directory of the worktree. (I believe the test currently fails even slightly earlier, in switching, but this is probably due to not understanding the test framework; when I go through the steps manually in vim the switch of the cwd to featD does occur)

@polarmutex
Copy link
Collaborator

the test is failing early because the test repo does not contain a branch name featD, there is just master with A.txt, featB with A.txt and B.txt, and featC with A.txt and C.txt

@ThePrimeagen
Copy link
Owner

Is there any resolve on this? Is this a failing case, or a non case?

@polarmutex @TamaMcGlinn

@TamaMcGlinn
Copy link
Author

it fails, but not in the right way.

Success ||      git-worktree Switch in a featB worktree(bare) with file A open, switch to featC and switch to file A in other worktree
2 / 2: Running post switch callbacks
1 / 2: Checking for worktree featB
2 / 2: Running post switch callbacks
Fail    ||      git-worktree Switch in a featB worktree(bare) with file A inside featC open, switch to featD and switch to file A in other worktree
            ./tests/git_harness.lua:283: Vim:Error executing luv callback:
            ./lua/git-worktree/status.lua:63: 1 / 2: worktree does not exists, please create it first featD

            stack traceback:
                ./tests/git_harness.lua:283: in function <./tests/git_harness.lua:261>

How do I add the featD worktree?

@polarmutex
Copy link
Collaborator

In the test folder
Rename the .git-orig to .git
Then create a new branch
Then rename back

@TamaMcGlinn
Copy link
Author

Thank you, now it fails on the correct assertion - that the file is indeed not opened after switching to a worktree which has that file.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants