Learn more about these different git repos.
Other Git URLs
If there is a entry which matches the filename we're about to add already in the gitignore file, we don't need to bother adding another entry.
This adds a match() method to GitIgnore which uses fnmatch. Under the hood, this is what git uses. It doesn't catch some of the special cases git has, but it should simply fail to match in those cases and will add a potentially redundant entry -- no different than previously.
I don't know if this would be better moved entirely into the GitIgnore class, and call self.match within self.add. I went with the less intrusive change for now.
If we could assume the filename we were adding was in the current directory, a simpler test would be file_basename in repo.untracked_files. But that would fail for anyone that uploads a tarball from outside the working directory.
Comments welcome. I added this because I don't like the upload command mucking with my working .gitignore files. I'm likely the minority, as many folks don't know or care how the ignore rules work. Failing something like this, perhaps an option to upload to not add entries to .gitignore would be acceptable?
attachment 0001-fedpkg-Try-not-to-add-redundant-gitignore-entries.patch
This was applied.
Login to comment on this ticket.