repobee / repobee-sanitizer

A plugin for sanitizing master repositories before distribution to students
MIT License
2 stars 3 forks source link

Check repo state currently initializes repo instead of wrapping it #47

Closed tohanss closed 4 years ago

tohanss commented 4 years ago

There is also no test to check what happens if repo_path is not a git repo

tohanss commented 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

slarse commented 4 years ago

@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 :)

tohanss commented 4 years ago

Yes, that is what i mean. "Cast the directory" was a poor choice of words for

git.Repo(repo_root)

tohanss commented 4 years ago

But yes, i agree that it should be a part of another issue if we want to test that.

slarse commented 4 years ago

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.