From: Joshua Jensen <jjensen@workspacewhiz.com>
To: "git@vger.kernel.org" <git@vger.kernel.org>
Subject: Deleting of the specified ref during the post-receive hook
Date: Tue, 21 Sep 2010 08:40:50 -0600 [thread overview]
Message-ID: <4C98C3F2.9050006@workspacewhiz.com> (raw)
I've recently asked whether there was a public script to act as an
automatic 'maintainer', something akin to Gerrit's push always
succeeding without having to pull first when using Git as a central
repository. I received a number of suggestions, and I have begun trial
implementations.
My current line of thought has an auto-merging script that monitors the
refs/for/ namespace (similar to Gerrit) and then applies --no-ff merges
to the appropriate branch. For instance, when the user pushes to
refs/for/master, the post-receive hook creates a secondary ref called
refs/for/master-SHA1-timestamp and then deletes the refs/for/master ref:
#!bin/sh
# post-receive hook
while read oldrev newrev ref
do
case $ref in
refs/for/*)
timestamp=`date +%s`
`git update-ref $ref-$newrev-$timestamp $newrev`
`git update-ref -d $ref`
;;
esac
done
If you'll pardon my lacking shell script skills (I'm open to learn!), my
primary question concerns safety. When receiving a ref via an SSH-based
server (which happens to be Gitolite, but I don't think that is relevant
here), is the post-receive hook guaranteed to be run in a lockstep
manner? That is, if two people push to 'refs/for/master' at the same
time, is there a lock to process one user and then the other user?
The auto-merging script is just simple at the moment. It runs 'git
fetch origin refs/for/*:refs/for/*', sorts the refs/for/ entries by
timestamp, and merges into the specified branch, emailing the user on
success or failure (not implemented yet... I'm sure Gitolite gives me
access to the username, but I haven't looked it up yet).
Before I go too much deeper down this path, am I way off base here?
Thanks.
Josh
next reply other threads:[~2010-09-21 14:41 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-21 14:40 Joshua Jensen [this message]
2010-09-21 14:50 ` Deleting of the specified ref during the post-receive hook Shawn O. Pearce
2010-09-21 15:55 ` Joshua Jensen
2010-09-21 16:00 ` Shawn O. Pearce
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4C98C3F2.9050006@workspacewhiz.com \
--to=jjensen@workspacewhiz.com \
--cc=git@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.