Code

Check for invalid names first before trimming name, catching trailing
drwxr-xr-x - branches
drwxr-xr-x - trunk