Skip to content

tqdm crashes because .git/refs/heads is empty #635

@ilyapopov

Description

@ilyapopov
Traceback (most recent call last):
  File "./photos.py", line 12, in <module>
    from extern.tqdm.tqdm import tqdm
  File "/xxx/tqdm/tqdm/__init__.py", line 6, in <module>
    from ._main import main
  File "/xxx/tqdm/tqdm/_main.py", line 2, in <module>
    from ._version import __version__  # NOQA
  File "/xxx/tqdm/tqdm/_version.py", line 40, in <module>
    with io_open(ref_file_path, 'r') as fh_branch:
FileNotFoundError: [Errno 2] No such file or directory: '/xxx/tqdm/.git/refs/heads/master'

I use Ubuntu 18.10 with git 2.19.1. I pulled latest tqdm code commit 350640d

My .git/refs directory looks like this (note that .git/refs/heads/ is empty):

.git/refs/
.git/refs/remotes
.git/refs/remotes/origin
.git/refs/remotes/origin/HEAD
.git/refs/heads
.git/refs/tags

Instead, I have a .git/packed-refs file that looks like this:

# pack-refs with: peeled fully-peeled sorted 
350640d3171a568fb3f22d64d898e154541acc56 refs/heads/master
c5661cdd06e317dcf908deb4a88d7bfa41ba88ab refs/remotes/origin/7zx
83feeb87a3fad62009e266527922720433f2c362 refs/remotes/origin/aplavin-patch-2
bde462a6cd1ca3c3b090c309ee280f0d7db6c2ee refs/remotes/origin/appveyor
fdb485a34b66b3c2a71ad5a9b7ebb166ea3ce41f refs/remotes/origin/async-coroutine
5f4041552b96318bb20f158442ecfd86a8e74bba refs/remotes/origin/bar_format_callback
6e22bd9b42a51c3ce1c02d3757a40422fe8fa0d5 refs/remotes/origin/bars
ac5a99e26e862831b99b5ab5a6475ff30b126883 refs/remotes/origin/blaz-patch
25d4cbb757cf3329994fef3ce7c562dc807b24cd refs/remotes/origin/bytecode-perf
170bf4a353894f4f42190afac817c833b07077a6 refs/remotes/origin/cli-path
a44fe7e1e9c940de94f9f896d60b78fde2d919d1 refs/remotes/origin/contrib
<...>

I think tqdm should not rely on internal structures of git repository and use git commands instead.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions