-
-
Notifications
You must be signed in to change notification settings - Fork 382
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
pathlib support #1074
Comments
I'm open to merging PRs that add pathlib support, but I don't believe there's anywhere in Dulwich today that promises pathlib support. |
I guess I was mislead by this: if getattr(path, "encode", None) is not None:
path = os.fsencode(path) |
Ah, I see. That's meant for plain str since RefsContainer uses bytes internally. |
I'm not clear about whether file paths in the API should be bytes or str. Is there a general convention? The functions themselves generally don't say.
It would be nice if there was a uniform convention. |
There are conventions, but not particularly well documented. We should improve that and add more type signatures. It's basically:
In the plumbing:
|
When you say os-native, does that mean str? For example, |
Yep. |
To be fair, using os.fspath() on inputs would probably help. It will as necessary convert pathlib objects into something you can pass further. |
I'm open to PRs that add more use of os.fspath to dulwich.porcelain in particular, if somebody wanted to work on that. |
Suppose we are in an empty bare repository:
This operation gives a
TypeError
(instead of aKeyError
as expected):Error:
The text was updated successfully, but these errors were encountered: