FS#45425 - [AUR4] Please set receive.denynonfastforwards=false (git config)
Attached to Project:
AUR web interface
Opened by Masato Hashimoto (hashimo) - Tuesday, 23 June 2015, 06:56 GMT
Last edited by Lukas Fleischer (lfleischer) - Saturday, 27 June 2015, 12:14 GMT
Opened by Masato Hashimoto (hashimo) - Tuesday, 23 June 2015, 06:56 GMT
Last edited by Lukas Fleischer (lfleischer) - Saturday, 27 June 2015, 12:14 GMT
|
Details
Currentry, git repos on aur4 is configured as
"receive.denynonfastforwards=true".
It denies `push -f' but it's sometimes inconvenience and, (I think) unnecessary because most aur4 git repos are maintained by only one user. |
This task depends upon
Closed by Lukas Fleischer (lfleischer)
Saturday, 27 June 2015, 12:14 GMT
Reason for closing: Won't implement
Additional comments about closing: Non-fast-forwards cause all kinds of problems. Send an email to aur-support@archlinux.org if you have strong reasons for wanting to edit already pushed commits.
Saturday, 27 June 2015, 12:14 GMT
Reason for closing: Won't implement
Additional comments about closing: Non-fast-forwards cause all kinds of problems. Send an email to aur-support@archlinux.org if you have strong reasons for wanting to edit already pushed commits.
You should test your commits before pushing and not after pushing. IMHO its a bad idea to fix "small mistakes" that got pushed (and therefor published) by rewriting history, there is no point in masking mistakes in the history. How would that end if all open-source software f.e. on github would fix bugs by altering old commits and then force push? *scnr* :P
I often rewrite history when I notice faulty whitespace or other small errors in an older commit, the change far not enough to rectify a sensible commit message. "Fix typo" does not leave a very clean history to work with. Back-and-forth-commits often make it harder to find a certain line in the history. So allowing rewrites will actually make the history more expressive.
With it now necessary to contribute, AUR4 will see many users taking their first steps with git. Personally, when I learned git I rewrote an awful lot. So allowing rewrites keeps the histories clean from any embarrassing rookie mistakes that add no value.
Allowing such by request would predictably put much unneeded work on the TUs, as they would mostly have to review exactly these cases.
The dangerous potential of rewrites normally only unfolds when multiple people have to work with the same history. In the AUR, there always is only one commiter at a time, namely the package maintainer. Though this role may change, never will two people commit to the same repository. So allowing would not cause much harm here. However I acknowledge the fear of history deletion by an adopting user. So I would to propose the following routine for the update hook.
When an update comes in that is no fast-forward, examine all commits that would be deleted (i.e. the range old-master..new-master). Look up the author of these commits. If it is the user who is pushing (the current maintainer), allow the commit. If the author of any of these commits is someone else, reject the push. This would allow any maintainer to only change history he has written himself.
Still, he could update his package by always replacing a sole commit again and again. This could also be discouraged by only allowing rewrites if they leave the history with a given minimum number of commits.
Perhaps, some heuristic like this could replace the strict rule allowing fast-forwards only.
However all other reasons are just silly and actually just prove my point why this should not be done. Its just stupid to rewrite all history to fix things like typo and whitespace issues. Different users will have different reasons to "clean up the history" so it will or may end in totally weird rewrites that basically also may introduce breakage for commits that have been working before.
It causes harm, its not just about how many people are commiting to that repository, its also about the end-user point of view. For example I now simply have all repositories of AUR packages that I have installed checked out into a folder. Some scripts run through and check for new deltas upstream, if there are any for a package then I can review the changes and continue building. I store a logfile of commits per package for historical reasons. If someone fast-forwards in that repository then it breaks the reproducibility as I may not be able to re-build that certain point in the history (for whatever reason, I mean a rewritten history may also introduce regression). Its a nice "feature" that the history is static and whatever happens I can jump or use a commit where I know that it is working. If upstream has rewritten the history and I don't have any other checkout then its simply lost and is not reproducible anymore.
So its simply not true that the "dangerous potential of rewrites" only applies if multiple people work at the same repo, as mentioned having a reproducible history is a nice and important "side-effect". Its really a very bad habit rewriting history and should only be done in very very rare cases that justify it (f.e. like cryptocrack's example with the privacy info of a user), besides such corner-cases (where I also see TU interaction as mandatory) that not being able to rewrite has to be enforced.
A reproducible history and therefor reproducible source (PKGBUILD) input for building the package is a very high good that we should try to maintain as good as its possible.
TL;DR:
- maybe consider adding an easy way for users to request _corner case_ rewrite that are somehow approved by TU's (this has to include the history for review)
- never allow users to rewrite history by themselves under no circumstances
It is also true that any leaked information should be considered compromised but we should still give the users a possibility to minimize the degree of damage. Ianal but we might even be forced to do that, e.g. by the right to be forgotten or by other laws governing data protection and privacy. We should make it clear that "made a typo" definitely isn't a valid reason for a non-fast-forward push, though.
As far as progress, "Reason for closing: Won't implement" is pretty much it.