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

Clean up git submodule tests and delay Git status runner #3800

Merged
merged 11 commits into from
Sep 10, 2024

Conversation

DefaultRyan
Copy link
Member

@DefaultRyan DefaultRyan commented Sep 7, 2024

Summary of the pull request

I noticed that the Git Extension unit tests were not running in CI. Also, while running them, I noticed certain things not getting cleaned up properly - I saw error messages from the "git status" as the test repo was being deleted, and the deletion often failed because a LibGit2Sharp.Repository was hanging on to some files under .git.

References and relevant issues

Detailed description of the pull request / Additional comments

On the cleanup side of things in the Git extension:

  • Trying to open the "checked-in" submodule test repositories was failing for some unknown reason in CI pipelines, even though it worked locally. I suspect some file access/permissions weirdness. To fix, moved to cloning a test repo and make state modifications to it live in the test. "WE'LL DO IT LIVE!"
  • When a file system change is detected, don't start running "git status" immediately, wait for the directory to go idle for a few seconds before attempting a status refresh.
  • Added a missing Dispose() call inside RepositoryWrapper.Dispose()
  • When calling into GitLocalRepository from a test, there is no repository cache, so we need to dispose the RepositoryWrapper we created for this call.
  • Added FileExplorerSourceControlIntegrationUnitTest and FileExplorerGitIntegration.UnitTest to CI flow

Validation steps performed

  • Ran unit tests to verify they clean up cleanly now.
  • Built full project and verified that the Git integration still performs as expected.

PR checklist

  • Closes #xxx
  • Tests added/passed
  • Documentation updated

@DefaultRyan DefaultRyan changed the title Delay Git status runner and clean up Git tests Clean up git submodule tests and delay Git status runner Sep 9, 2024
return repository.FindLastCommit(relativePath);
}
catch
{
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: consider catching and logging exception here

@DefaultRyan DefaultRyan merged commit f4a3934 into main Sep 10, 2024
4 checks passed
@DefaultRyan DefaultRyan deleted the user/defaultryan/git-tests branch September 10, 2024 19:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants