I also believe that the check for newpath in the if statement is no needed.  With it there, it actually breaks the intended function of creating the gitkeep file.