[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: scratch branches in Gnu Elpa
From: |
Michael Heerdegen |
Subject: |
Re: scratch branches in Gnu Elpa |
Date: |
Sat, 20 Oct 2018 00:14:57 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux) |
Stefan Monnier <address@hidden> writes:
> > when I add a branch under scratch/ in Gnu Elpa, I can do there what I
> > want, right? I mean, including history rewriting stuff, in particular.
>
> Yes.
Thanks, but the server denies non-fast-forward pushes of my scratch
branch even when forced (log from Magit):
| 1 git … push -v --force --no-verify origin
scratch/mheerdegen-preview\:refs/heads/scratch/mheerdegen-preview
| Pushing to address@hidden:/srv/git/emacs/elpa.git
| Writing objects: 100% (165/165), 105.27 KiB | 4.58 MiB/s, done.
| Total 165 (delta 119), reused 9 (delta 5)
| remote: error: denying non-fast-forward refs/heads/scratch/mheerdegen-preview
(you should pull first)
| To git.sv.gnu.org:/srv/git/emacs/elpa.git
| ! [remote rejected] scratch/mheerdegen-preview ->
scratch/mheerdegen-preview (non-fast-forward)
| error: failed to push some refs to 'address@hidden:/srv/git/emacs/elpa.git'
Why is that?
While we are here: I use a pre-push hook script like the following to
make pushing fail when a commit message starts with "WIP" (to protect me
from myself). Sorry for my ignorance - how can I change this script so
that /scratch branches are not treated (I'm not good in writing
bash)?
#+begin_src emacs-lisp
remote="$1"
url="$2"
z40=0000000000000000000000000000000000000000
IFS=' '
while read local_ref local_sha remote_ref remote_sha
do
if [ "$local_sha" = $z40 ]
then
# Handle delete
:
else
if [ "$remote_sha" = $z40 ]
then
# New branch, examine all commits
range="$local_sha"
else
# Update to existing branch, examine new commits
range="$remote_sha..$local_sha"
fi
# Check for WIP commit
#commit=`git rev-list -n 1 --grep '^WIP' "$range"`
commit=`git rev-list -n 1 --grep '^WIP' "$range"`
if [ -n "$commit" ]
then
echo "Found WIP commit in $local_ref, not pushing"
exit 1
fi
fi
done
exit 0
#+end_src
TIA,
Michael.