git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
From: Oleg Taranenko <olegtaranenko@gmail.com>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org
Subject: Re: git bisect for reachable commits only
Date: Sun, 31 Jul 2016 02:06:55 +0200	[thread overview]
Message-ID: <CABEd3j-MW--YSC9=nwcgHzxd6cqmUY+ky3-wLxMiMmbBGsvS7Q@mail.gmail.com> (raw)
In-Reply-To: <xmqqinvonwxc.fsf@gitster.mtv.corp.google.com>

Hi Junio,

Thanks for reply.
Let consider two pretty similar use cases.

************ SCENARIO 1 ************

mkdir bisect
cd bisect/
git init
git touch coffee
git commit -am "create coffee"
git branch develop
echo sugar >> coffee
git commit -am "add sugar" # we are still in master branch
git checkout develop       # get back to coffe without sugar
git touch tee              # cooking tee in develop branch
git commit -am "tee"
git merge master           #
cat coffee                 # after merge coffe has sugar
ex +g/sugar/d -cwq coffee  # introducing 'bug' by removing sugar from coffee
git commit -am "merged/amended" --amend       # the history is amended
echo "sugar" >> tee
git commit -am "sugar for tee"              # just advance for measure

# -------------- We are getting following state ------------------
git status                 # develop branch
git log --full-history --graph --pretty=oneline
* 83e9577b4a5d553fdc16806fdea9757229ea9222 sugar for tee
*   23a4aa69a9d5c03aa145844005555b7ee00c4d63 merged/amended
|\
| * 4c1caf7cb2417181c035a953afdf2389dd130aef add sugar
* | c080fb4df39d721e2f2e0fdd91fe16d8bdd77515 tee
|/
* 3c3043b7d0a0d260c78db55b565f26e430aa5c80 create coffee

cat coffee # nothing                        # discovering coffee has no sugar
git checkout 4c1c                           # but we remember it should to have
cat coffee                                  # ..."sugar"

git bisect start
git bisect good
git bisect bad develop   # 23a4
cat coffee               # nothing
git bisect bad           # c080
cat coffee               # nothing
git bisect bad           #
c080fb4df39d721e2f2e0fdd91fe16d8bdd77515 is the first bad commit
commit c080fb4df39d721e2f2e0fdd91fe16d8bdd77515
Author: Oleg Taranenko <olegtaranenko@gmail.com>
Date:   Fri Jul 29 09:08:47 2016 +0200

    tee

:000000 100644 0000000000000000000000000000000000000000
e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 A tee



We are getting first bad commit c080, but git bisect fails.
We remember is was introduced in the 23a4 commit via wrong merge and
history amending.


************ SCENARIO 2 ************
cd ..
mkdir bisect2
cd bisect2
git init
git touch coffee
git commit -am "create coffee"
echo sugar >> coffee
# we are still in master branch
git commit -am "add sugar"
git branch develop
echo milk >> coffee
git commit -am "add milk to coffee"

# get back to coffe without sugar
git checkout  develop
ex "+g/sugar/d" -cwq coffee
echo milk >> coffee
git commit -am "coffee: replace sugar with milk"
# cooking tee in develop branch
git touch tee
git commit -am "tee"
git checkout master
git merge develop


#Here we are getting real conflict
cat coffee
#<<<<<<< HEAD
#sugar
#=======
#>>>>>>> develop
#milk

#resolving
git checkout develop --theirs -- coffee
cat coffee             # milk
git commit -am "conflict resolved"
echo "sugar" >> tee
git commit -am "sugar for tee"              # just advance for measure


 ---------- State -----------------
git log --full-history --graph --pretty=oneline
* b88a3cb3df58fc018d635d559d212707e953f84d sugar for tee
*   138824139c0237fe05419d4f40a693e4c19405a3 conflict resolved
|\
| * e1ddbfe05d632d6f12dd7ff9d9b61475c2cde867 tee
| * ddfb5188c98b8fc803a036ac4eee0610e2bba53f coffee: replace sugar with milk
* | 0e1c55363e5b2fb04a6072fa470f90770b3eee22 add milk to coffee
|/
* 465d0c68c597f1534c3c1e19ed9a086c5da190ae add sugar
* 24b73ce9085a6d411c06c08cca0536dc8f2239c7 create coffee


cat coffee      # only milk, no sugar... bug
git checkout 792d
cat coffee                 # OK, milk & sugar
git bisect start
git bisect good
git bisect bad master      # e1dd
cat coffee                 # milk only
git bisect bad             # ddfb
cat coffee                 # milk only
git bisect bad             # first bad commit !!

It happens, git really found that somebody (me) was replaced sugar
with milk, because ancestor of both branches already has sugar, and
commit ddfb
explicit removes it.

As we can see, both strategies can coexisting, and now I ever can't
state for sure, which one is more intuitive correct.

I think if repo has relative straight history, more productive to use
bisect with auto search in un-reachable commits.
For messy repositories (especially, with lots of aliens code) more
safe to use --reachable bisecting strategy.

Then, I suggest as well additional to defaulting via 'git config
bisect.reachable true/false' use per bisect session switch

    git bisect start --[un-]reachable-commits # which will override
default setting


Thanks you for reading to this point,

Oleg

On Fri, Jul 29, 2016 at 8:03 PM, Junio C Hamano <gitster@pobox.com> wrote:
> Oleg Taranenko <olegtaranenko@gmail.com> writes:
>
>> What I suggest change logic of bisecting to something like
>>
>>       git config bisect.reachable true
>
> Such a configuration should not be needed.
>
> When a history with this shape is given to "git bisect":
>
>     ----o---o---X---Y---B
>          \     /
>           o---G
>
> and you gave G as good, and B as bad, it is a BUG that needs to be
> fixed if bisect strayed outside G, X, Y and B.  Setting your new
> configuration to false would mean "please run a buggy version of
> bisect", which does not make much sense, I would think.
>
>
>
>
>

  reply	other threads:[~2016-07-31  0:07 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-29  8:53 git bisect for reachable commits only Oleg Taranenko
2016-07-29 18:03 ` Junio C Hamano
2016-07-31  0:06   ` Oleg Taranenko [this message]
2016-07-31  9:26     ` Jakub Narębski
2016-08-01 16:49       ` Junio C Hamano
2016-08-01 10:02     ` Oleg Taranenko
2016-08-01 15:41       ` Christian Couder
2016-08-01 19:51         ` Junio C Hamano
2016-08-01 20:36           ` Christian Couder
2016-08-01 23:11             ` Junio C Hamano
2016-08-02 10:15               ` Oleg Taranenko
2016-08-02 17:25                 ` Stefan Beller
2016-08-02 21:00                 ` Junio C Hamano
2016-08-04 23:29                   ` Oleg Taranenko

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: http://vger.kernel.org/majordomo-info.html

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

  git send-email \
    --in-reply-to='CABEd3j-MW--YSC9=nwcgHzxd6cqmUY+ky3-wLxMiMmbBGsvS7Q@mail.gmail.com' \
    --to=olegtaranenko@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /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://80x24.org/mirrors/git.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).