Skip to content

Stop stringifying None in clone kwargs #784

Closed
@nvllsvm

Description

@nvllsvm

Kwargs to git.Repo.clone and git.Repo.clone_from with None values get cast to strings and passed to the git command. This leads to behavior I'd consider non-Pythonic as it's exposing a Python internal null value to something which has no understanding of it.

For example, git.Repo.clone_from(url, path, mirror=None) results git clone --mirror=None -v url path. This is not valid as --mirror takes no arguments.

Instead, a None value should result in one of two things in the git command:

  • Exclude the kwarg entirely
  • Include the kwarg, but treat it as a flag without arguments (ex. --mirror without the =).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions