Fix commit for directory named tags

The previous commit was not working properly for all cases.

I have to admit I was drawing a boolean table to solve this issue :-)