On 29/01/21 14:56 +0000, Jonathan Wakely wrote:
On 27/01/21 14:13 -0800, Josh Stone wrote:
On 1/27/21 2:04 PM, Otto Urpelainen wrote:
The other option of not using 'git add .' can also be described as
mentally filtering out all the irrelevant unstaged changes to find the
ones that should actually be added. That adds cognitive burden, slows
things down and leads to mistakes every now and then. It does not help
to say "do not make mistakes" if the task is inherently error-prone.
Such filtering is something a computer should do, which leads us back to
.gitignore.
FWIW, 'git add -u' (--update) will limit you to files that are already
part of the repo. You still need to pay attention if there really are
new files though, like a new patch.
'git add .' is almost never right. Even if you don't use 'fedpkg
local' you can still have unwanted files from other fedpkg commands
like prep and mockbuild.
Anybody who uses Git without modifying their shell prompt to display
the status of the working tree when in a Git repo is either foolish or
very brave (or just smart enough to run 'git status' *all* *the*
*time*).
It's not necessary to modify the .gitignore for every repo in
dist-git, the 'fedpkg clone' command could be made to add the patterns
to .git/info/exclude instead. That has the same effect as adding them
to .gitignore but isn't committed to dist-git.
One advantage of using .git/info/exclude is that the files are ignored
on all branches, including historical ones. Adding new patterns to
.gitignore will only have effect on the branches where you make those
additions, and only from the point where they're added. Using
.git/info/exclude means they're ignored if you check out an old branch
like f31 or check out old commits for bisection.
So if fedpkg clone just added things to .git/info/exclude there would
be no need to modify every .gitignore file in every repo on every
active branch. There could also be a 'fedpkg refresh' command that
makes those .git/info/exclude changes to an existing clone. That
refresh command could also add the local git pre-push hook being
talked about in another thread.
_______________________________________________
devel mailing list -- devel@xxxxxxxxxxxxxxxxxxxxxxx
To unsubscribe send an email to devel-leave@xxxxxxxxxxxxxxxxxxxxxxx
Fedora Code of Conduct: https://docs.fedoraproject.org/en-US/project/code-of-conduct/
List Guidelines: https://fedoraproject.org/wiki/Mailing_list_guidelines
List Archives: https://lists.fedoraproject.org/archives/list/devel@xxxxxxxxxxxxxxxxxxxxxxx