Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Do not call get_user_id if it is not needed#1314

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
Yobmod merged 9 commits intogitpython-developers:mainfromeric-wieser:patch-1
Aug 6, 2021

Conversation

eric-wieser
Copy link
Contributor

@eric-wiesereric-wieser commentedAug 3, 2021
edited
Loading

On systems without any environment variables (such as sandboxed CI runs) and nopwd module (such as windows), GitPython crashes.

This is just a logic error - there is no reason to fallback topwd until the config lookup has actually failed. The implementation ofConfigWriter.get_value is to catchException, so this patch doesn't attempt to work out a more specific exception than what was used before.

Thisfixes#356

On systems without any environment variables and no pwd module, gitpython crashes as it tries to read the environment variable before looking at its config.
@eric-wieser
Copy link
ContributorAuthor

It looks like a maintainer might have to approve the workflow runs each time I try to fix the mypy troubles...

@Yobmod
Copy link
Contributor

Yobmod commentedAug 3, 2021
edited
Loading

I've added an overload to config.py get_value() in main that fixes the/a mypy issue, if you want to copy that accross

    @overload    def get_value(self, section: str, option: str, default: None = None) -> str: ...

edit:
And I merged the other PR, so hopefully the checks on this one will auto run

eric-wieser reacted with heart emoji

This won't try and do something silly like convert `username=1` to a number.
@eric-wieser
Copy link
ContributorAuthor

And I merged the other PR, so hopefully the checks on this one will auto run

No you didn't, you closed it!

self.assertTrue(committer.email.startswith('user@'))
committer=Actor.committer(None)
author=Actor.author(None)
# We can't test with `self.rorepo.config_reader()` here, as the uuid laziness
Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

I assume there's some way to get a writeable repo that we can override the config in, but I'm not familiar enough with your fixtures to want to go to the effort of working that out.

Copy link
Member

Choose a reason for hiding this comment

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

Thanks a lot for helping with the test. Getting a repository with write permissionscan be done like this.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Thanks, I added another test. It turns out that this comment still applies, as the only reason now that the patched get_user would be called is if the global git config is missing.

Copy link
Contributor

Choose a reason for hiding this comment

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

Just wondering, does it matter if Dev's have to have git.name --global set?

I just did a fresh Ubuntu install and one test failed until I set git.email anyway.

If that wasn't a fluke, can put in test instructions to set both.

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Which test fails?

Copy link
Contributor

@YobmodYobmodAug 4, 2021
edited
Loading

Choose a reason for hiding this comment

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

Test_remote.py, assertion at line 333 failed.

Also came with warnings about not being able to do something (create temporary file/folder?) at git://localhost:19418/daemon_repo-test_base-5tjbtmwj.

But fixed by setting git.email --global

Could have been an anomaly, too much work to reinstall and build python from source again to check!

Copy link
ContributorAuthor

Choose a reason for hiding this comment

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

Oh, I thought you meant my new test failed!

Copy link
Member

@ByronByron left a comment

Choose a reason for hiding this comment

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

Thank a lot, this looks good to me.

It seems the difficulty stems more from dealing with tests and CI than the actual code change, and I don't fully follow. Hence I leave it to@Yobmod to merge in case there is nothing I missed.

@YobmodYobmod merged commitea1a03a intogitpython-developers:mainAug 6, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@YobmodYobmodYobmod left review comments

@ByronByronByron approved these changes

Assignees
No one assigned
Labels
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

Windows : ImportError: No module named pwd on util.py
3 participants
@eric-wieser@Yobmod@Byron

[8]ページ先頭

©2009-2025 Movatter.jp