git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Junio C Hamano <gitster@pobox.com>
To: Andreas Ericsson <ae@op5.se>
Cc: Tom Prince <tom.prince@ualberta.net>,
	Steffen Prohaska <prohaska@zib.de>,
	git@vger.kernel.org
Subject: Re: [PATCH 10/10] push: teach push to be quiet if local ref is strict subset of remote ref
Date: Fri, 02 Nov 2007 12:42:33 -0700	[thread overview]
Message-ID: <7vfxzo3046.fsf@gitster.siamese.dyndns.org> (raw)
In-Reply-To: <472B2B8F.1060203@op5.se> (Andreas Ericsson's message of "Fri, 02 Nov 2007 14:52:15 +0100")

Andreas Ericsson <ae@op5.se> writes:

> Tom Prince wrote:
>>
>> I haven't had occasion to use git-bisect much, but I was under the
>> impression that bisect could already handle merges, or any other shaped
>> history just fine.
>
> It appears the code supports your statement. I started writing on my
> hack-around about a year ago, and the merge-handling code got in with
> 1c4fea3a40e836dcee2f16091bf7bfba96c924d0 at Wed Mar 21 22:16:24 2007.
> Perhaps I shouldn't be so paranoid about useless merges anymore then.
> Hmm. I shall have to look into it. Perhaps Junio can clarify how it
> works? The man-page was terribly silent about how git-bisect handles
> merges.

Bisecting through merge is not a problem.  Not at all, from the
very beginning of the bisect command.

	Side note.  The commit you quote does not change (let
	alone fix) the semantics at all.  It is a pure
	optimization.  The theory behind how bisect works, see
	my OLS presentation (reachable from the gitwiki).

The real problem is what to do when the culprit turns out to be
a merge commit.  How to spot what really is wrong, and figure
out how to fix.  The problem is not for the tool but for the
human, and it is real.

Imagine this history.

      ---Z---o---X---...---o---A---C---D
          \                       /
           o---o---Y---...---o---B

Suppose that on the upper development line, the meaning of one
of the functions existed at Z was changed at commit X.  The
commits from Z leading to A change both the function's
implementation and all calling sites that existed at Z, as well
as new calling sites they add, to be consistent.  There is no
bug at A.

Suppose in the meantime the lower development line somebody
added a new calling site for that function at commit Y.  The
commits from Z leading to B all assume the old semantics of that
function and the callers and the callee are consistent with each
other.  There is no bug at B, either.

You merge to create C.  There is no textual conflict with this
three way merge, and the result merges cleanly.  You bisect
this, because you found D is bad and you know Z was good.  Your
bisect will find that C (merge) is broken.  Understandably so,
as at C, the new calling site of the function added by the lower
branch is not converted to the new semantics, while all the
other calling sites that already existed at Z would have been
converted by the merge.  The new calling site has semantic
adjustment needed, but you do not know that yet.  You need to
find out that is the cause of the breakage by looking at the
merge commit C and the history leading to it.

How would you do that?

Both "git diff A C" and "git diff B C" would be an enormous patch.
Each of them essentially shows the whole change on each branch
since they diverged.  The developers may have well behaved to
create good commits that follow the "commit small, commit often,
commit well contained units" mantra, and each individual commit
leading from Z to A and from Z to B may be easy to review and
understand, but looking at these small and easily reviewable
steps alone would not let you spot the breakage.  You need to
have a global picture of what the upper branch did (and
among many, one of them is to change the semantics of that
particular function) and look first at the huge "diff A C"
(which shows the change the lower branch introduces), and see if
that huge change is consistent with what have been done between
Z and A.

If you linearlize the history by rebasing the lower branch on
top of upper, instead of merging, the bug becomes much easier to
find and understand.  Your history would instead be:

    ---Z---o---X'--...---o---A---o---o---Y'--...---o---B'--D'

and there is a single commit Y' between A and B' that introduced
the new calling site that still uses the new semantics of the
function that was already in A.  "git show Y'" will be a much
smaller patch than "git diff A C" and it is much easier to deal
with.

  parent reply	other threads:[~2007-11-02 19:42 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-10-28 17:46 [PATCH 0/10 v3] improve refspec handling in push Steffen Prohaska
2007-10-28 17:46 ` [PATCH 01/10] push: change push to fail if short refname does not exist Steffen Prohaska
2007-10-28 17:46   ` [PATCH 02/10] push: teach push new flag --create Steffen Prohaska
2007-10-28 17:46     ` [PATCH 03/10] push: support pushing HEAD to real branch name Steffen Prohaska
2007-10-28 17:46       ` [PATCH 04/10] push: add "git push HEAD" shorthand for 'push current branch to default repo' Steffen Prohaska
2007-10-28 17:46         ` [PATCH 05/10] rename ref_matches_abbrev() to ref_abbrev_matches_full_with_fetch_rules() Steffen Prohaska
2007-10-28 17:46           ` [PATCH 06/10] add ref_abbrev_matches_full_with_rev_parse_rules() comparing abbrev with full ref name Steffen Prohaska
2007-10-28 17:46             ` [PATCH 07/10] push: use same rules as git-rev-parse to resolve refspecs Steffen Prohaska
2007-10-28 17:46               ` [PATCH 08/10] push: teach push to accept --verbose option Steffen Prohaska
2007-10-28 17:46                 ` [PATCH 09/10] push: teach push to pass --verbose option to transport layer Steffen Prohaska
2007-10-28 17:46                   ` [PATCH 10/10] push: teach push to be quiet if local ref is strict subset of remote ref Steffen Prohaska
2007-10-30  8:29                     ` Junio C Hamano
2007-10-30 10:15                       ` Steffen Prohaska
2007-10-30 10:26                         ` Andreas Ericsson
2007-10-30 10:53                           ` Steffen Prohaska
2007-10-30 19:19                         ` Junio C Hamano
2007-10-31  7:53                           ` Steffen Prohaska
2007-10-31  8:45                             ` Junio C Hamano
     [not found]                               ` <B3C76DB8-076D-4C43-AC28-99119A05325C@z ib.de>
2007-10-31  9:14                               ` Junio C Hamano
2007-10-31 10:50                               ` Steffen Prohaska
2007-10-31 18:51                                 ` Junio C Hamano
2007-10-31 21:09                                   ` Steffen Prohaska
2007-10-31 21:31                                     ` Junio C Hamano
2007-11-01  7:03                                       ` Steffen Prohaska
2007-11-01  9:11                                         ` Andreas Ericsson
2007-11-01 16:43                                           ` Steffen Prohaska
2007-11-01 20:18                                             ` Junio C Hamano
2007-11-02  7:21                                               ` Steffen Prohaska
2007-11-02  7:52                                                 ` Junio C Hamano
2007-11-02 10:03                                                   ` Steffen Prohaska
2007-11-02 10:44                                                     ` Junio C Hamano
2007-11-02 11:40                                                       ` Steffen Prohaska
2007-11-02 10:03                                             ` Andreas Ericsson
2007-11-02 13:24                                               ` Tom Prince
2007-11-02 13:52                                                 ` Andreas Ericsson
2007-11-02 14:49                                                   ` Steffen Prohaska
2007-11-02 19:42                                                   ` Junio C Hamano [this message]
2007-11-02 20:19                                                     ` Junio C Hamano
2007-11-01  8:18                                       ` Andreas Ericsson
2007-11-01  8:36                                         ` Steffen Prohaska
2007-11-01  9:29                                           ` Andreas Ericsson
2007-11-02  8:18                                       ` Wincent Colaiuta
2007-11-02 12:14                                         ` Johannes Schindelin
2007-11-02 12:48                                           ` Steffen Prohaska
2007-11-02 13:11                                             ` Wincent Colaiuta
2007-10-30 18:00                       ` Daniel Barkalow
2007-10-30  8:28               ` [PATCH 07/10] push: use same rules as git-rev-parse to resolve refspecs Junio C Hamano
2007-10-30  8:49                 ` Steffen Prohaska
2007-10-30  8:28         ` [PATCH 04/10] push: add "git push HEAD" shorthand for 'push current branch to default repo' Junio C Hamano
2007-10-30  8:28       ` [PATCH 03/10] push: support pushing HEAD to real branch name Junio C Hamano
2007-10-30  8:29   ` [PATCH 01/10] push: change push to fail if short refname does not exist Junio C Hamano
2007-10-30  8:56     ` Steffen Prohaska
2007-10-30  9:22       ` Junio C Hamano

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=7vfxzo3046.fsf@gitster.siamese.dyndns.org \
    --to=gitster@pobox.com \
    --cc=ae@op5.se \
    --cc=git@vger.kernel.org \
    --cc=prohaska@zib.de \
    --cc=tom.prince@ualberta.net \
    /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).