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

Auto retrieve git branch name when no rev/branch is specified on git url (fix #3366) #4386

Closed

Conversation

grimmerk
Copy link

@grimmerk grimmerk commented Aug 16, 2021

Pull Request Check List

Resolves: #3366

  • Added tests for changed code.
  • Updated documentation for changed code.

As a result, if you use poetry add poetry add git+ssh://[email protected]/demo.git, the pyproject.toml will include

[tool.poetry.dependencies]
python = "^3.9"
test-poetry = {git = "[email protected]:demo/demo.git", rev = "its_default_branch_name"}

This pull request relies on python-poetry/poetry-core#192 which is merged to master branch of poetry-core yet. Currently, this PR is using mocker.patch for poetry.core.vcs.git.Git.get_current_branch. But it actually needs a new release of poetry-core including python-poetry/poetry-core#185 to take effect.

@grimmerk grimmerk force-pushed the auto_fetch_branch_name branch from dfb3eee to c31df61 Compare October 13, 2021 16:42
@grimmerk
Copy link
Author

@abn , could you review this pull request?

@grimmerk grimmerk changed the title Auto fetch git branch name when no rev/branch is specified on git url Auto retrieve git branch name when no rev/branch is specified on git url Oct 14, 2021
@grimmerk grimmerk changed the title Auto retrieve git branch name when no rev/branch is specified on git url Auto retrieve git branch name when no rev/branch is specified on git url (fix #3366) Oct 14, 2021
@joooeey
Copy link

joooeey commented Oct 29, 2021

This doesn't resolve #3366 for those of us who edit pyproject.toml directly in place of using poetry add on the command line. I think this problem should be resolved further upstream, i.e. here: #3366 (comment)

@grimmerk
Copy link
Author

grimmerk commented Oct 29, 2021

@joooeey
Thank you for pointing this. Since #3366 does not have the detailed case you mention. Could you supply the detailed re-produced steps and expected result somewhere? Although the extra case (pyproject.toml) may not be fixed by me, it would be still very helpful.

@abn
Copy link
Member

abn commented Oct 30, 2021

@grimmer0125 thank you for your contribution. I believe the upcoming changes now work with the tests (#4604).

I am not sure if all the changes here are required. Let me know if I am missiong something.

@joooeey
Copy link

joooeey commented Nov 2, 2021

@joooeey Thank you for pointing this. Since #3366 does not have the detailed case you mention. Could you supply the detailed re-produced steps and expected result somewhere? Although the extra case (pyproject.toml) may not be fixed by me, it would be still very helpful.

Steps to reproduce this are given here: #3366 (comment)

@grimmerk
Copy link
Author

grimmerk commented Nov 3, 2021

I am not sure if all the changes here are required. Let me know if I am missiong something.

@abn ,
In this PR, I have rebased on the master branch whose latest commit includes #4604 and tried to make a minimal code change of this PR to make all the tests pass.

@grimmerk
Copy link
Author

grimmerk commented Nov 3, 2021

Steps to reproduce this are given here: #3366 (comment)

@joooeey , thank you for listing the detail. For your "edit pyproject.toml directly" case, the root cause is poetry will use the hard-code master branch since no branch/rev specified, #python-poetry/poetry-core/pull/192 (a kind of the further upstream) already remove the default branch as "master", and if there is no specified branch name and no hard-code master branch, this PR (#4386 ) will try to retrieve the default branch via git command, and the pyproject.toml will still keep sentinelsat = { git = "https://github.com/sentinelsat/sentinelsat.git" } in your case.

@grimmerk
Copy link
Author

grimmerk commented Nov 20, 2021

The below message is weird that I don't see any merge conflict locally.

@Secrus
Copy link
Member

Secrus commented Jun 20, 2022

The issue seems to have been fixed in the meantime. Closing.

@Secrus Secrus closed this Jun 20, 2022
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

git install doesn't recognize new main default branch
4 participants