Only the basename of FILE is written to the ignore file. This is wrong for all filenames relative to project root with one ore more parent directories. The remove option is also implemented incorrectly. The attached patch fixes these errors.