FreeBSD Bugzilla – Attachment 238994 Details for
Bug 268469
[NEW PORT] security/mxcheck: Terminal based e-mail server scanner
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
A share file for the same port.
mxcheck.shar (text/plain), 33.46 KB, created by
Steffen
on 2022-12-24 08:27:56 UTC
(
hide
)
Description:
A share file for the same port.
Filename:
MIME Type:
Creator:
Steffen
Created:
2022-12-24 08:27:56 UTC
Size:
33.46 KB
patch
obsolete
>#!/bin/sh ># This is a shell archive >echo x mxcheck >mkdir -p mxcheck > /dev/null 2>&1 >echo x mxcheck/Makefile >sed 's/^X//' > mxcheck/Makefile << 'SHAR_END' >XPORTNAME= mxcheck >XDISTVERSIONPREFIX= v >XDISTVERSION= 1.4.2 >XPORTREVISION= 1 >XCATEGORIES= security >X >XMAINTAINER= steffen@fritz.wtf >XCOMMENT= Terminal based e-mail server configuration and DNS scanner >XWWW= https://github.com/steffenfritz/mxcheck >X >XLICENSE= GPLv3 >XLICENSE_FILE= ${WRKSRC}/LICENSE >X >XUSES= go:modules >X >XGO_MODULE= github.com/steffenfritz/mxcheck >X >XPLIST_FILES= bin/${PORTNAME} \ >X man/man1/mxcheck.1.gz >X >Xpost-install: >X ${INSTALL_MAN} ${WRKSRC}/mxcheck.1 ${STAGEDIR}${LOCALBASE}/man/man1/ >X >X.include <bsd.port.mk> >SHAR_END >echo x mxcheck/pkg-descr >sed 's/^X//' > mxcheck/pkg-descr << 'SHAR_END' >Xmxcheck is an info scanner for e-mail servers. >X >XIt checks DNS records, certificates, if the service is listed by >Xblacklists and if the server is an open relay. >SHAR_END >echo x mxcheck/distinfo >sed 's/^X//' > mxcheck/distinfo << 'SHAR_END' >XTIMESTAMP = 1671449568 >XSHA256 (go/security_mxcheck_freebsd/mxcheck-v1.4.2/v1.4.2.mod) = c2c9d72d31ad022df39e032006ebcd342fe3394c2cc97b03ab974c99cb9099fa >XSIZE (go/security_mxcheck_freebsd/mxcheck-v1.4.2/v1.4.2.mod) = 568 >XSHA256 (go/security_mxcheck_freebsd/mxcheck-v1.4.2/v1.4.2.zip) = 20f480ce1a2edcba239f3f7ea1971059adf5d580289b8f7204924102a8f04e08 >XSIZE (go/security_mxcheck_freebsd/mxcheck-v1.4.2/v1.4.2.zip) = 31999 >SHAR_END >echo x mxcheck/.git >mkdir -p mxcheck/.git > /dev/null 2>&1 >echo x mxcheck/.git/branches >mkdir -p mxcheck/.git/branches > /dev/null 2>&1 >echo x mxcheck/.git/description >sed 's/^X//' > mxcheck/.git/description << 'SHAR_END' >XUnnamed repository; edit this file 'description' to name the repository. >SHAR_END >echo x mxcheck/.git/hooks >mkdir -p mxcheck/.git/hooks > /dev/null 2>&1 >echo x mxcheck/.git/info >mkdir -p mxcheck/.git/info > /dev/null 2>&1 >echo x mxcheck/.git/refs >mkdir -p mxcheck/.git/refs > /dev/null 2>&1 >echo x mxcheck/.git/objects >mkdir -p mxcheck/.git/objects > /dev/null 2>&1 >echo x mxcheck/.git/HEAD >sed 's/^X//' > mxcheck/.git/HEAD << 'SHAR_END' >Xref: refs/heads/main >SHAR_END >echo x mxcheck/.git/config >sed 's/^X//' > mxcheck/.git/config << 'SHAR_END' >X[core] >X repositoryformatversion = 0 >X filemode = true >X bare = false >X logallrefupdates = true >SHAR_END >echo x mxcheck/.git/index >sed 's/^X//' > mxcheck/.git/index << 'SHAR_END' >XDIRCc ,<8c ,;·z¦4¤éëCh£gÈOýòÞuw^MÕÅMakefilec Kà!Rc Kà!Rz¦¾¤é£ª3eì4K=¿ÈÊQ¿ïjdistinfoc ¹hàØc ¹h¸z¦,¤é üã#0~fªYjLH©Vã`,ðÈ pkg-descrTREE3 0 >XåUkÉb»§d ÅTÊ?¼\è¨iñ=Àug ìz¦N >SHAR_END >echo x mxcheck/.git/COMMIT_EDITMSG >sed 's/^X//' > mxcheck/.git/COMMIT_EDITMSG << 'SHAR_END' >Xinit port for version 1.4.2 >XCommit-Ersteller: Steffen Fritz <steffen@fritz.wtf> >X >X# Bitte geben Sie eine Commit-Beschreibung für Ihre Ãnderungen ein. Zeilen, >X# die mit '#' beginnen, werden ignoriert, und eine leere Beschreibung >X# bricht den Commit ab. >X# >X# Auf Branch main >X# >X# Initialer Commit >X# >X# Zum Commit vorgemerkte Ãnderungen: >X# neue Datei: Makefile >X# neue Datei: distinfo >X# neue Datei: pkg-descr >X# >SHAR_END >echo x mxcheck/.git/logs >mkdir -p mxcheck/.git/logs > /dev/null 2>&1 >echo x mxcheck/.git/logs/HEAD >sed 's/^X//' > mxcheck/.git/logs/HEAD << 'SHAR_END' >X0000000000000000000000000000000000000000 787609ab44f6e2a905950e5a8dca61dfdf1b28ea Charlie Root <root@intern.amp-off.com> 1671464548 +0100 commit (initial): init port for version 1.4.2 >X787609ab44f6e2a905950e5a8dca61dfdf1b28ea 45fe9ddc84e44477e8aabd7b05fa2cbe6de79ad2 Steffen Fritz <steffen@fritz.wtf> 1671464702 +0100 commit (amend): init port for version 1.4.2 >SHAR_END >echo x mxcheck/.git/logs/refs >mkdir -p mxcheck/.git/logs/refs > /dev/null 2>&1 >echo x mxcheck/.git/logs/refs/heads >mkdir -p mxcheck/.git/logs/refs/heads > /dev/null 2>&1 >echo x mxcheck/.git/logs/refs/heads/main >sed 's/^X//' > mxcheck/.git/logs/refs/heads/main << 'SHAR_END' >X0000000000000000000000000000000000000000 787609ab44f6e2a905950e5a8dca61dfdf1b28ea Charlie Root <root@intern.amp-off.com> 1671464548 +0100 commit (initial): init port for version 1.4.2 >X787609ab44f6e2a905950e5a8dca61dfdf1b28ea 45fe9ddc84e44477e8aabd7b05fa2cbe6de79ad2 Steffen Fritz <steffen@fritz.wtf> 1671464702 +0100 commit (amend): init port for version 1.4.2 >SHAR_END >echo x mxcheck/.git/objects/pack >mkdir -p mxcheck/.git/objects/pack > /dev/null 2>&1 >echo x mxcheck/.git/objects/info >mkdir -p mxcheck/.git/objects/info > /dev/null 2>&1 >echo x mxcheck/.git/objects/eb >mkdir -p mxcheck/.git/objects/eb > /dev/null 2>&1 >echo x mxcheck/.git/objects/97 >mkdir -p mxcheck/.git/objects/97 > /dev/null 2>&1 >echo x mxcheck/.git/objects/fc >mkdir -p mxcheck/.git/objects/fc > /dev/null 2>&1 >echo x mxcheck/.git/objects/e5 >mkdir -p mxcheck/.git/objects/e5 > /dev/null 2>&1 >echo x mxcheck/.git/objects/78 >mkdir -p mxcheck/.git/objects/78 > /dev/null 2>&1 >echo x mxcheck/.git/objects/45 >mkdir -p mxcheck/.git/objects/45 > /dev/null 2>&1 >echo x mxcheck/.git/objects/45/fe9ddc84e44477e8aabd7b05fa2cbe6de79ad2 >sed 's/^X//' > mxcheck/.git/objects/45/fe9ddc84e44477e8aabd7b05fa2cbe6de79ad2 << 'SHAR_END' >XxK >XÂ0Ego.$æ[DÑ ¸&¼` m$}*¸zk]àðî='aÈRUD@ÍÖ&DodõÁ¡QÎ;í|ÔZÅΦm >Xuwº >XÂpsÍôÝôÅCú`ó¤´a¬PFY.aÍç,.J¿Æ,sîT4ëX§\Fj$;.ÏS3úkû;½R >SHAR_END >echo x mxcheck/.git/objects/78/7609ab44f6e2a905950e5a8dca61dfdf1b28ea >mkdir -p mxcheck/.git/objects/78 > /dev/null 2>&1 >sed 's/^X//' > mxcheck/.git/objects/78/7609ab44f6e2a905950e5a8dca61dfdf1b28ea << 'SHAR_END' >XxQjÃ0DóSì°]ICÓ 9$vÀÂf@O_¥GÈÏÀIuÛ²À`ÝNÐv£µ.¦É 1qñ·~JÖFú¤TøkeX®×p®UàÈMç\¹è°ÝöH§º wco±ÆÃG×wjnÛmÁ·T.íø²µ#ä{®zmô ÿúýß×ùA",ðÍY~áØüÎôBý:©?·U >SHAR_END >echo x mxcheck/.git/objects/e5/07556bc962bba79b8e64898589c554ca7f3fbc >mkdir -p mxcheck/.git/objects/e5 > /dev/null 2>&1 >sed 's/^X//' > mxcheck/.git/objects/e5/07556bc962bba79b8e64898589c554ca7f3fbc << 'SHAR_END' >Xx+)JMU04°d040031QðMÌNMËÌIexí̱8ý¬ÿßOÍ÷JËã|å® ªIÉ,.ÉÌKËg.²Ê8õw¿íþ3»Oîg|US®Z\Äðç±²A]ÚªÈ,a³'è|è?0k/3 >SHAR_END >echo x mxcheck/.git/objects/fc/e323307e66aa596a4c48a9569ae3602cf08fc8 >mkdir -p mxcheck/.git/objects/fc > /dev/null 2>&1 >sed 's/^X//' > mxcheck/.git/objects/fc/e323307e66aa596a4c48a9569ae3602cf08fc8 << 'SHAR_END' >XxM1Â0©ý}DÐð^`ÏÊ)î,D~Êvw6äp¹ëf¦bðRR / ©*ø´zÉ0Ö7«MÎÝöáöxBªF;X$!߸$´÷í,Ö8"l.dOËÀ!ÿÑ®ü½¨/.}:ûmr_M?:µ >SHAR_END >echo x mxcheck/.git/objects/97/14aa3365ec344b8f3dbfc8998bca51bf01ef6a >mkdir -p mxcheck/.git/objects/97 > /dev/null 2>&1 >sed 's/^X//' > mxcheck/.git/objects/97/14aa3365ec344b8f3dbfc8998bca51bf01ef6a << 'SHAR_END' >Xx¥±N1D©ï+®»Ýõúì-(RD"E$¤KEÙëu :¾CäH5i4£7ùeÊ-£\mVëå¸Y¬Ú»ÌâØ÷òC{½úéûqÿöµ=|êéó¶Íò©ôgûwÔÿIwÊÍÜ¥¤R©Q©Nµ8¦jÎ Ï1Á¥,UD³HM͸z\^°Ä÷þõ r5LdEs"'ÕÕ` % xI¥úâ#Pk `!F +°Á|ã?!ÎûE¤ùtÚa >SHAR_END >echo x mxcheck/.git/objects/eb/430168a367c81d4ffdf283de75775e4d1ed5c5 >mkdir -p mxcheck/.git/objects/eb > /dev/null 2>&1 >sed 's/^X//' > mxcheck/.git/objects/eb/430168a367c81d4ffdf283de75775e4d1ed5c5 << 'SHAR_END' >Xx PÉnÛ0íó<ø >Xêv0¢¢ÌDµ¤÷ÀÐBÙD$Ê)7¡/Úho=ÌoÞ2eÛøÿõÃ&ãy&4@ÝKuÕ3¬È),K7Þ³:ýÈ'ÉG79}d3Ña 9]gQ #«qPö Y»¡Ü¡V6Ôß÷õF~Ù¢,Ih(C§tÑâ²0²Æò¦+TNrÀU¯µÂª^ãB×x >XlªBk9Àv» :X{4KÏÛ+{KRõw±{wó®í fM ë»ÞħO×çîÅ[·üàÑä]hb.öý²ëë±`ílõ0/ü×n»s¾«;Rioq¾|ÂOPWhÏMH|²8öÆÞ(mlѶKpÁX*ò0wINøoÎK/â;ÌÖtÅø´8ÇYÆw¡ Ó,þÇ(]µc-ñmijrìKºçoðâ¤Ô >SHAR_END >echo x mxcheck/.git/refs/heads >mkdir -p mxcheck/.git/refs/heads > /dev/null 2>&1 >echo x mxcheck/.git/refs/tags >mkdir -p mxcheck/.git/refs/tags > /dev/null 2>&1 >echo x mxcheck/.git/refs/heads/main >mkdir -p mxcheck/.git/refs/heads > /dev/null 2>&1 >sed 's/^X//' > mxcheck/.git/refs/heads/main << 'SHAR_END' >X45fe9ddc84e44477e8aabd7b05fa2cbe6de79ad2 >SHAR_END >echo x mxcheck/.git/info/exclude >mkdir -p mxcheck/.git/info > /dev/null 2>&1 >sed 's/^X//' > mxcheck/.git/info/exclude << 'SHAR_END' >X# git ls-files --others --exclude-from=.git/info/exclude >X# Lines that start with '#' are comments. >X# For a project mostly in C, the following would be a good set of >X# exclude patterns (uncomment them if you want to use them): >X# *.[oa] >X# *~ >SHAR_END >echo x mxcheck/.git/hooks/commit-msg.sample >mkdir -p mxcheck/.git/hooks > /dev/null 2>&1 >sed 's/^X//' > mxcheck/.git/hooks/commit-msg.sample << 'SHAR_END' >X#!/bin/sh >X# >X# An example hook script to check the commit log message. >X# Called by "git commit" with one argument, the name of the file >X# that has the commit message. The hook should exit with non-zero >X# status after issuing an appropriate message if it wants to stop the >X# commit. The hook is allowed to edit the commit message file. >X# >X# To enable this hook, rename this file to "commit-msg". >X >X# Uncomment the below to add a Signed-off-by line to the message. >X# Doing this in a hook is a bad idea in general, but the prepare-commit-msg >X# hook is more suited to it. >X# >X# SOB=$(git var GIT_AUTHOR_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') >X# grep -qs "^$SOB" "$1" || echo "$SOB" >> "$1" >X >X# This example catches duplicate Signed-off-by lines. >X >Xtest "" = "$(grep '^Signed-off-by: ' "$1" | >X sort | uniq -c | sed -e '/^[ ]*1[ ]/d')" || { >X echo >&2 Duplicate Signed-off-by lines. >X exit 1 >X} >SHAR_END >echo x mxcheck/.git/hooks/fsmonitor-watchman.sample >sed 's/^X//' > mxcheck/.git/hooks/fsmonitor-watchman.sample << 'SHAR_END' >X#!/usr/local/bin/perl >X >Xuse strict; >Xuse warnings; >Xuse IPC::Open2; >X >X# An example hook script to integrate Watchman >X# (https://facebook.github.io/watchman/) with git to speed up detecting >X# new and modified files. >X# >X# The hook is passed a version (currently 2) and last update token >X# formatted as a string and outputs to stdout a new update token and >X# all files that have been modified since the update token. Paths must >X# be relative to the root of the working tree and separated by a single NUL. >X# >X# To enable this hook, rename this file to "query-watchman" and set >X# 'git config core.fsmonitor .git/hooks/query-watchman' >X# >Xmy ($version, $last_update_token) = @ARGV; >X >X# Uncomment for debugging >X# print STDERR "$0 $version $last_update_token\n"; >X >X# Check the hook interface version >Xif ($version ne 2) { >X die "Unsupported query-fsmonitor hook version '$version'.\n" . >X "Falling back to scanning...\n"; >X} >X >Xmy $git_work_tree = get_working_dir(); >X >Xmy $retry = 1; >X >Xmy $json_pkg; >Xeval { >X require JSON::XS; >X $json_pkg = "JSON::XS"; >X 1; >X} or do { >X require JSON::PP; >X $json_pkg = "JSON::PP"; >X}; >X >Xlaunch_watchman(); >X >Xsub launch_watchman { >X my $o = watchman_query(); >X if (is_work_tree_watched($o)) { >X output_result($o->{clock}, @{$o->{files}}); >X } >X} >X >Xsub output_result { >X my ($clockid, @files) = @_; >X >X # Uncomment for debugging watchman output >X # open (my $fh, ">", ".git/watchman-output.out"); >X # binmode $fh, ":utf8"; >X # print $fh "$clockid\n@files\n"; >X # close $fh; >X >X binmode STDOUT, ":utf8"; >X print $clockid; >X print "\0"; >X local $, = "\0"; >X print @files; >X} >X >Xsub watchman_clock { >X my $response = qx/watchman clock "$git_work_tree"/; >X die "Failed to get clock id on '$git_work_tree'.\n" . >X "Falling back to scanning...\n" if $? != 0; >X >X return $json_pkg->new->utf8->decode($response); >X} >X >Xsub watchman_query { >X my $pid = open2(\*CHLD_OUT, \*CHLD_IN, 'watchman -j --no-pretty') >X or die "open2() failed: $!\n" . >X "Falling back to scanning...\n"; >X >X # In the query expression below we're asking for names of files that >X # changed since $last_update_token but not from the .git folder. >X # >X # To accomplish this, we're using the "since" generator to use the >X # recency index to select candidate nodes and "fields" to limit the >X # output to file names only. Then we're using the "expression" term to >X # further constrain the results. >X my $last_update_line = ""; >X if (substr($last_update_token, 0, 1) eq "c") { >X $last_update_token = "\"$last_update_token\""; >X $last_update_line = qq[\n"since": $last_update_token,]; >X } >X my $query = <<" END"; >X ["query", "$git_work_tree", {$last_update_line >X "fields": ["name"], >X "expression": ["not", ["dirname", ".git"]] >X }] >X END >X >X # Uncomment for debugging the watchman query >X # open (my $fh, ">", ".git/watchman-query.json"); >X # print $fh $query; >X # close $fh; >X >X print CHLD_IN $query; >X close CHLD_IN; >X my $response = do {local $/; <CHLD_OUT>}; >X >X # Uncomment for debugging the watch response >X # open ($fh, ">", ".git/watchman-response.json"); >X # print $fh $response; >X # close $fh; >X >X die "Watchman: command returned no output.\n" . >X "Falling back to scanning...\n" if $response eq ""; >X die "Watchman: command returned invalid output: $response\n" . >X "Falling back to scanning...\n" unless $response =~ /^\{/; >X >X return $json_pkg->new->utf8->decode($response); >X} >X >Xsub is_work_tree_watched { >X my ($output) = @_; >X my $error = $output->{error}; >X if ($retry > 0 and $error and $error =~ m/unable to resolve root .* directory (.*) is not watched/) { >X $retry--; >X my $response = qx/watchman watch "$git_work_tree"/; >X die "Failed to make watchman watch '$git_work_tree'.\n" . >X "Falling back to scanning...\n" if $? != 0; >X $output = $json_pkg->new->utf8->decode($response); >X $error = $output->{error}; >X die "Watchman: $error.\n" . >X "Falling back to scanning...\n" if $error; >X >X # Uncomment for debugging watchman output >X # open (my $fh, ">", ".git/watchman-output.out"); >X # close $fh; >X >X # Watchman will always return all files on the first query so >X # return the fast "everything is dirty" flag to git and do the >X # Watchman query just to get it over with now so we won't pay >X # the cost in git to look up each individual file. >X my $o = watchman_clock(); >X $error = $output->{error}; >X >X die "Watchman: $error.\n" . >X "Falling back to scanning...\n" if $error; >X >X output_result($o->{clock}, ("/")); >X $last_update_token = $o->{clock}; >X >X eval { launch_watchman() }; >X return 0; >X } >X >X die "Watchman: $error.\n" . >X "Falling back to scanning...\n" if $error; >X >X return 1; >X} >X >Xsub get_working_dir { >X my $working_dir; >X if ($^O =~ 'msys' || $^O =~ 'cygwin') { >X $working_dir = Win32::GetCwd(); >X $working_dir =~ tr/\\/\//; >X } else { >X require Cwd; >X $working_dir = Cwd::cwd(); >X } >X >X return $working_dir; >X} >SHAR_END >echo x mxcheck/.git/hooks/post-update.sample >sed 's/^X//' > mxcheck/.git/hooks/post-update.sample << 'SHAR_END' >X#!/bin/sh >X# >X# An example hook script to prepare a packed repository for use over >X# dumb transports. >X# >X# To enable this hook, rename this file to "post-update". >X >Xexec git update-server-info >SHAR_END >echo x mxcheck/.git/hooks/pre-applypatch.sample >sed 's/^X//' > mxcheck/.git/hooks/pre-applypatch.sample << 'SHAR_END' >X#!/bin/sh >X# >X# An example hook script to verify what is about to be committed >X# by applypatch from an e-mail message. >X# >X# The hook should exit with non-zero status after issuing an >X# appropriate message if it wants to stop the commit. >X# >X# To enable this hook, rename this file to "pre-applypatch". >X >X. git-sh-setup >Xprecommit="$(git rev-parse --git-path hooks/pre-commit)" >Xtest -x "$precommit" && exec "$precommit" ${1+"$@"} >X: >SHAR_END >echo x mxcheck/.git/hooks/pre-commit.sample >sed 's/^X//' > mxcheck/.git/hooks/pre-commit.sample << 'SHAR_END' >X#!/bin/sh >X# >X# An example hook script to verify what is about to be committed. >X# Called by "git commit" with no arguments. The hook should >X# exit with non-zero status after issuing an appropriate message if >X# it wants to stop the commit. >X# >X# To enable this hook, rename this file to "pre-commit". >X >Xif git rev-parse --verify HEAD >/dev/null 2>&1 >Xthen >X against=HEAD >Xelse >X # Initial commit: diff against an empty tree object >X against=$(git hash-object -t tree /dev/null) >Xfi >X >X# If you want to allow non-ASCII filenames set this variable to true. >Xallownonascii=$(git config --type=bool hooks.allownonascii) >X >X# Redirect output to stderr. >Xexec 1>&2 >X >X# Cross platform projects tend to avoid non-ASCII filenames; prevent >X# them from being added to the repository. We exploit the fact that the >X# printable range starts at the space character and ends with tilde. >Xif [ "$allownonascii" != "true" ] && >X # Note that the use of brackets around a tr range is ok here, (it's >X # even required, for portability to Solaris 10's /usr/bin/tr), since >X # the square bracket bytes happen to fall in the designated range. >X test $(git diff --cached --name-only --diff-filter=A -z $against | >X LC_ALL=C tr -d '[ -~]\0' | wc -c) != 0 >Xthen >X cat <<\EOF >XError: Attempt to add a non-ASCII file name. >X >XThis can cause problems if you want to work with people on other platforms. >X >XTo be portable it is advisable to rename the file. >X >XIf you know what you are doing you can disable this check using: >X >X git config hooks.allownonascii true >XEOF >X exit 1 >Xfi >X >X# If there are whitespace errors, print the offending file names and fail. >Xexec git diff-index --check --cached $against -- >SHAR_END >echo x mxcheck/.git/hooks/pre-push.sample >sed 's/^X//' > mxcheck/.git/hooks/pre-push.sample << 'SHAR_END' >X#!/bin/sh >X >X# An example hook script to verify what is about to be pushed. Called by "git >X# push" after it has checked the remote status, but before anything has been >X# pushed. If this script exits with a non-zero status nothing will be pushed. >X# >X# This hook is called with the following parameters: >X# >X# $1 -- Name of the remote to which the push is being done >X# $2 -- URL to which the push is being done >X# >X# If pushing without using a named remote those arguments will be equal. >X# >X# Information about the commits which are being pushed is supplied as lines to >X# the standard input in the form: >X# >X# <local ref> <local oid> <remote ref> <remote oid> >X# >X# This sample shows how to prevent push of commits where the log message starts >X# with "WIP" (work in progress). >X >Xremote="$1" >Xurl="$2" >X >Xzero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0') >X >Xwhile read local_ref local_oid remote_ref remote_oid >Xdo >X if test "$local_oid" = "$zero" >X then >X # Handle delete >X : >X else >X if test "$remote_oid" = "$zero" >X then >X # New branch, examine all commits >X range="$local_oid" >X else >X # Update to existing branch, examine new commits >X range="$remote_oid..$local_oid" >X fi >X >X # Check for WIP commit >X commit=$(git rev-list -n 1 --grep '^WIP' "$range") >X if test -n "$commit" >X then >X echo >&2 "Found WIP commit in $local_ref, not pushing" >X exit 1 >X fi >X fi >Xdone >X >Xexit 0 >SHAR_END >echo x mxcheck/.git/hooks/pre-rebase.sample >sed 's/^X//' > mxcheck/.git/hooks/pre-rebase.sample << 'SHAR_END' >X#!/bin/sh >X# >X# Copyright (c) 2006, 2008 Junio C Hamano >X# >X# The "pre-rebase" hook is run just before "git rebase" starts doing >X# its job, and can prevent the command from running by exiting with >X# non-zero status. >X# >X# The hook is called with the following parameters: >X# >X# $1 -- the upstream the series was forked from. >X# $2 -- the branch being rebased (or empty when rebasing the current branch). >X# >X# This sample shows how to prevent topic branches that are already >X# merged to 'next' branch from getting rebased, because allowing it >X# would result in rebasing already published history. >X >Xpublish=next >Xbasebranch="$1" >Xif test "$#" = 2 >Xthen >X topic="refs/heads/$2" >Xelse >X topic=`git symbolic-ref HEAD` || >X exit 0 ;# we do not interrupt rebasing detached HEAD >Xfi >X >Xcase "$topic" in >Xrefs/heads/??/*) >X ;; >X*) >X exit 0 ;# we do not interrupt others. >X ;; >Xesac >X >X# Now we are dealing with a topic branch being rebased >X# on top of master. Is it OK to rebase it? >X >X# Does the topic really exist? >Xgit show-ref -q "$topic" || { >X echo >&2 "No such branch $topic" >X exit 1 >X} >X >X# Is topic fully merged to master? >Xnot_in_master=`git rev-list --pretty=oneline ^master "$topic"` >Xif test -z "$not_in_master" >Xthen >X echo >&2 "$topic is fully merged to master; better remove it." >X exit 1 ;# we could allow it, but there is no point. >Xfi >X >X# Is topic ever merged to next? If so you should not be rebasing it. >Xonly_next_1=`git rev-list ^master "^$topic" ${publish} | sort` >Xonly_next_2=`git rev-list ^master ${publish} | sort` >Xif test "$only_next_1" = "$only_next_2" >Xthen >X not_in_topic=`git rev-list "^$topic" master` >X if test -z "$not_in_topic" >X then >X echo >&2 "$topic is already up to date with master" >X exit 1 ;# we could allow it, but there is no point. >X else >X exit 0 >X fi >Xelse >X not_in_next=`git rev-list --pretty=oneline ^${publish} "$topic"` >X /usr/local/bin/perl -e ' >X my $topic = $ARGV[0]; >X my $msg = "* $topic has commits already merged to public branch:\n"; >X my (%not_in_next) = map { >X /^([0-9a-f]+) /; >X ($1 => 1); >X } split(/\n/, $ARGV[1]); >X for my $elem (map { >X /^([0-9a-f]+) (.*)$/; >X [$1 => $2]; >X } split(/\n/, $ARGV[2])) { >X if (!exists $not_in_next{$elem->[0]}) { >X if ($msg) { >X print STDERR $msg; >X undef $msg; >X } >X print STDERR " $elem->[1]\n"; >X } >X } >X ' "$topic" "$not_in_next" "$not_in_master" >X exit 1 >Xfi >X >X<<\DOC_END >X >XThis sample hook safeguards topic branches that have been >Xpublished from being rewound. >X >XThe workflow assumed here is: >X >X * Once a topic branch forks from "master", "master" is never >X merged into it again (either directly or indirectly). >X >X * Once a topic branch is fully cooked and merged into "master", >X it is deleted. If you need to build on top of it to correct >X earlier mistakes, a new topic branch is created by forking at >X the tip of the "master". This is not strictly necessary, but >X it makes it easier to keep your history simple. >X >X * Whenever you need to test or publish your changes to topic >X branches, merge them into "next" branch. >X >XThe script, being an example, hardcodes the publish branch name >Xto be "next", but it is trivial to make it configurable via >X$GIT_DIR/config mechanism. >X >XWith this workflow, you would want to know: >X >X(1) ... if a topic branch has ever been merged to "next". Young >X topic branches can have stupid mistakes you would rather >X clean up before publishing, and things that have not been >X merged into other branches can be easily rebased without >X affecting other people. But once it is published, you would >X not want to rewind it. >X >X(2) ... if a topic branch has been fully merged to "master". >X Then you can delete it. More importantly, you should not >X build on top of it -- other people may already want to >X change things related to the topic as patches against your >X "master", so if you need further changes, it is better to >X fork the topic (perhaps with the same name) afresh from the >X tip of "master". >X >XLet's look at this example: >X >X o---o---o---o---o---o---o---o---o---o "next" >X / / / / >X / a---a---b A / / >X / / / / >X / / c---c---c---c B / >X / / / \ / >X / / / b---b C \ / >X / / / / \ / >X ---o---o---o---o---o---o---o---o---o---o---o "master" >X >X >XA, B and C are topic branches. >X >X * A has one fix since it was merged up to "next". >X >X * B has finished. It has been fully merged up to "master" and "next", >X and is ready to be deleted. >X >X * C has not merged to "next" at all. >X >XWe would want to allow C to be rebased, refuse A, and encourage >XB to be deleted. >X >XTo compute (1): >X >X git rev-list ^master ^topic next >X git rev-list ^master next >X >X if these match, topic has not merged in next at all. >X >XTo compute (2): >X >X git rev-list master..topic >X >X if this is empty, it is fully merged to "master". >X >XDOC_END >SHAR_END >echo x mxcheck/.git/hooks/pre-receive.sample >sed 's/^X//' > mxcheck/.git/hooks/pre-receive.sample << 'SHAR_END' >X#!/bin/sh >X# >X# An example hook script to make use of push options. >X# The example simply echoes all push options that start with 'echoback=' >X# and rejects all pushes when the "reject" push option is used. >X# >X# To enable this hook, rename this file to "pre-receive". >X >Xif test -n "$GIT_PUSH_OPTION_COUNT" >Xthen >X i=0 >X while test "$i" -lt "$GIT_PUSH_OPTION_COUNT" >X do >X eval "value=\$GIT_PUSH_OPTION_$i" >X case "$value" in >X echoback=*) >X echo "echo from the pre-receive-hook: ${value#*=}" >&2 >X ;; >X reject) >X exit 1 >X esac >X i=$((i + 1)) >X done >Xfi >SHAR_END >echo x mxcheck/.git/hooks/prepare-commit-msg.sample >sed 's/^X//' > mxcheck/.git/hooks/prepare-commit-msg.sample << 'SHAR_END' >X#!/bin/sh >X# >X# An example hook script to prepare the commit log message. >X# Called by "git commit" with the name of the file that has the >X# commit message, followed by the description of the commit >X# message's source. The hook's purpose is to edit the commit >X# message file. If the hook fails with a non-zero status, >X# the commit is aborted. >X# >X# To enable this hook, rename this file to "prepare-commit-msg". >X >X# This hook includes three examples. The first one removes the >X# "# Please enter the commit message..." help message. >X# >X# The second includes the output of "git diff --name-status -r" >X# into the message, just before the "git status" output. It is >X# commented because it doesn't cope with --amend or with squashed >X# commits. >X# >X# The third example adds a Signed-off-by line to the message, that can >X# still be edited. This is rarely a good idea. >X >XCOMMIT_MSG_FILE=$1 >XCOMMIT_SOURCE=$2 >XSHA1=$3 >X >X/usr/local/bin/perl -i.bak -ne 'print unless(m/^. Please enter the commit message/..m/^#$/)' "$COMMIT_MSG_FILE" >X >X# case "$COMMIT_SOURCE,$SHA1" in >X# ,|template,) >X# /usr/local/bin/perl -i.bak -pe ' >X# print "\n" . `git diff --cached --name-status -r` >X# if /^#/ && $first++ == 0' "$COMMIT_MSG_FILE" ;; >X# *) ;; >X# esac >X >X# SOB=$(git var GIT_COMMITTER_IDENT | sed -n 's/^\(.*>\).*$/Signed-off-by: \1/p') >X# git interpret-trailers --in-place --trailer "$SOB" "$COMMIT_MSG_FILE" >X# if test -z "$COMMIT_SOURCE" >X# then >X# /usr/local/bin/perl -i.bak -pe 'print "\n" if !$first_line++' "$COMMIT_MSG_FILE" >X# fi >SHAR_END >echo x mxcheck/.git/hooks/update.sample >sed 's/^X//' > mxcheck/.git/hooks/update.sample << 'SHAR_END' >X#!/bin/sh >X# >X# An example hook script to block unannotated tags from entering. >X# Called by "git receive-pack" with arguments: refname sha1-old sha1-new >X# >X# To enable this hook, rename this file to "update". >X# >X# Config >X# ------ >X# hooks.allowunannotated >X# This boolean sets whether unannotated tags will be allowed into the >X# repository. By default they won't be. >X# hooks.allowdeletetag >X# This boolean sets whether deleting tags will be allowed in the >X# repository. By default they won't be. >X# hooks.allowmodifytag >X# This boolean sets whether a tag may be modified after creation. By default >X# it won't be. >X# hooks.allowdeletebranch >X# This boolean sets whether deleting branches will be allowed in the >X# repository. By default they won't be. >X# hooks.denycreatebranch >X# This boolean sets whether remotely creating branches will be denied >X# in the repository. By default this is allowed. >X# >X >X# --- Command line >Xrefname="$1" >Xoldrev="$2" >Xnewrev="$3" >X >X# --- Safety check >Xif [ -z "$GIT_DIR" ]; then >X echo "Don't run this script from the command line." >&2 >X echo " (if you want, you could supply GIT_DIR then run" >&2 >X echo " $0 <ref> <oldrev> <newrev>)" >&2 >X exit 1 >Xfi >X >Xif [ -z "$refname" -o -z "$oldrev" -o -z "$newrev" ]; then >X echo "usage: $0 <ref> <oldrev> <newrev>" >&2 >X exit 1 >Xfi >X >X# --- Config >Xallowunannotated=$(git config --type=bool hooks.allowunannotated) >Xallowdeletebranch=$(git config --type=bool hooks.allowdeletebranch) >Xdenycreatebranch=$(git config --type=bool hooks.denycreatebranch) >Xallowdeletetag=$(git config --type=bool hooks.allowdeletetag) >Xallowmodifytag=$(git config --type=bool hooks.allowmodifytag) >X >X# check for no description >Xprojectdesc=$(sed -e '1q' "$GIT_DIR/description") >Xcase "$projectdesc" in >X"Unnamed repository"* | "") >X echo "*** Project description file hasn't been set" >&2 >X exit 1 >X ;; >Xesac >X >X# --- Check types >X# if $newrev is 0000...0000, it's a commit to delete a ref. >Xzero=$(git hash-object --stdin </dev/null | tr '[0-9a-f]' '0') >Xif [ "$newrev" = "$zero" ]; then >X newrev_type=delete >Xelse >X newrev_type=$(git cat-file -t $newrev) >Xfi >X >Xcase "$refname","$newrev_type" in >X refs/tags/*,commit) >X # un-annotated tag >X short_refname=${refname##refs/tags/} >X if [ "$allowunannotated" != "true" ]; then >X echo "*** The un-annotated tag, $short_refname, is not allowed in this repository" >&2 >X echo "*** Use 'git tag [ -a | -s ]' for tags you want to propagate." >&2 >X exit 1 >X fi >X ;; >X refs/tags/*,delete) >X # delete tag >X if [ "$allowdeletetag" != "true" ]; then >X echo "*** Deleting a tag is not allowed in this repository" >&2 >X exit 1 >X fi >X ;; >X refs/tags/*,tag) >X # annotated tag >X if [ "$allowmodifytag" != "true" ] && git rev-parse $refname > /dev/null 2>&1 >X then >X echo "*** Tag '$refname' already exists." >&2 >X echo "*** Modifying a tag is not allowed in this repository." >&2 >X exit 1 >X fi >X ;; >X refs/heads/*,commit) >X # branch >X if [ "$oldrev" = "$zero" -a "$denycreatebranch" = "true" ]; then >X echo "*** Creating a branch is not allowed in this repository" >&2 >X exit 1 >X fi >X ;; >X refs/heads/*,delete) >X # delete branch >X if [ "$allowdeletebranch" != "true" ]; then >X echo "*** Deleting a branch is not allowed in this repository" >&2 >X exit 1 >X fi >X ;; >X refs/remotes/*,commit) >X # tracking branch >X ;; >X refs/remotes/*,delete) >X # delete tracking branch >X if [ "$allowdeletebranch" != "true" ]; then >X echo "*** Deleting a tracking branch is not allowed in this repository" >&2 >X exit 1 >X fi >X ;; >X *) >X # Anything else (is there anything else?) >X echo "*** Update hook: unknown type of update to ref $refname of type $newrev_type" >&2 >X exit 1 >X ;; >Xesac >X >X# --- Finished >Xexit 0 >SHAR_END >echo x mxcheck/.git/hooks/pre-merge-commit.sample >sed 's/^X//' > mxcheck/.git/hooks/pre-merge-commit.sample << 'SHAR_END' >X#!/bin/sh >X# >X# An example hook script to verify what is about to be committed. >X# Called by "git merge" with no arguments. The hook should >X# exit with non-zero status after issuing an appropriate message to >X# stderr if it wants to stop the merge commit. >X# >X# To enable this hook, rename this file to "pre-merge-commit". >X >X. git-sh-setup >Xtest -x "$GIT_DIR/hooks/pre-commit" && >X exec "$GIT_DIR/hooks/pre-commit" >X: >SHAR_END >echo x mxcheck/.git/hooks/push-to-checkout.sample >sed 's/^X//' > mxcheck/.git/hooks/push-to-checkout.sample << 'SHAR_END' >X#!/bin/sh >X >X# An example hook script to update a checked-out tree on a git push. >X# >X# This hook is invoked by git-receive-pack(1) when it reacts to git >X# push and updates reference(s) in its repository, and when the push >X# tries to update the branch that is currently checked out and the >X# receive.denyCurrentBranch configuration variable is set to >X# updateInstead. >X# >X# By default, such a push is refused if the working tree and the index >X# of the remote repository has any difference from the currently >X# checked out commit; when both the working tree and the index match >X# the current commit, they are updated to match the newly pushed tip >X# of the branch. This hook is to be used to override the default >X# behaviour; however the code below reimplements the default behaviour >X# as a starting point for convenient modification. >X# >X# The hook receives the commit with which the tip of the current >X# branch is going to be updated: >Xcommit=$1 >X >X# It can exit with a non-zero status to refuse the push (when it does >X# so, it must not modify the index or the working tree). >Xdie () { >X echo >&2 "$*" >X exit 1 >X} >X >X# Or it can make any necessary changes to the working tree and to the >X# index to bring them to the desired state when the tip of the current >X# branch is updated to the new commit, and exit with a zero status. >X# >X# For example, the hook can simply run git read-tree -u -m HEAD "$1" >X# in order to emulate git fetch that is run in the reverse direction >X# with git push, as the two-tree form of git read-tree -u -m is >X# essentially the same as git switch or git checkout that switches >X# branches while keeping the local changes in the working tree that do >X# not interfere with the difference between the branches. >X >X# The below is a more-or-less exact translation to shell of the C code >X# for the default behaviour for git's push-to-checkout hook defined in >X# the push_to_deploy() function in builtin/receive-pack.c. >X# >X# Note that the hook will be executed from the repository directory, >X# not from the working tree, so if you want to perform operations on >X# the working tree, you will have to adapt your code accordingly, e.g. >X# by adding "cd .." or using relative paths. >X >Xif ! git update-index -q --ignore-submodules --refresh >Xthen >X die "Up-to-date check failed" >Xfi >X >Xif ! git diff-files --quiet --ignore-submodules -- >Xthen >X die "Working directory has unstaged changes" >Xfi >X >X# This is a rough translation of: >X# >X# head_has_history() ? "HEAD" : EMPTY_TREE_SHA1_HEX >Xif git cat-file -e HEAD 2>/dev/null >Xthen >X head=HEAD >Xelse >X head=$(git hash-object -t tree --stdin </dev/null) >Xfi >X >Xif ! git diff-index --quiet --cached --ignore-submodules $head -- >Xthen >X die "Working directory has staged changes" >Xfi >X >Xif ! git read-tree -u -m "$commit" >Xthen >X die "Could not update working tree to new HEAD" >Xfi >SHAR_END >echo x mxcheck/.git/hooks/applypatch-msg.sample >sed 's/^X//' > mxcheck/.git/hooks/applypatch-msg.sample << 'SHAR_END' >X#!/bin/sh >X# >X# An example hook script to check the commit log message taken by >X# applypatch from an e-mail message. >X# >X# The hook should exit with non-zero status after issuing an >X# appropriate message if it wants to stop the commit. The hook is >X# allowed to edit the commit message file. >X# >X# To enable this hook, rename this file to "applypatch-msg". >X >X. git-sh-setup >Xcommitmsg="$(git rev-parse --git-path hooks/commit-msg)" >Xtest -x "$commitmsg" && exec "$commitmsg" ${1+"$@"} >X: >SHAR_END >exit
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Raw
Actions:
View
Attachments on
bug 268469
:
238924
| 238994