summaryrefslogtreecommitdiffstats
path: root/contrib/lib/Gitolite/Triggers/RedmineUserAlias.pm
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 14:17:27 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 14:17:27 +0000
commitaae1a14ea756102251351d96e2567b4986d30e2b (patch)
treea1af617672e26aee4c1031a3aa83e8ff08f6a0a5 /contrib/lib/Gitolite/Triggers/RedmineUserAlias.pm
parentInitial commit. (diff)
downloadgitolite3-3edce23eb7242b5090b7ca2700a1e6b49dab69e8.tar.xz
gitolite3-3edce23eb7242b5090b7ca2700a1e6b49dab69e8.zip
Adding upstream version 3.6.12.upstream/3.6.12upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'contrib/lib/Gitolite/Triggers/RedmineUserAlias.pm')
-rw-r--r--contrib/lib/Gitolite/Triggers/RedmineUserAlias.pm55
1 files changed, 55 insertions, 0 deletions
diff --git a/contrib/lib/Gitolite/Triggers/RedmineUserAlias.pm b/contrib/lib/Gitolite/Triggers/RedmineUserAlias.pm
new file mode 100644
index 0000000..8fde513
--- /dev/null
+++ b/contrib/lib/Gitolite/Triggers/RedmineUserAlias.pm
@@ -0,0 +1,55 @@
+package Gitolite::Triggers::RedmineUserAlias;
+
+use Gitolite::Rc;
+use Gitolite::Common;
+use Gitolite::Conf::Load;
+
+use strict;
+use warnings;
+
+# aliasing a redmine username to a more user-friendly one
+# ----------------------------------------------------------------------
+
+=for usage
+
+Why:
+
+ Redmine creates users like "redmine_alice_123"; we want the users to just
+ see "alice" instead of that.
+
+Assumption:
+
+* Redmine does not allow duplicates in the middle bit; i.e., you can't
+ create redmine_alice_123 and redmine_alice_456 also.
+
+How:
+
+* add this code as lib/Gitolite/Triggers/RedmineUserAlias.pm to your
+ site-local code directory; see this link for how:
+
+ http://gitolite.com/gitolite/non-core.html#ncloc
+
+* add the following to the rc file, just before the ENABLE section (don't
+ forget the trailing comma):
+
+ INPUT => [ 'RedmineUserAlias::input' ],
+
+Notes:
+
+* http mode has not been tested and will not be. If someone has the time to
+ test it and make it work please let me know.
+
+* not tested with mirroring.
+
+Quote:
+
+* "All that for what is effectively one line of code. I need a life".
+
+=cut
+
+sub input {
+ $ARGV[0] or _die "no username???";
+ $ARGV[0] =~ s/^redmine_(\S+)_\d+$/$1/;
+}
+
+1;