Skip to content

Tutorial: first example code is very unclear and confusing #1039

Open
@pbb72

Description

@pbb72

The first example code in the tutorial is very unclear:

from git import Repo

# rorepo is a Repo instance pointing to the git-python repository.
# For all you know, the first argument to Repo is a path to the repository
# you want to work with
repo = Repo(self.rorepo.working_tree_dir)
assert not repo.bare

To start with, this just gives me the error message

NameError: name 'self' is not defined

The comment "rorepo is a Repo instance pointing to the git-python repository" doesn't help. Does this mean "rorepo" is just an example word, and I have to replace it with something from my own system? Does this reference a directory or a repository name I should create on my filesystem? The term "rorepo" doesn't come up any other places in the whole documentation.

Also the following text is only adding to the confusion. "In the above example, the directory self.rorepo.working_tree_dir equals /Users/mtrier/Development/git-python ..." NOT IT DOESN'T. Maybe it does on the specific system for the documentation writer, but it is not a general rule.

The use of "For all you know..." is very ironic here; this expression literally means that the "you" (the reader) doesn't know what the writer wants...

Please modify the tutorial code to apply to general users. if code requires previous actions/setup, then please specify this.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions