Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Paste
P492
ports/latest-quarterly
Archived
Public
Actions
Authored by
mat
on Apr 15 2021, 2:32 PM.
Edit Paste
Activate Paste
View Raw File
Subscribe
Mute Notifications
Flag For Later
Award Token
Tags
None
Referenced Files
F20134694: ports/latest-quarterly
Apr 15 2021, 2:32 PM
2021-04-15 14:32:02 (UTC+0)
Subscribers
None
#!/usr/local/bin/perl
# vim:sts=4 sw=4
use
strict
;
use
warnings
;
use
5.024
;
sub
short_ref
{
my
(
$ref
)
=
@_
;
$ref
=~
s{refs/heads/}{}oms
;
return
$ref
;
}
my
$push_option_count
=
$ENV
{
GIT_PUSH_OPTION_COUNT
};
for
(
my
$i
=
0
;
$i
<
$push_option_count
;
++
$i
)
{
exit
0
if
$ENV
{
"GIT_PUSH_OPTION_${i}"
}
eq
"unsupported-quarterly"
;
}
my
@quarterlies
;
for
(
qx{git show-ref --heads}
)
{
chomp
;
my
(
$hash
,
$ref
)
=
split
/ /
;
next
if
$ref
!~
m{refs/heads/\d\d\d\dQ\d\z}oms
;
push
@quarterlies
,
$ref
;
}
@quarterlies
=
sort
@quarterlies
;
my
$latest
=
$quarterlies
[
-
1
];
foreach
(
<STDIN>
)
{
chomp
;
my
(
$old
,
$new
,
$ref
)
=
split
/ /
;
next
if
$ref
!~
m{^refs/heads/20\d\dQ\d\z}oms
;
next
if
$ref
eq
$latest
;
die
"\n================================================================\n"
.
"$ENV{GL_USER}, you are pushing a commit to ${\(short_ref($ref))} which is not\n"
.
"the latest quarterly branch. The latest is ${\(short_ref($latest))}.\n"
.
"\n"
.
"Please check that you really mean to do this, and if you do, use:\n"
.
"\tgit push --push-option=unsupported-quarterly\n"
.
"================================================================\n"
}
exit
0
;
Event Timeline
mat
created this paste.
Apr 15 2021, 2:32 PM
2021-04-15 14:32:02 (UTC+0)
mat
created this object in space
S1 Global
.
mat
archived this paste.
Apr 16 2021, 3:57 PM
2021-04-16 15:57:22 (UTC+0)
Log In to Comment