Skip to content

fix(git-hook): Pass branch as bytes #151

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

Merged
merged 3 commits into from
Apr 28, 2025

Conversation

tomasfarias
Copy link
Owner

Dulwich expects repo branch to be bytes, not str. This seems to be a
gap in the type hinting of dulwich, as other arguments to client.clone
can be passed as str.

Regardless, as a workaround, we can encode branch as bytes.

Dulwich expects repo branch to be bytes, not str. This seems to be a
gap in the type hinting of dulwich, as other arguments to client.clone
can be passed as str.

Regardless, as a workaround, we can encode branch as bytes.
@tomasfarias
Copy link
Owner Author

Closes: #150

@tomasfarias tomasfarias changed the title chore(pre-commit): Bump ruff version fix(git-hook): Pass branch as bytes Apr 28, 2025
The | None syntax is only available starting from Python 3.10, but we
still support Python 3.9 as it's supported by dbt.
@tomasfarias
Copy link
Owner Author

Agh, Python 3.9 requires the Optional[...] syntax. I much prefer the | None syntax but it's only available on 3.10 onwards. Anyways, reverted to the deprecated syntax in favor of backwards compatibility. Once dbt drops Python 3.9 we can upgrade.

Comment on lines +304 to +305
# Default to dulwich's
return None
Copy link
Owner Author

Choose a reason for hiding this comment

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

As of today, this would be b"master"

@tomasfarias tomasfarias linked an issue Apr 28, 2025 that may be closed by this pull request
@tomasfarias tomasfarias merged commit e04c659 into master Apr 28, 2025
25 checks passed
@tomasfarias tomasfarias deleted the fix/pass-branch-as-bytes-to-dbt-git-hook branch April 28, 2025 23:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] dulwich throws an error when it gets a branch name
1 participant