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

Encoding issue with tags in packed-refs file #2064

Open
@benmss

Description

@benmss

Tags found in thepacked-refs file that can be created by the Git commandgit pack-refs do not have to be UTF8 encoded. In these cases, GitPython fails to read these tags due to assuming they should be UTF8 compatible.

The source for this issue is found here:
https://github.com/gitpython-developers/GitPython/blob/main/git/refs/symbolic.py#L124

withopen(cls._get_packed_refs_path(repo),"rt",encoding="UTF-8")asfp:

A working example (using a repository with a non-utf8 tag):

git clone https://github.com/ACRA/acracd acra

Create a Python script with the following content:

importgitrepo=git.Repo(".")print(repo.tags)

Execute the script:

python script.py

Result:
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xc3 in position 6216: invalid continuation byte

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


      [8]ページ先頭

      ©2009-2025 Movatter.jp