threads / discuss / 24377

skipping commits via commit-msg contents

Subject: skipping commits via commit-msg contents

## tl;dr

4 messages between Jul 12, 2010 and Jul 12, 2010.

replies: 3people: 3as markdown or json

Jim Cromie· Jul 12, 2010, 18:21 UTC · lore

sometimes its desirable to commit incomplete work separately, for example a struct change thats intended to get compiler to report where changes are needed.

if git bisect were to recognize --skip-bisect in the subject line (or in commit-message somewhere, say top or bottom), then bisection could proceed silently past such commits.

This would also allow rebasing a patchset to markup crappy commits which need further work.

worth having ?
Ramkumar Ramachandra· Jul 12, 2010, 18:35 UTC · re: Jim Cromie · lore

Re: skipping commits via commit-msg contents

Hi Jim,
Jim Cromie writes:
Show 10 quoted lines
> sometimes its desirable to commit incomplete work separately,
> for example a struct change thats intended to get compiler to report
> where changes are needed.
> 
> if git bisect were to recognize  --skip-bisect  in the subject line
> (or in commit-message somewhere, say top or bottom),
> then bisection could proceed silently past such commits.
> 
> This would also allow rebasing a patchset to markup crappy commits
> which need further work.

This is perhaps not exactly what you want, but I thought I'd mention it anyway: I usually prefix commit messages of temporary commits with a "fixup! " or "squash! " and then use the `--autosquash` feature of `git rebase --interactive` in a new branch before running `git bisect`.

-- Ram
Jonathan Nieder· Jul 12, 2010, 19:02 UTC · re: Jim Cromie · lore

Re: skipping commits via commit-msg contents

Hi Jim,
Jim Cromie wrote:
> if git bisect were to recognize  --skip-bisect  in the subject line
> (or in commit-message somewhere, say top or bottom),
> then bisection could proceed silently past such commits.

In addition to Ram’s suggestion, you might want to look into ‘git replace’[1]. It can be useful when the broken commits have already been published. It works like this:

 git replace <bad commit> <bad commit>^

and then ‘git bisect’ and lower-level commands like git show and checkout will silently substitute the parent of the broken commit when ever you refer to it.

You can publish the resulting “replace refs” in the refs/replace/* namespace and anyone who explicitly chooses to fetch them will be able to see the same effect.

Two problems:
 - bisect skip is a bit more sophisticated (read: better) than just
   substituting a parent, especially when the commit to be skipped
   is a merge.  So it might still make sense to teach bisect to
   respect a refs/notes/skip-bisect note that requests for it
   to skip a specific ref.
   One can try this out by making an appropriate wrapper script
   for ‘git bisect next’ (using ‘git notes’).
 - replace refs are a little too powerful.  It would be nicer to
   by able to use ‘git replace --refs=refs/replace/bisect/’
   and ‘GIT_REPLACE_REFS=refs/replace/bisect/ git bisect’ to
   make them take effect only when needed.  In other words,
   it would be nicer if “git replace” were configurable in the
   same way as “git notes” is.
   One can get something like that effect by using git for-each-ref
   and git update-ref to rename replace refs into place only when
   needed.
[1] http://www.kernel.org/pub/software/scm/git/docs/git-bisect-lk2009.html#_git_replace
Jim Cromie· Jul 12, 2010, 19:56 UTC · re: Jonathan Nieder · lore

Re: skipping commits via commit-msg contents

thanks guys,
Ram, not what I want, but good to know..

Jonathan, replace feels like a big hammer for a newbie.. I havent published these, since they need bisection amongst other reasons :-O and the BUGS also require more -fu to understand than I possess

On Mon, Jul 12, 2010 at 1:02 PM, Jonathan Nieder <jrnieder@gmail.com> wrote:
Show 29 quoted lines
> Hi Jim,
>
> Jim Cromie wrote:
>
>> if git bisect were to recognize  --skip-bisect  in the subject line
>> (or in commit-message somewhere, say top or bottom),
>> then bisection could proceed silently past such commits.
>
> In addition to Ram’s suggestion, you might want to look into
> ‘git replace’[1].  It can be useful when the broken commits
> have already been published.  It works like this:
>
>  git replace <bad commit> <bad commit>^
>
> and then ‘git bisect’ and lower-level commands like git show and
> checkout will silently substitute the parent of the broken commit
> when ever you refer to it.
>
> You can publish the resulting “replace refs” in the refs/replace/*
> namespace and anyone who explicitly chooses to fetch them will be
> able to see the same effect.
>
> Two problems:
>
>  - bisect skip is a bit more sophisticated (read: better) than just
>   substituting a parent, especially when the commit to be skipped
>   is a merge.  So it might still make sense to teach bisect to
>   respect a refs/notes/skip-bisect note that requests for it
>   to skip a specific ref.

This sounds nice. Notionally, extending it further would be cool -

[jimc@groucho perl-git]$ git notes show 2de9db42d3e578becacbd237bf4f59b432cc82f0 good make test

with this note, Ive told myself that it passes (good), and what it passes (make test)

I could imagine bisect knowing enough to take that as an implicit start, unless overridden on a command line, or by a similar note on a later commit.

a note like: skip-bisect until <tag|commit|branch> could be cool too, though there may be deeper problems with skipping entire subranges.

thanks again, Jim

← back to recent threads