Thanks to visit codestin.com
Credit goes to github.com

Skip to content

gpgsig not populated correctly #500

Closed
@jamesmkwan

Description

@jamesmkwan

Unlike the other attributes in a Commit object, the attribute gpgsig is always set by the Commit constructor. If you look at all the previous lines, they are guarded with a if X is not None:.

Since the Commit object can then be created with gpgsig = None, this causes the __getattr__ in LazyMixin to not be called, which is responsible for calling _set_cache_ which ultimately calls _deserialize to populate gpgsig.

This unfortunately causes the bug that if gpgsig is the first attribute read, it returns None even when the commit is signed. For example, if before reading gpgsig, we read another attribute like message, reading gpgsig will work. This made the bug hard to discover and debug. 😞

I believe that this bug can be fixed just by adding a if gpgsig is not None: conditional in the line above.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions