← Winnitude! Search  ·  Reader Mode (884 ms)
Links: Stay in Reader Retro Site Converter Retro Mode: OFF Original Page ↗
GITHUB · 17 LINKS

Encoding issue with tags in packed-refs file · Issue #2064 · gitpython-developers/GitPython

Repository navigation

Encoding issue with tags in packed-refs file  #2064


New issue

New issue

Closed
Bug #2308
Closed
Encoding issue with tags in packed-refs file #2064 Bug #2308 Labels
acknowledged

help wanted
Milestone v4.0

Description

@benmss's profile benmss opened on Aug 6, 2025

Tags found in the packed-refs file that can be created by the Git command git 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

with open(cls._get_packed_refs_path(repo), "rt", encoding="UTF-8") as fp:

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

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

Create a Python script with the following content:

import git
repo = 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

    Labels


    acknowledged

    help wanted

    Type

    Bug

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions