1
0
Fork 0
mirror of https://github.com/git/git.git synced 2024-05-25 07:46:15 +02:00
Commit Graph

64 Commits

Author SHA1 Message Date
Ville Skyttä 2e3a16b279 Spelling fixes
<BAD>                     <CORRECTED>
    accidently                accidentally
    commited                  committed
    dependancy                dependency
    emtpy                     empty
    existance                 existence
    explicitely               explicitly
    git-upload-achive         git-upload-archive
    hierachy                  hierarchy
    indegee                   indegree
    intial                    initial
    mulitple                  multiple
    non-existant              non-existent
    precendence.              precedence.
    priviledged               privileged
    programatically           programmatically
    psuedo-binary             pseudo-binary
    soemwhere                 somewhere
    successfull               successful
    transfering               transferring
    uncommited                uncommitted
    unkown                    unknown
    usefull                   useful
    writting                  writing

Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-08-11 14:35:42 -07:00
Vasco Almeida 14dc4899e5 i18n: bisect: mark strings for translation
In the last message, involving Q_(), try to mark the message in such way
that is suited for RTL (Right to Left) languages.

Update test t6030-bisect-porcelain.sh to reflect the changes.

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-06-17 15:45:48 -07:00
Vasco Almeida c9e6ce41da t6030: update to use test_i18ncmp
Since the git bisect output tested here is subject to translation, the
helper function test_i18ncmp should be used over test_cmp.

Signed-off-by: Vasco Almeida <vascomalmeida@sapo.pt>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2016-06-17 15:45:48 -07:00
Matthieu Moy 06e6a74506 bisect: allow setting any user-specified in 'git bisect start'
This allows a natural user-interface when looking for any change in the
code, not just regression. For example:

git bisect start --term-old fast --term-new slow
git bisect fast
git bisect slow
...

There were several proposed user-interfaces for this feature. This patch
implements it as options to 'git bisect start' for the following reasons:

* By construction, the terms will be valid for one and only one
  bisection.

* Unlike positional arguments, using named options avoid having to
  remember an order.

* We can combine user-defined terms and passing old/new commits as
  argument to "git bisect start".

* The implementation is relatively simple.

See previous discussions:

  http://mid.gmane.org/1435337896-20709-3-git-send-email-Matthieu.Moy@imag.fr

Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-08-03 11:42:43 -07:00
Matthieu Moy 21b55e3369 bisect: add 'git bisect terms' to view the current terms
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-08-03 11:42:42 -07:00
Antoine Delaite 21e5cfd8b3 bisect: add the terms old/new
When not looking for a regression during a bisect but for a fix or a
change in another given property, it can be confusing to use 'good'
and 'bad'.

This patch introduce `git bisect new` and `git bisect old` as an
alternative to 'bad' and good': the commits which have a certain
property must be marked as `new` and the ones which do not as `old`.

The output will be the first commit after the change in the property.
During a new/old bisect session you cannot use bad/good commands and
vice-versa.

Some commands are still not available for old/new:
     * git rev-list --bisect does not treat the revs/bisect/new and
       revs/bisect/old-SHA1 files.

Old discussions:
	- http://thread.gmane.org/gmane.comp.version-control.git/86063
		introduced bisect fix unfixed to find fix.
	- http://thread.gmane.org/gmane.comp.version-control.git/182398
		discussion around bisect yes/no or old/new.
	- http://thread.gmane.org/gmane.comp.version-control.git/199758
		last discussion and reviews
New discussions:
	- http://thread.gmane.org/gmane.comp.version-control.git/271320
		( v2 1/7-4/7 )
	- http://comments.gmane.org/gmane.comp.version-control.git/271343
		( v2 5/7-7/7 )

Signed-off-by: Antoine Delaite <antoine.delaite@ensimag.grenoble-inp.fr>
Signed-off-by: Louis Stuber <stuberl@ensimag.grenoble-inp.fr>
Signed-off-by: Valentin Duperray <Valentin.Duperray@ensimag.imag.fr>
Signed-off-by: Franck Jonas <Franck.Jonas@ensimag.imag.fr>
Signed-off-by: Lucien Kong <Lucien.Kong@ensimag.imag.fr>
Signed-off-by: Thomas Nguy <Thomas.Nguy@ensimag.imag.fr>
Signed-off-by: Huynh Khoi Nguyen Nguyen <Huynh-Khoi-Nguyen.Nguyen@ensimag.imag.fr>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-08-03 11:42:42 -07:00
Antoine Delaite f6216c2c5c bisect: correction of typo
Signed-off-by: Antoine Delaite <antoine.delaite@ensimag.grenoble-inp.fr>
Signed-off-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-06-23 11:41:56 -07:00
Jeff King e4e6e8b4e3 t6030: use modern test_* helpers
We can get rid of a lot of hand-rolled error messages by
using test_must_fail and test_expect_code. The existing code
was careful to use "|| return 1" when breaking the
&&-chain, but it did fool --chain-lint; the new code is more
idiomatic.

We also add some uses of test_when_finished, which is less
cryptic and more robust than putting code at the end of a
test. In two cases we run "git bisect reset" from a
subshell, which is a problem for test_when_finished (it
would not run). However, in both of these cases, we are
performing the tests in one-off sub-repos, so we do not need
to clean up at all (and in fact it is nicer not to if the
user wants to inspect the trash directory after a failure).

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2015-03-20 11:35:55 -07:00
Christian Couder 07913d5ae1 bisect: add test to check that revs are properly parsed
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2014-12-29 11:34:05 -08:00
Torstein Hegge f989cac958 bisect: Log possibly bad, skipped commits at bisection end
If the bisection completes with only skipped commits left to as possible
first bad commit, output the list of possible first bad commits to human
readers of the bisection log.

Signed-off-by: Torstein Hegge <hegge@resisty.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-23 09:09:44 -07:00
Torstein Hegge a7f8b8ac94 bisect: Store first bad commit as comment in log file
When bisect successfully finds a single revision, the first bad commit
should be shown to human readers of 'git bisect log'.

This resolves the apparent disconnect between the bisection result and
the log when a bug reporter says "I know that the first bad commit is
$rev, as you can see from $(git bisect log)".

Signed-off-by: Torstein Hegge <hegge@resisty.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-15 09:05:42 -07:00
Junio C Hamano caa7d79f1f Sync with 'maint'
* maint:
  Correct common spelling mistakes in comments and tests
  kwset: fix spelling in comments
  precompose-utf8: fix spelling of "want" in error message
  compat/nedmalloc: fix spelling in comments
  compat/regex: fix spelling and grammar in comments
  obstack: fix spelling of similar
  contrib/subtree: fix spelling of accidentally
  git-remote-mediawiki: spelling fixes
  doc: various spelling fixes
  fast-export: fix argument name in error messages
  Documentation: distinguish between ref and offset deltas in pack-format
  i18n: make the translation of -u advice in one go
2013-04-12 13:54:01 -07:00
Stefano Lattarini 41ccfdd9c9 Correct common spelling mistakes in comments and tests
Most of these were found using Lucas De Marchi's codespell tool.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Acked-by: Matthieu Moy <Matthieu.Moy@imag.fr>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-04-12 13:38:40 -07:00
Nguyễn Thái Ngọc Duy 6deab24d88 status, branch: fix the misleading "bisecting" message
The current message is "bisecting %s" (or "bisecting branch %s").
"%s" is the current branch when we started bisecting. Clarify that to
avoid confusion with good and bad refs passed to "bisect" command.

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-03-23 22:29:15 -07:00
Nguyễn Thái Ngọc Duy c8183cd285 branch: show more information when HEAD is detached
This prints more helpful info when HEAD is detached: is it detached
because of bisect or rebase? What is the original branch name in those
cases? Is it detached because the user checks out a remote ref or a
tag (and which one)?

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2013-03-16 22:11:02 -07:00
Martin von Zweigbergk 5d77298d08 tests: move test_cmp_rev to test-lib-functions
A function for checking that two given parameters refer to the same
revision was defined in several places, so move the definition to
test-lib-functions.sh instead.

Signed-off-by: Martin von Zweigbergk <martinvonz@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-12-22 19:06:35 -08:00
Stefano Lattarini 3fb0459bc8 tests: modernise style: more uses of test_line_count
Prefer:

  test_line_count <OP> COUNT FILE

over:

  test $(wc -l <FILE) <OP> COUNT

(or similar usages) in several tests.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2012-04-11 09:32:20 -07:00
Junio C Hamano 5ae0f68160 Merge branch 'ab/i18n-test-fix'
* ab/i18n-test-fix:
  t/t7508-status.sh: use test_i18ncmp
  t/t6030-bisect-porcelain.sh: use test_i18ngrep
2011-11-06 21:22:22 -08:00
Ævar Arnfjörð Bjarmason 475b3777bd t/t6030-bisect-porcelain.sh: use test_i18ngrep
Change a i18n-specific grep in t/t6030-bisect-porcelain.sh to use
test_i18ngrep instead. This was introduced in v1.7.7.2~5^2~11 and has
been broken under GETTEXT_POISON=YesPlease since.

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-11-05 23:14:25 -07:00
Junio C Hamano 8e969454e1 Merge branch 'bc/bisect-test-use-shell-path'
* bc/bisect-test-use-shell-path:
  t6030: use $SHELL_PATH to invoke user's preferred shell instead of bare sh
2011-09-02 13:18:37 -07:00
Brandon Casey 381f0d3bd9 t6030: use $SHELL_PATH to invoke user's preferred shell instead of bare sh
Some platforms (IRIX, Solaris) provide an ancient /bin/sh which chokes on
modern shell syntax like $().  SHELL_PATH is provided to allow the user to
specify a working sh, let's use it here.

Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-30 17:07:09 -07:00
Jon Seymour 24c512803d bisect: add support for bisecting bare repositories
This enhances the support for bisecting history in bare repositories.

The "git bisect" command no longer needs to be run inside a repository
with a working tree; it defaults to --no-checkout when run in a bare
repository.

Two tests are included to demonstrate this behaviour.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-09 10:26:18 -07:00
Jon Seymour b704a8b3fd bisect: add tests for the --no-checkout option.
These tests verify that git-bisect --no-checkout can successfully
bisect commit histories that reference damaged trees.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-04 15:37:20 -07:00
Jon Seymour d3dfeedf2e bisect: add tests to document expected behaviour in presence of broken trees.
If the repo is broken, we expect bisect to fail.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-04 15:33:50 -07:00
Jon Seymour 4764f46492 bisect: move argument parsing before state modification.
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.

An existing test is changed to check that new bisect state
is not created if arguments are invalid.

A new test is added to check that existing bisect state
is not modified if arguments are invalid.

Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2011-08-04 15:32:34 -07:00
Jonathan Nieder a48fcd8369 tests: add missing &&
Breaks in a test assertion's && chain can potentially hide
failures from earlier commands in the chain.

Commands intended to fail should be marked with !, test_must_fail, or
test_might_fail.  The examples in this patch do not require that.

Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-11-09 11:59:49 -08:00
Junio C Hamano 9e2b885741 Merge branch 'cc/maint-bisect-paths'
* cc/maint-bisect-paths:
  bisect: error out when passing bad path parameters
2010-03-01 01:09:21 -08:00
Christian Couder 8f69f72fca bisect: error out when passing bad path parameters
As reported by Mark Lodato, "git bisect", when it was started with
path parameters that match no commit was kind of working without
taking account of path parameters and was reporting something like:

Bisecting: -1 revisions left to test after this (roughly 0 steps)

It is more correct and safer to just error out in this case, before
displaying the revisions left, so this patch does just that.

Note that this bug is very old, it exists at least since v1.5.5.
And it is possible to detect that case earlier in the bisect
algorithm, but it is not clear that it would be an improvement to
error out earlier, on the contrary it may change the behavior of
"git rev-list --bisect-all" for example, which is currently correct.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-03-01 01:04:35 -08:00
Thiago Farina bd757c1859 Use warning function instead of fprintf(stderr, "Warning: ...").
Signed-off-by: Thiago Farina <tfransosi@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2010-01-03 16:17:03 -08:00
Nanako Shiraishi 21d0bc2f9a git-bisect: call the found commit "*the* first bad commit"
Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-08-26 12:05:57 -07:00
Christian Couder ebc9529f03 bisect: use a PRNG with a bias when skipping away from untestable commits
Using a PRNG (pseudo random number generator) with a bias should be better
than alternating between 3 fixed ratios.

In repositories with many untestable commits it should prevent alternating
between areas where many commits are untestable. The bias should favor
commits that can give more information, so that the bisection process
should not loose much efficiency.

HPA suggested to use a PRNG and found that the best bias is to raise a
ratio between 0 and 1 given by the PRNG to the power 1.5.

An integer square root function is implemented to avoid including
<math.h> and linking with -lm.

A PRNG function is implemented to get the same number sequence on
different machines as suggested by "man 3 rand".

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-13 10:47:34 -07:00
Christian Couder a66037c975 t6030: test skipping away from an already skipped commit
Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-06-06 11:26:56 -07:00
Christian Couder 2d938fc7bc bisect: check ancestors without forking a "git rev-list" process
We must save the pending commits that will be used during revision
walking and unparse them after, because we want to leave a clean
state for the next revision walking that will try to find the best
bisection point.

As we don't fork a process anymore to call "git rev-list", we need
to remove the use of GIT_TRACE to check how "git rev-list" is
called from the t6030 test that uses it.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-05-17 23:29:17 -07:00
Christian Couder b74d7efb10 t6030: test bisecting with paths
This patch adds some tests to check that "git bisect" works fine when
passing paths to "git bisect start" to reduce the number of
bisection steps.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-04-05 01:29:45 -07:00
Junio C Hamano 0c34735616 Merge branch 'cc/maint-1.6.0-bisect-fix'
* cc/maint-1.6.0-bisect-fix:
  bisect: fix quoting TRIED revs when "bad" commit is also "skip"ped

Conflicts:
	git-bisect.sh
2009-02-27 01:03:21 -08:00
Christian Couder 1b249ffe8d bisect: fix quoting TRIED revs when "bad" commit is also "skip"ped
When the "bad" commit was also "skip"ped and when more than one
commit was skipped, the "filter_skipped" function would have
printed something like:

    bisect_rev=<hash1>|<hash2>

(where <hash1> and <hash2> are hexadecimal sha1 hashes)

and this would have been evaled later as piping "bisect_rev=<hash1>"
into "<hash2>", which would have failed.

So this patch makes the "filter_skipped" function properly quote
what it outputs, so that it will print something like:

bisect_rev='<hash1>|<hash2>'

which will be properly evaled later.  The caller was not stopping
properly because the scriptlet this function returned to be evaled
was not strung together with && and because of this, an error in
an earlier part of the output was simply ignored.

A test case is added to the test suite.

And while at it, we also initialize the VARS, FOUND and TRIED
variables, so that we protect ourselves from environment variables
the user may have with these names.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2009-02-27 00:57:28 -08:00
Christian Couder 1a66a489d0 bisect: fix "git bisect skip <commit>" and add tests cases
The patch that allows "git bisect skip" to be passed a range of
commits using the "<commit1>..<commit2>" notation is flawed because
it introduces a regression when it was passed a simple rev or commit.

"git bisect skip <commit>" doesn't work any more, because <commit>
is quoted but not properly unquoted.

This patch fixes that and add tests cases to better check when it is
passed commits and range of commits.

While at it, this patch also properly quotes the non range arguments
using the "sq" function.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
2008-12-02 15:29:12 -08:00
Junio C Hamano cb2c7daf52 Merge branch 'cc/bisect'
* cc/bisect:
  bisect: remove "checkout_done" variable used when checking merge bases
  bisect: only check merge bases when needed
  bisect: test merge base if good rev is not an ancestor of bad rev
2008-09-18 20:18:32 -07:00
Nanako Shiraishi 3604e7c5c6 tests: use "git xyzzy" form (t3600 - t6999)
Converts tests between t3600-t6300.

Signed-off-by: Nanako Shiraishi <nanako3@lavabit.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-09-03 14:13:59 -07:00
Christian Couder c9c4e2d5a2 bisect: only check merge bases when needed
When one good revision is not an ancestor of the bad revision, the
merge bases between the good and the bad revision should be checked
to make sure that they are also good revisions.

A previous patch takes care of that, but it may check the merge bases
more often than really needed. In fact the previous patch did not try
to optimize this as much as possible because it is not so simple. So
this is the purpose of this patch.

One may think that when all the merge bases have been checked then
we can save a flag, so that we don't need to check the merge bases
again during the bisect process.

The problem is that the user may choose to checkout and test
something completely different from what the bisect process
suggested. In this case we have to check the merge bases again,
because there may be new merge bases relevant to the bisect
process.

That's why, in this patch, when we detect that the user tested
something else than what the bisect process suggested, we remove
the flag that says that we don't need to check the merge bases
again.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-27 18:08:06 -07:00
Christian Couder f821d08921 bisect: test merge base if good rev is not an ancestor of bad rev
Before this patch, "git bisect", when it was given some good revs that
are not ancestor of the bad rev, didn't check if the merge bases were
good. "git bisect" just supposed that the user knew what he was doing,
and that, when he said the revs were good, he knew that it meant that
all the revs in the history leading to the good revs were also
considered good.

But in pratice, the user may not know that a good rev is not an
ancestor of the bad rev, or he may not know/remember that all revs
leading to the good rev will be considered good. So he may give a good
rev that is a sibling, instead of an ancestor, of the bad rev, when in
fact there can be one rev becoming good in the branch of the good rev
(because the bug was already fixed there, for example) instead of one
rev becoming bad in the branch of the bad rev.

For example, if there is the following history:

    A--B--C--D
	\
	 E--F

and we launch "git bisect start D F" then only C and D would have been
considered as possible first bad commit before this patch. This could
invite user errors; F could be the commit that fixes the bug that exists
everywhere else.

The purpose of this patch is to detect when "git bisect" is passed
some good revs that are not ancestors of the bad rev, and then to first
ask the user to test the merge bases between the good and bad revs.

If the merge bases are good then all is fine, we can continue
bisecting. Otherwise, if one merge base is bad, it means that the
assumption that all revs leading to the good one are good too is
wrong and we error out. In the case where one merge base is skipped we
issue a warning and then continue bisecting anyway.

These checks will also catch the case where good and bad have been
mistaken. This means that we can remove the check that was done latter
on the output of "git rev-list --bisect-vars".

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-08-27 18:08:04 -07:00
Jonathan Nieder b890fa33a4 t6030 (bisect): work around Mac OS X "ls"
t6030-bisect-porcelain.sh relies on "ls" exiting with nonzero
status when asked to list nonexistent files.  Unfortunately,
/bin/ls on Mac OS X 10.3 exits with exit code 0.  So look at
its output instead.

Signed-off-by: Jonathan Nieder <jrnieder@uchicago.edu>
Acked-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-07-27 14:14:01 -07:00
Christian Couder 634f246444 bisect: use a detached HEAD to bisect
When "git bisect" was first written, it was not possible to
checkout a detached HEAD. The detached feature appeared latter.

That's why before this patch the "git bisect" process used a
"bisect" branch to checkout new revisions to be tested (and also
a "new-bisect" one to check if the checkouts could work).

This patch makes "git bisect" checkout revisions to be tested on
a detached HEAD. This simplifies the code a bit.

The tests to check that "git bisect" does not start if a
"bisect" or a "new-bisect" branch exists are removed as they
are not relevant any more.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-22 22:45:03 -07:00
Christian Couder ba963de859 bisect: trap critical errors in "bisect_start"
Before this patch, when using "git bisect start" with mistaken revs
or when the checkout of the branch we want to test failed, we exited
after having written files like ".git/BISECT_START",
".git/BISECT_NAMES" and after having written "refs/bisect/bad" and
"refs/bisect/good-*" refs.

With this patch we trap all errors that can happen when writing the
new state and when we are in "bisect_next". So that we can try to
clean up everything in case of problems, using "bisect_clean_state".

This patch also contains a "bisect_write" cleanup to make it exit
on error and return 0 otherwise.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-22 22:24:16 -07:00
Christian Couder 9d0cd91c4e bisect: fix left over "BISECT_START" file when starting with junk rev
Before this patch, when using for example:

$ git bisect start <stuff1> <stuff2>

with <stuff1> or <stuff2> that cannot be parsed as a revision, we
could leave a ".git/BISECT_START" file, from a previous
"git bisect start", alone.

This patch makes sure that it does not happen by removing the
"BISECT_START" file in "bisect_clean_state" and then always writing
it again at the end of "bisect_start".

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-22 22:16:45 -07:00
Christian Couder d3aca58562 bisect: add test cases to check that "git bisect start" is atomic
This patch adds some test cases to check that "git bisect start"
doesn't leave us in a bad state, especially when it fails.

These test cases show that "git bisect start" is not atomic when it
fails and leave some files like .git/BISECT_START, and in some
cases some refs, over.

The test failures should be fixed in latter commits.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-22 22:01:27 -07:00
Christian Couder 42ba5ee776 bisect: print an error message when "git rev-list --bisect-vars" fails
Before this patch no error was printed when "git rev-list --bisect-vars"
failed. This can happen when bad and good revs are mistaken.

This patch prints an error message on stderr that describe the likely
failure cause.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-08 17:50:00 -07:00
Gerrit Pape ee831f7ddf git-bisect.sh: don't accidentally override existing branch "bisect"
If a branch named "bisect" or "new-bisect" already was created in the
repo by other means than git bisect, doing a git bisect used to override
the branch without a warning.  Now if the branch "bisect" or
"new-bisect" already exists, and it was not created by git bisect itself,
git bisect start fails with an appropriate error message.  Additionally,
if checking out a new bisect state fails due to a merge problem, git
bisect cleans up the temporary branch "new-bisect".

The accidental override has been noticed by Andres Salomon, reported
through
 http://bugs.debian.org/478647

Signed-off-by: Gerrit Pape <pape@smarden.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-05-05 17:18:20 -07:00
Junio C Hamano 464509f790 Merge branch 'maint-1.5.4' into maint
* maint-1.5.4:
  git-bisect: make "start", "good" and "skip" succeed or fail atomically
  git-am: cope better with an empty Subject: line
  Ignore leading empty lines while summarizing merges
  bisect: squelch "fatal: ref HEAD not a symref" misleading message
  builtin-apply: Show a more descriptive error on failure when opening a patch
  Clarify documentation of git-cvsserver, particularly in relation to git-shell
2008-04-16 00:37:33 -07:00
Christian Couder d3e54c8829 git-bisect: make "start", "good" and "skip" succeed or fail atomically
Before this patch, when "git bisect start", "git bisect good" or
"git bisect skip" were called with many revisions, they could fail
after having already marked some revisions as "good", "bad" or
"skip".

This could be especilally bad for "git bisect start" because as
the file ".git/BISECT_NAMES" would not have been written, there
would have been no attempt to clear the marked revisions on a
"git bisect reset". That's because if there is no
".git/BISECT_NAMES" file, nothing is done to clean things up, as
the bisect session is not supposed to have started.

While at it, let's also create the ".git/BISECT_START" file, only
after ".git/BISECT_NAMES" as been created.

Signed-off-by: Christian Couder <chriscool@tuxfamily.org>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
2008-04-16 00:11:37 -07:00