Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 275503 - Pre-commit hook for gentoo-news SVN repo
Summary: Pre-commit hook for gentoo-news SVN repo
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Infrastructure
Classification: Unclassified
Component: Git (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Gentoo Infrastructure
URL: http://archives.gentoo.org/gentoo-dev...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-06-26 16:56 UTC by Ulrich Müller
Modified: 2009-08-10 09:57 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
Proposed bash script for pre-commit hook (pre-commit,1.26 KB, text/plain)
2009-06-26 16:57 UTC, Ulrich Müller
Details
Proposed bash script for pre-commit hook (pre-commit,1.40 KB, text/plain)
2009-06-27 06:32 UTC, Ulrich Müller
Details
Proposed bash script for pre-commit hook (pre-commit,1.40 KB, patch)
2009-06-30 06:35 UTC, Ulrich Müller
Details | Diff
pre-commit hook, take 4 (pre-commit,1.41 KB, text/plain)
2009-08-10 00:04 UTC, Ulrich Müller
Details
pre-commit hook, take 5 (pre-commit,1.41 KB, text/plain)
2009-08-10 00:07 UTC, Ulrich Müller
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ulrich Müller gentoo-dev 2009-06-26 16:56:04 UTC
GLEP 42 is restrictive on what is allowed as a filename of a news item, see discussion at URL. I suggest that validity of the name is checked in a pre-commit hook.
Comment 1 Ulrich Müller gentoo-dev 2009-06-26 16:57:15 UTC
Created attachment 195821 [details]
Proposed bash script for pre-commit hook
Comment 2 Alec Warner (RETIRED) archtester gentoo-dev Security 2009-06-26 23:10:15 UTC
Hi Ulrich, thanks for writing this!

Can you add:
1) A $Id$ tag
2) A copyright header
3) A line stating who wrote it

Thanks!
Comment 3 Ulrich Müller gentoo-dev 2009-06-27 06:32:04 UTC
Created attachment 195849 [details]
Proposed bash script for pre-commit hook

(In reply to comment #2)
> Can you add:
> 1) A $Id$ tag
> 2) A copyright header
> 3) A line stating who wrote it

Attached.
Comment 4 Ulrich Müller gentoo-dev 2009-06-30 06:35:35 UTC
Created attachment 196138 [details, diff]
Proposed bash script for pre-commit hook

Updated version with a small fix for the "bad date" error message.

Maybe I should also mention that I've tested the script in a local repository.
Comment 5 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2009-08-09 23:36:57 UTC
This NOT valid bash:
    if [[ ${file} != [0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]-+([-a-z0-9+_]).[a-z][a-z].txt?(.asc) ]]
Comment 6 Ulrich Müller gentoo-dev 2009-08-10 00:04:20 UTC
Created attachment 200758 [details]
pre-commit hook, take 4

(In reply to comment #5)
> This NOT valid bash:
>     if [[ ${file} !=
> [0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9]-+([-a-z0-9+_]).[a-z][a-z].txt?(.asc)
> ]]

I had tested it with bash 3.2.39 and 4.0.24 (and shopt -s extglob).
New version using egrep is attached.
Comment 7 Ulrich Müller gentoo-dev 2009-08-10 00:07:52 UTC
Created attachment 200759 [details]
pre-commit hook, take 5

The condition has to be inverted of course... take 5 is attached.
Comment 8 Robin Johnson archtester Gentoo Infrastructure gentoo-dev Security 2009-08-10 09:57:08 UTC
Deployed now, thanks for fixing it.