Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #931 and fixes #442
This PR updates
in_prepared_repo
to a different scenario (called "Scenario 2"), namely that the user changes directory to a git repo aftersetup()
has already been called. This makes 14 tests fail, also including the tests for hunk operations which explains the issue #931.The second commit fixes all failing tests, by making sure
repository.git_root
andrepository.git_path
is updated on every refresh of the status. Also this commit removes the unusedrepository.cwd
.Maybe this PR could be extended so that
in_prepared_repo
would run each test for both scenarios:nvim
inside the git repo).nvim
and then:cd
into the git repo)I was not able to fit both scenarios into
in_prepared_repo
because running Scenario 1 first would influence the outcome of running Scenario 2, so some critical cleanup was missing between running both scenarios. Maybe somebody can help me with this? With the bugfix included in this PR all tests pass when running them in either Scenario 1 and Scenario 2 separately. We could of course also duplicate all tests, but that would be ugly. What we really want is that that every test passes in either scenario, because that assert that neogit behaves the same.