repobee / repobee-sanitizer

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

Make sure sanitizing from solutions branch doesnt crash with 0 diff #108

Closed tohanss closed 4 years ago

tohanss commented 4 years ago

I believe there was a bug before when we tested sanitizing to the master branch. If there was no difference between master and the sanitized solutions sanitizer would crash/break/complain. There was no issue created for this and therefore we should test it to see if it is still a problem.

tohanss commented 4 years ago

I think this is the error:

[ERROR] GitCommandError: Cmd('git') failed due to: exit code(1)
  cmdline: git commit -m 'Sanitize files'
  stdout: 'On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean'

In this case, i got this while trying to test sanitizing my solutions branch. Which just tells me theres no diff and i did something right, meaning master in untouched

slarse commented 4 years ago

One way to solve this would be to check if there is a diff between the staged version and the previous commit, before trying to commit. In other words:

git diff --staged

With git-python, it should probably translate to repo.git.diff("--staged").