git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andreas Ericsson <ae@op5.se>
To: Daniel Pittman <daniel@rimspace.net>
Cc: git@vger.kernel.org
Subject: Re: Test that every revision builds before pushing changes?
Date: Thu, 26 Mar 2009 10:46:00 +0100	[thread overview]
Message-ID: <49CB4ED8.4060205@op5.se> (raw)
In-Reply-To: <87ljqs7ioz.fsf@rimspace.net>

Daniel Pittman wrote:
> Andreas Ericsson <ae@op5.se> writes:
>> Daniel Pittman wrote:
>>> I would like to ensure that my commits are fully bisectable before I
>>> commit them to an upstream repository, at least to the limits of an
>>> automatic tool for testing them.
>>>
>>> 'git bisect run' is similar: it can automatically locate the breaking in
>>> a test suite, for example, but that doesn't help me in the case of three
>>> commits, A (good), B (bad) and C (good, fixing B).
>>>
>>> I would much rather, in this case, use rebase to fix B so that it, too,
>>> builds before I push the changes and pollute a public repository with a
>>> broken changeset — and make bisect that much harder to use in future.
>> You can do that, but it requires manual work too. The trick is to make
>> the release branch immutable on the public repository and use topic
>> branches with per-developer namespaces. The per-developer namespace
>> thing is actually important, as it leaves the freedom to rewind and
>> recreate topics to the developers (which shared branches do not).
>>
>> The manual step comes at merge-time; Someone has to be responsible for
>> merging all the topics that are to be included in the release branch
>> and make sure it builds and passes all tests after each merge.
> 
> Ah.  You have not quite grasped what I was looking for: I was after a
> tool to help automate that step, rather than a workflow around it.
> 

Oh right. Sorry, I'm stuck in continuous-integration land where people
tend to want the server to take care of such things.

> For example, the responsible person for that testing could use the
> hypothetical (until someone tells me where to find it):
> 
>     git test public..test make test
> 
> Which would then effectively wrap:
> 
>     for each revision between public and private:
>          git checkout revision
>          make test
>          # report if that fails, allow fixing the commit or whatever
>          # then 'git test continue' to carry on...
> 
> That turn the process from a manual one to an automated one: it runs
> that command for every revision until it fails, or until they all pass.
> 

Something like this?
--%<--%<--
#!/bin/sh

git stash
revspec="$1"
shift
for rev in $(git rev-list "$revspec"); do
	git checkout $rev
	"$@" || break
done
--%<--%<--

Run it as such:
./git-test.sh public..test make test

Adding support for "continue" in there shouldn't be hard, since
you'd just replace the first rev with the first parent of the
last tested revision, although if you want to fix up a commit
in the middle, you'd have to manually rebase the other ones
onto the newly created commit (again, not very hard but I'll
leave both as an exercise to you).

It doesn't handle merges very nicely, btw, but I guess this
should be run prior to merging anyways.

-- 
Andreas Ericsson                   andreas.ericsson@op5.se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

Considering the successes of the wars on alcohol, poverty, drugs and
terror, I think we should give some serious thought to declaring war
on peace.

  reply	other threads:[~2009-03-26  9:47 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-26  6:29 Test that every revision builds before pushing changes? Daniel Pittman
2009-03-26  8:16 ` Andreas Ericsson
2009-03-26  9:10   ` Daniel Pittman
2009-03-26  9:46     ` Andreas Ericsson [this message]
2009-03-27  1:30       ` Daniel Pittman
2009-03-26  9:49     ` Jeff King
2009-03-26  9:59       ` Wincent Colaiuta

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=49CB4ED8.4060205@op5.se \
    --to=ae@op5.se \
    --cc=daniel@rimspace.net \
    --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 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 NNTP newsgroup(s).