Skip to content

Cannot get status of real git repo #68

@wyattscarpenter

Description

@wyattscarpenter

Consider the following:

/tmp$ git clone  --recursive https://github.com/thblt/write-yourself-a-git/ w && cd w && make all && ./wyag status
[...]
On branch master.
Changes to be committed:
Traceback (most recent call last):
  File "/tmp/w/./wyag", line 4, in <module>
    libwyag.main()
  File "/tmp/w/libwyag.py", line 65, in main
    case "status"       : cmd_status(args)
                          ^^^^^^^^^^^^^^^^
  File "/tmp/w/libwyag.py", line 1151, in cmd_status
    cmd_status_head_index(repo, index)
  File "/tmp/w/libwyag.py", line 1196, in cmd_status_head_index
    head = tree_to_dict(repo, "HEAD")
           ^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/w/libwyag.py", line 1173, in tree_to_dict
    tree_sha = object_find(repo, ref, fmt=b"tree")
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/w/libwyag.py", line 811, in object_find
    obj = object_read(repo, sha)
          ^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/w/libwyag.py", line 233, in object_read
    if not os.path.isfile(path):
           ^^^^^^^^^^^^^^^^^^^^
  File "<frozen genericpath>", line 30, in isfile
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType

It's like this for ./wyag log as well.

digraph wyaglog{
  node[shape=rect]
Traceback (most recent call last):
  File "/tmp/w/./wyag", line 4, in <module>
    libwyag.main()
  File "/tmp/w/libwyag.py", line 59, in main
    case "log"          : cmd_log(args)
                          ^^^^^^^^^^^^^
  File "/tmp/w/libwyag.py", line 449, in cmd_log
    log_graphviz(repo, object_find(repo, args.commit), set())
  File "/tmp/w/libwyag.py", line 458, in log_graphviz
    commit = object_read(repo, sha)
             ^^^^^^^^^^^^^^^^^^^^^^
  File "/tmp/w/libwyag.py", line 233, in object_read
    if not os.path.isfile(path):
           ^^^^^^^^^^^^^^^^^^^^
  File "<frozen genericpath>", line 30, in isfile
TypeError: stat: path should be string, bytes, os.PathLike or integer, not NoneType

It's also like this for other git repos that I have on my machine that aren't related to wyag

I'm using Ubuntu 24.04.2 LTS via WSL 2.6.3.0 on Windows 10.0.19045.6809. Normal git works great on this, and python generally seems to act exactly like it's on Linux.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions