git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jon Seymour <jon.seymour@gmail.com>
To: git@vger.kernel.org
Cc: gitster@pobox.com, chriscool@tuxfamily.org, j6t@kdbg.org,
	jnareb@gmail.com, jrnieder@gmail.com,
	Jon Seymour <jon.seymour@gmail.com>
Subject: [PATCH 1/3] bisect: relax requirement for a working tree.
Date: Sun,  7 Aug 2011 20:50:38 +1000	[thread overview]
Message-ID: <1312714240-23647-2-git-send-email-jon.seymour@gmail.com> (raw)
In-Reply-To: <1312714240-23647-1-git-send-email-jon.seymour@gmail.com>

Now that bisection does not require checkout, it can work
on bare repositories too.

In this case, we default the checkout mode to --no-checkout,
thereby forcing the creation of BISECT_HEAD on either a manual
or automatic start.

The require_work_tree check in git-bisect.sh and the NEED_WORK_TREE
check in git.c are relaxed.

Suggested-by: Junio C Hamano <gitster@pobox.com>
Signed-off-by: Jon Seymour <jon.seymour@gmail.com>
---
 git-bisect.sh |    8 ++++++--
 git.c         |    2 +-
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/git-bisect.sh b/git-bisect.sh
index 22c4da5..436cc07 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -29,7 +29,6 @@ Please use "git help bisect" to get the full man page.'
 OPTIONS_SPEC=
 . git-sh-setup
 . git-sh-i18n
-require_work_tree
 
 _x40='[0-9a-f][0-9a-f][0-9a-f][0-9a-f][0-9a-f]'
 _x40="$_x40$_x40$_x40$_x40$_x40$_x40$_x40$_x40"
@@ -79,7 +78,12 @@ bisect_start() {
 	orig_args=$(git rev-parse --sq-quote "$@")
 	bad_seen=0
 	eval=''
-	mode=''
+	if test "z$(git rev-parse --is-bare-repository)" != "zfalse"
+	then
+		mode='--no-checkout'
+	else
+		mode=''
+	fi
 	while [ $# -gt 0 ]; do
 		arg="$1"
 		case "$arg" in
diff --git a/git.c b/git.c
index 8828c18..7fdcab2 100644
--- a/git.c
+++ b/git.c
@@ -320,7 +320,7 @@ static void handle_internal_command(int argc, const char **argv)
 		{ "annotate", cmd_annotate, RUN_SETUP },
 		{ "apply", cmd_apply, RUN_SETUP_GENTLY },
 		{ "archive", cmd_archive },
-		{ "bisect--helper", cmd_bisect__helper, RUN_SETUP | NEED_WORK_TREE },
+		{ "bisect--helper", cmd_bisect__helper, RUN_SETUP },
 		{ "blame", cmd_blame, RUN_SETUP },
 		{ "branch", cmd_branch, RUN_SETUP },
 		{ "bundle", cmd_bundle, RUN_SETUP_GENTLY },
-- 
1.7.6.363.g9b380.dirty

  reply	other threads:[~2011-08-07 10:51 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-07 10:50 [PATCH 0/3] bisect: add support for bisecting bare repositories Jon Seymour
2011-08-07 10:50 ` Jon Seymour [this message]
2011-08-07 12:41   ` test z$foo = zbar (and Re: [PATCH 1/3] bisect: relax requirement for a working tree.) Jonathan Nieder
2011-08-07 12:51     ` Jon Seymour
2011-08-07 13:04     ` Stefano Lattarini
2011-08-07 14:10       ` Jonathan Nieder
2011-08-07 14:40   ` [PATCH 1/3] bisect: relax requirement for a working tree Jon Seymour
2011-08-07 10:50 ` [PATCH 2/3] bisect: add tests for bisection on bare repositories Jon Seymour
2011-08-07 13:39   ` Jonathan Nieder
2011-08-07 14:39     ` Jon Seymour
2011-08-07 10:50 ` [PATCH 3/3] bisect: document that --no-checkout is the default for " Jon Seymour
2011-08-07 13:43   ` Jonathan Nieder

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=1312714240-23647-2-git-send-email-jon.seymour@gmail.com \
    --to=jon.seymour@gmail.com \
    --cc=chriscool@tuxfamily.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --cc=j6t@kdbg.org \
    --cc=jnareb@gmail.com \
    --cc=jrnieder@gmail.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.
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).