Skip to content

Commit eeed5ae

Browse files
authored
Store decoded branch name instead of bytes (#664)
`DESTINATION_BRANCH_TO_USE` - is "declared" as a string https://github.com/qgis-deployment/qgis-deployment-toolbelt-cli/blob/38859d135c7561f8b3bc2d6525405f64f56d4e1c/qgis_deployment_toolbelt/profiles/profiles_handler_base.py#L62 - is always populated with a string in : - __init__ - https://github.com/qgis-deployment/qgis-deployment-toolbelt-cli/blob/38859d135c7561f8b3bc2d6525405f64f56d4e1c/qgis_deployment_toolbelt/profiles/local_git_handler.py#L98-L104 ```python def get_active_branch_from_local_repository(self, local_git_repository_path: Path | None = None) -> str: ``` - ... Without this change, the type of this variable becomes mixed `str | bytes` But indeed, it needs to be converted to bytes at some point ([here](https://github.com/qgis-deployment/qgis-deployment-toolbelt-cli/blob/38859d135c7561f8b3bc2d6525405f64f56d4e1c/qgis_deployment_toolbelt/profiles/profiles_handler_base.py#L492-L500)) but it's cleaner to let the function handles the conversion instead of store the branch name as bytes In my case, I relied on str type when testing #661 and I end up comparing `"main"` with `b"main"` equals False
2 parents c774fef + 0376961 commit eeed5ae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

qgis_deployment_toolbelt/profiles/profiles_handler_base.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ def download(self, destination_local_path: Path) -> Repo:
374374
if isinstance(local_git_repository, Repo):
375375
self.DESTINATION_BRANCH_TO_USE = porcelain.active_branch(
376376
local_git_repository
377-
)
377+
).decode()
378378

379379
return local_git_repository
380380

0 commit comments

Comments
 (0)