Closed tohanss closed 4 years ago
If we remove the initialization and simply cast the directory, gitpython will raise a InvalidGitRepositoryError (if not a valid repo), we should add a test to check this
@tohanss ~This is not related to this issue though, correct?~
This is totally related to this issue. You mean that we should have a test the checks that behavior if the user specifies a repo root that is in fact not the root of a Git repo?
cast the directory
No casting in Python, it's dynamically typed :)
Yes, that is what i mean. "Cast the directory" was a poor choice of words for
git.Repo(repo_root)
But yes, i agree that it should be a part of another issue if we want to test that.
Hmm, you know what, actually I agree with your initial sentiment that it should be part of this issue.
When you do a bugfix, it's always preferable to demonstrate why it is a bug with a test case. So do add a test case that checks that we indeed get an error if we specify a non-git-repo as the repo root.
If you reinsert the init
, the test case should fail.
There is also no test to check what happens if repo_path is not a git repo