unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: scratch branches in Gnu Elpa
Date: Sat, 20 Oct 2018 00:14:57 +0200	[thread overview]
Message-ID: <87k1md4m8u.fsf@web.de> (raw)
In-Reply-To: <jwvd0s6wxqh.fsf-monnier+gmane.emacs.devel@gnu.org> (Stefan Monnier's message of "Thu, 18 Oct 2018 21:07:16 -0400")

Stefan Monnier <monnier@iro.umontreal.ca> 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 mheerdegen@git.sv.gnu.org:/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 'mheerdegen@git.sv.gnu.org:/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.



  reply	other threads:[~2018-10-19 22:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-18 17:47 scratch branches in Gnu Elpa Michael Heerdegen
2018-10-19  1:07 ` Stefan Monnier
2018-10-19 22:14   ` Michael Heerdegen [this message]
2018-10-20  1:55     ` Stefan Monnier

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

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87k1md4m8u.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=emacs-devel@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).