git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v17 1/7] bisect: move argument parsing before state modification.

From
Christian Couder <chriscool@tuxfamily.org>
Date
Sep 7, 2011, 06:16 UTC
Message-ID
<201109070816.16655.chriscool@tuxfamily.org>
In-Reply-To
<1312459263-16911-2-git-send-email-jon.seymour@gmail.com>
Hi,
On Thursday 04 August 2011 14:00:57 Jon Seymour wrote:
Show 6 quoted lines
> Currently 'git bisect start' modifies some state prior to checking
> that its arguments are valid.
> 
> This change moves argument validation before state modification
> with the effect that state modification does not occur
> unless argument validations succeeds.
This thread:
http://thread.gmane.org/gmane.comp.version-control.git/180733/
made me wonder if we introduced a bug with this patch.
If we start bisecting like this:
$ git bisect start HEAD HEAD~20

and then we decide that it was not optimum and we want to start again like this:

$ git bisect start HEAD HEAD~6
then issuing the latter command might not work as it did before this patch.
 
Before this patch the latter command would do a "git checkout $start_head" 
before the repeated rev=$(git rev-parse -q --verify "$arg^{commit}") to 
convert arguments into sha1. And after this patch the order is reversed.

This means that before this patch "HEAD" in the arguments to "git bisect start" would refer to $start_head because the "git checkout $start_head" changes HEAD. After this patch "HEAD" in the arguments to "git bisect start" would refer to the current HEAD.

For example before this patch, if I issue "git bisect start HEAD HEAD~8" twice I get:

$ git bisect start HEAD HEAD~8
Bisecting: 15 revisions left to test after this (roughly 4 steps)
[67c116bb26b4ee31889e5ee15d6a9d3b7e972b7b] Merge branch 'jk/pager-with-
external-command'
$ git bisect start HEAD HEAD~8
Previous HEAD position was 67c116b... Merge branch 'jk/pager-with-external-
command'
Switched to branch 'master'
Bisecting: 15 revisions left to test after this (roughly 4 steps)
[67c116bb26b4ee31889e5ee15d6a9d3b7e972b7b] Merge branch 'jk/pager-with-
external-command'
so the same commit to test is checked out.
After this patch I get:
$ git bisect start HEAD HEAD~8
Bisecting: 15 revisions left to test after this (roughly 4 steps)
[67c116bb26b4ee31889e5ee15d6a9d3b7e972b7b] Merge branch 'jk/pager-with-
external-command'
$ git bisect start HEAD HEAD~8
Previous HEAD position was 67c116b... Merge branch 'jk/pager-with-external-
command'
Switched to branch 'master'
Bisecting: 15 revisions left to test after this (roughly 4 steps)
[e5cfcb04e0acc5f3b51e6d69487028315b33e4c9] Merge branch 'mh/attr'

so a different commit is checked out after the second "git bisect start HEAD HEAD~8".

Best regards, Christian.

Previous: Jon SeymourNext: Junio C Hamano
Message 3 of 12 in “bisect: Add support for --no-checkout option”
  1. 0/7 bisect: Add support for --no-checkout optionJon Seymour, Aug 4, 2011
  2. 1/7 bisect: move argument parsing before state modification.Jon Seymour, Aug 4, 2011
  3. Christian CouderSep 7, 2011
  4. Junio C HamanoSep 7, 2011
  5. Johannes SixtSep 7, 2011
  6. Jon SeymourSep 8, 2011
  7. 2/7 bisect: use && to connect statements that are deferred with eval.Jon Seymour, Aug 4, 2011
  8. 3/7 bisect: add tests to document expected behaviour in presence of broken trees.Jon Seymour, Aug 4, 2011
  9. 4/7 bisect: introduce support for --no-checkout option.Jon Seymour, Aug 4, 2011
  10. 5/7 bisect: introduce --no-checkout support into porcelain.Jon Seymour, Aug 4, 2011
  11. 6/7 bisect: add tests for the --no-checkout option.Jon Seymour, Aug 4, 2011
  12. 7/7 bisect: add documentation for --no-checkout option.Jon Seymour, Aug 4, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.