[MacPorts] #38902: Write a pre-commit hook to prevent expanded keywords from being committed
#38902: Write a pre-commit hook to prevent expanded keywords from being committed ----------------------------+------------------------- Reporter: ryandesign@… | Owner: wsiegrist@… Type: enhancement | Status: new Priority: Normal | Milestone: Component: server/hosting | Version: Keywords: | Port: ----------------------------+------------------------- We should have a pre-commit hook in the Subversion repository to prevent expanded keywords from being committed. That is, if a file has svn:keywords set to "Id", it should not be possible to commit the file with contents like this: {{{ $Id: anything $ }}} The Subversion client is responsible for normalizing this before committing to: {{{ $Id$ }}} The problem is that some committers use non-standard Subversion clients like git-svn that do not respect this requirement. This could have unforeseen consequences and should be prevented. I will work on writing this pre-commit script. It could be combined with the one needed for #12594. -- Ticket URL: <https://trac.macports.org/ticket/38902> MacPorts <http://www.macports.org/> Ports system for OS X
#38902: Write a pre-commit hook to prevent expanded keywords from being committed -----------------------------+------------------------- Reporter: ryandesign@… | Owner: wsiegrist@… Type: enhancement | Status: new Priority: Normal | Milestone: Component: server/hosting | Version: Resolution: | Keywords: Port: | -----------------------------+------------------------- Comment (by ryandesign@…): This issue has come up from time to time on the mailing list: * https://lists.macosforge.org/pipermail/macports- dev/2009-April/008467.html * https://lists.macosforge.org/pipermail/macports- dev/2009-May/008780.html * https://lists.macosforge.org/pipermail/macports- dev/2011-January/013700.html * https://lists.macosforge.org/pipermail/macports- dev/2013-April/022648.html * https://lists.macosforge.org/pipermail/macports- dev/2013-April/022708.html -- Ticket URL: <https://trac.macports.org/ticket/38902#comment:1> MacPorts <http://www.macports.org/> Ports system for OS X
#38902: Write a pre-commit hook to prevent expanded keywords from being committed -----------------------------+------------------------- Reporter: ryandesign@… | Owner: wsiegrist@… Type: enhancement | Status: new Priority: Normal | Milestone: Component: server/hosting | Version: Resolution: | Keywords: Port: | -----------------------------+------------------------- Comment (by egall@…): Could this be a check done in `port lint` as well? -- Ticket URL: <https://trac.macports.org/ticket/38902#comment:2> MacPorts <http://www.macports.org/> Ports system for OS X
#38902: Write a pre-commit hook to prevent expanded keywords from being committed -----------------------------+------------------------- Reporter: ryandesign@… | Owner: wsiegrist@… Type: enhancement | Status: new Priority: Normal | Milestone: Component: server/hosting | Version: Resolution: | Keywords: Port: | -----------------------------+------------------------- Comment (by larryv@…): Replying to [comment:2 egall@…]:
Could this be a check done in `port lint` as well?
No. This is not a portfile issue; there is nothing wrong with having expanded Subversion keywords in a portfile. The problem is with the broken Subversion clients. -- Ticket URL: <https://trac.macports.org/ticket/38902#comment:5> MacPorts <http://www.macports.org/> Ports system for OS X
#38902: Write a pre-commit hook to prevent expanded keywords from being committed -----------------------------+------------------------- Reporter: ryandesign@… | Owner: wsiegrist@… Type: enhancement | Status: new Priority: Normal | Milestone: Component: server/hosting | Version: Resolution: | Keywords: Port: | -----------------------------+------------------------- Comment (by aronnax@…): Maybe we should first check if this issue is known to the {{{git-svn}}} developers. -- Ticket URL: <https://trac.macports.org/ticket/38902#comment:6> MacPorts <http://www.macports.org/> Ports system for OS X
#38902: Write a pre-commit hook to prevent expanded keywords from being committed -----------------------------+------------------------- Reporter: ryandesign@… | Owner: wsiegrist@… Type: enhancement | Status: new Priority: Normal | Milestone: Component: server/hosting | Version: Resolution: | Keywords: Port: | -----------------------------+------------------------- Comment (by larryv@…): Replying to [comment:6 aronnax@…]:
Maybe we should first check if this issue is known to the {{{git-svn}}} developers.
It must be, given that there’s that [http://git-scm.com/book/en /Customizing-Git-Git-Attributes#Keyword-Expansion rather lengthy section] in //Pro Git// about working around it, which you linked to on macports- dev. -- Ticket URL: <https://trac.macports.org/ticket/38902#comment:7> MacPorts <http://www.macports.org/> Ports system for OS X
#38902: Write a pre-commit hook to prevent expanded keywords from being committed -----------------------------+------------------------- Reporter: ryandesign@… | Owner: wsiegrist@… Type: enhancement | Status: new Priority: Normal | Milestone: Component: server/hosting | Version: Resolution: | Keywords: Port: | -----------------------------+------------------------- Comment (by ecronin@…): In pure git you can't do keyword substitution, but git-svn is a bridge between a local git repo and a remote svn repo and can perform translations as changes go from one to the other. Recent versions of git- svn compress the expanded keyword down to just the $Id$ marker before creating the commit object in git. It is ignored and left alone during all git operations, but then gets expanded back out properly by svn on dcommit. It's a little annoying because locally you don't have the Id info in the file so you have to use git log, but it shouldn't be causing issues with svn. I have no idea when it was added to git-svn, it's worked fine for at least a year for me. Setting the svn attributes to begin with, however, I think you still have do using a svn checkout. And I haven't found a way to turn a git mv into a svn mv that maintains history. -- Ticket URL: <https://trac.macports.org/ticket/38902#comment:8> MacPorts <http://www.macports.org/> Ports system for OS X
#38902: Write a pre-commit hook to prevent expanded keywords from being committed -----------------------------+------------------------- Reporter: ryandesign@… | Owner: wsiegrist@… Type: enhancement | Status: new Priority: Normal | Milestone: Component: server/hosting | Version: Resolution: | Keywords: Port: | -----------------------------+------------------------- Comment (by aronnax@…): ecronin, I am using git-core from MacPorts, {{{git-core @1.8.2.1_0+bash_completion+credential_osxkeychain+doc+pcre+python27+svn}}}. This is the latest stable release of git. Are you sure that git-svn does keyword expansion? -- Ticket URL: <https://trac.macports.org/ticket/38902#comment:9> MacPorts <http://www.macports.org/> Ports system for OS X
#38902: Write a pre-commit hook to prevent expanded keywords from being committed -----------------------------+------------------------- Reporter: ryandesign@… | Owner: wsiegrist@… Type: enhancement | Status: new Priority: Normal | Milestone: Component: server/hosting | Version: Resolution: | Keywords: Port: | -----------------------------+------------------------- Comment (by ecronin@…): It doesn't do keyword expansion in git. It just doesn't screw things up when they're pushed back to svn which is what this ticket is trying to prevent. {{{ % which git /opt/local/bin/git % git svn proplist Portfile Properties on 'Portfile': svn:entry:committed-date svn:entry:committed-rev svn:entry:last-author svn:entry:uuid svn:eol-style svn:keywords svn:wc:ra_dav:version-url % git svn propget svn:keywords Portfile Id % head -1 Portfile # $Id$ }}} If I look at this Portfile in trac from svn the Id line is fully expanded. I checked my global .gitconfig and my macports/.git directory and I don't see that I did any extra customization to get this behavior, but I made this checkout long ago and I don't have time to go digging at the moment. But the link in comment:7 doesn't apply here because the authoritative repo is svn not git. In git-land there is still no keyword substitution happening, and any attempts at faking it using client hooks on commit like suggested there would just break things when it was pushed back into svn. -- Ticket URL: <https://trac.macports.org/ticket/38902#comment:10> MacPorts <http://www.macports.org/> Ports system for OS X
#38902: Write a pre-commit hook to prevent expanded keywords from being committed -----------------------------+------------------------- Reporter: ryandesign@… | Owner: wsiegrist@… Type: enhancement | Status: new Priority: Normal | Milestone: Component: server/hosting | Version: Resolution: | Keywords: Port: | -----------------------------+------------------------- Comment (by ryandesign@…): I don't want to completely prevent committers from using git-svn if that is what they prefer, but I do want to preserve the integrity of the data in our repository and enforce the intended operation of Subversion keywords. Having not used git much I don't know whether the pre-commit hook contemplated in this ticket will accomplish this goal. Can anyone familiar with git say for sure? Or should I write and attach the script for someone with git-svn to test? -- Ticket URL: <https://trac.macports.org/ticket/38902#comment:11> MacPorts <http://www.macports.org/> Ports system for OS X
participants (1)
-
MacPorts