-
Notifications
You must be signed in to change notification settings - Fork 12
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
fix(git): Fix update_repo when there are untracked files (Take 2) #425
fix(git): Fix update_repo when there are untracked files (Take 2) #425
Conversation
@jfpedroza sounds good |
Codecov Report
@@ Coverage Diff @@
## master #425 +/- ##
==========================================
+ Coverage 62.20% 62.87% +0.67%
==========================================
Files 39 39
Lines 2918 2947 +29
Branches 698 702 +4
==========================================
+ Hits 1815 1853 +38
+ Misses 667 659 -8
+ Partials 436 435 -1
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
@tony I'm having some issues for testing what I want. I can't test a rebase with conflicts because the remote repo is not bare and pushing fails. I'll push my changes. |
9bb47ff
to
d16c5f9
Compare
I'll take a look |
Taking a look P.S. when you test, which command do you run? Do you have |
re: #425 (comment) @jfpedroza Try these to re-run tests on file save No
|
I don't have I'll take a look at |
@jfpedroza I will take a look at I'm taking a closer look into your specific error now |
@jfpedroza Rebase so you can get dcf97f8 |
d16c5f9
to
658477d
Compare
Next, instead of doing: def test_repo_update_stash_cases(
tmp_path: pathlib.Path,
- git_remote_repo: pathlib.Path,
+ create_git_remote_repo: CreateProjectCallbackFixtureProtocol,
mocker: MockerFixture,
has_untracked_files: bool,
needs_stash: bool,
has_remote_changes: bool,
) -> None:
+ git_remote_repo = create_git_remote_repo()
+
options = {
"url": f"file://{git_remote_repo}",
"dir": tmp_path / "myrepo",
My full diff: diff --git a/tests/sync/test_git.py b/tests/sync/test_git.py
index b67a2e4..4e86938 100644
--- a/tests/sync/test_git.py
+++ b/tests/sync/test_git.py
@@ -121,7 +121,7 @@ def test_repo_git_obtain_full(
"url": f"file://{git_remote_repo}",
"dir": tmp_path / "myrepo",
"vcs": "git",
- }
+ },
],
[
create_project,
@@ -156,24 +156,29 @@ def test_repo_update_handle_cases(
assert mocker.call(["symbolic-ref", "--short", "HEAD"]) not in mocka.mock_calls
-@pytest.mark.parametrize("has_untracked_files,needs_stash,has_remote_changes", [
- [True, True, True],
- [True, True, False],
- [True, False, True],
- [True, False, False],
- [False, True, True],
- [False, True, False],
- [False, False, True],
- [False, False, False]
-])
+@pytest.mark.parametrize(
+ "has_untracked_files,needs_stash,has_remote_changes",
+ [
+ [True, True, True],
+ [True, True, False],
+ [True, False, True],
+ [True, False, False],
+ [False, True, True],
+ [False, True, False],
+ [False, False, True],
+ [False, False, False],
+ ],
+)
def test_repo_update_stash_cases(
tmp_path: pathlib.Path,
- git_remote_repo: pathlib.Path,
+ create_git_remote_repo: CreateProjectCallbackFixtureProtocol,
mocker: MockerFixture,
has_untracked_files: bool,
needs_stash: bool,
has_remote_changes: bool,
) -> None:
+ git_remote_repo = create_git_remote_repo()
+
options = {
"url": f"file://{git_remote_repo}",
"dir": tmp_path / "myrepo", |
@jfpedroza Are you in a better spot? Or should I try to suggest more things? |
658477d
to
1419be5
Compare
I was able to fix tests with that. Only thing missing is that |
@jfpedroza Taking a look |
@jfpedroza invited to the slack (if that makes it easier) |
@tony Never mind, I switched to running the global vcspull at some point. It now doesn't crash :) |
|
For mypy: diff --git a/tests/sync/test_git.py b/tests/sync/test_git.py
index bea711c..fe25976 100644
--- a/tests/sync/test_git.py
+++ b/tests/sync/test_git.py
@@ -178,13 +178,12 @@ def test_repo_update_stash_cases(
has_remote_changes: bool,
) -> None:
git_remote_repo = create_git_remote_repo()
- options = {
- "url": f"file://{git_remote_repo}",
- "dir": tmp_path / "myrepo",
- "vcs": "git",
- }
- git_repo: GitSync = GitSync(**options)
+ git_repo: GitSync = GitSync(
+ url=f"file://{git_remote_repo}",
+ dir=tmp_path / "myrepo",
+ vcs="git",
+ )
git_repo.obtain() # clone initial repo
def make_file(filename: str) -> pathlib.Path: |
1419be5
to
a23b1a6
Compare
I check the error, if it says "Aborting", there is nothing to do. I believe this is now ready. |
@jfpedroza Do you want to add a note to CHANGES? |
a23b1a6
to
ab81dff
Compare
@tony Done. |
Live in v0.17.0a1 |
- Improvements to pytest plugin vcs-python/libvcs#426 - Improvements to syncing git with untracked files vcs-python/libvcs#425
Second attempt at fixing #395
Alternative to #422
I'm going to see if I can add tests in case there are conflicts.