From: David Turner <dturner@twopensource.com>
To: git@vger.kernel.org, mhagger@alum.mit.edu,
chriscool@tuxfamily.org, pclouds@gmail.com
Cc: David Turner <dturner@twopensource.com>
Subject: [PATCH v3 4/4] bisect: make bisection refs per-worktree
Date: Wed, 12 Aug 2015 17:57:25 -0400 [thread overview]
Message-ID: <1439416645-19173-4-git-send-email-dturner@twopensource.com> (raw)
In-Reply-To: <1439416645-19173-1-git-send-email-dturner@twopensource.com>
Using the new refs/worktree/ refs, make bisection per-worktree.
Signed-off-by: David Turner <dturner@twopensource.com>
---
Documentation/git-bisect.txt | 4 ++--
Documentation/rev-list-options.txt | 14 +++++++-------
bisect.c | 2 +-
builtin/rev-parse.c | 6 ++++--
git-bisect.sh | 14 +++++++-------
revision.c | 2 +-
t/t6030-bisect-porcelain.sh | 20 ++++++++++----------
7 files changed, 32 insertions(+), 30 deletions(-)
diff --git a/Documentation/git-bisect.txt b/Documentation/git-bisect.txt
index e97f2de..f0c52d1 100644
--- a/Documentation/git-bisect.txt
+++ b/Documentation/git-bisect.txt
@@ -82,7 +82,7 @@ to ask for the next commit that needs testing.
Eventually there will be no more revisions left to inspect, and the
command will print out a description of the first bad commit. The
-reference `refs/bisect/bad` will be left pointing at that commit.
+reference `refs/worktree/bisect/bad` will be left pointing at that commit.
Bisect reset
@@ -373,7 +373,7 @@ on a single line.
------------
$ git bisect start HEAD <known-good-commit> [ <boundary-commit> ... ] --no-checkout
$ git bisect run sh -c '
- GOOD=$(git for-each-ref "--format=%(objectname)" refs/bisect/good-*) &&
+ GOOD=$(git for-each-ref "--format=%(objectname)" refs/worktree/bisect/good-*) &&
git rev-list --objects BISECT_HEAD --not $GOOD >tmp.$$ &&
git pack-objects --stdout >/dev/null <tmp.$$
rc=$?
diff --git a/Documentation/rev-list-options.txt b/Documentation/rev-list-options.txt
index a9b808f..1175960 100644
--- a/Documentation/rev-list-options.txt
+++ b/Documentation/rev-list-options.txt
@@ -183,9 +183,9 @@ explicitly.
ifndef::git-rev-list[]
--bisect::
- Pretend as if the bad bisection ref `refs/bisect/bad`
+ Pretend as if the bad bisection ref `refs/worktree/bisect/bad`
was listed and as if it was followed by `--not` and the good
- bisection refs `refs/bisect/good-*` on the command
+ bisection refs `refs/worktree/bisect/good-*` on the command
line. Cannot be combined with --first-parent.
endif::git-rev-list[]
@@ -548,10 +548,10 @@ Bisection Helpers
--bisect::
Limit output to the one commit object which is roughly halfway between
included and excluded commits. Note that the bad bisection ref
- `refs/bisect/bad` is added to the included commits (if it
- exists) and the good bisection refs `refs/bisect/good-*` are
+ `refs/worktree/bisect/bad` is added to the included commits (if it
+ exists) and the good bisection refs `refs/worktree/bisect/good-*` are
added to the excluded commits (if they exist). Thus, supposing there
- are no refs in `refs/bisect/`, if
+ are no refs in `refs/worktree/bisect/`, if
+
-----------------------------------------------------------------------
$ git rev-list --bisect foo ^bar ^baz
@@ -571,7 +571,7 @@ one. Cannot be combined with --first-parent.
--bisect-vars::
This calculates the same as `--bisect`, except that refs in
- `refs/bisect/` are not used, and except that this outputs
+ `refs/worktree/bisect/` are not used, and except that this outputs
text ready to be eval'ed by the shell. These lines will assign the
name of the midpoint revision to the variable `bisect_rev`, and the
expected number of commits to be tested after `bisect_rev` is tested
@@ -584,7 +584,7 @@ one. Cannot be combined with --first-parent.
--bisect-all::
This outputs all the commit objects between the included and excluded
commits, ordered by their distance to the included and excluded
- commits. Refs in `refs/bisect/` are not used. The farthest
+ commits. Refs in `refs/worktree/bisect/` are not used. The farthest
from them is displayed first. (This is the only one displayed by
`--bisect`.)
+
diff --git a/bisect.c b/bisect.c
index 33ac88d..dbe3461 100644
--- a/bisect.c
+++ b/bisect.c
@@ -425,7 +425,7 @@ static int register_ref(const char *refname, const struct object_id *oid,
static int read_bisect_refs(void)
{
- return for_each_ref_in("refs/bisect/", register_ref, NULL);
+ return for_each_ref_in("refs/worktree/bisect/", register_ref, NULL);
}
static void read_bisect_paths(struct argv_array *array)
diff --git a/builtin/rev-parse.c b/builtin/rev-parse.c
index 02d747d..3240ddf 100644
--- a/builtin/rev-parse.c
+++ b/builtin/rev-parse.c
@@ -663,8 +663,10 @@ int cmd_rev_parse(int argc, const char **argv, const char *prefix)
continue;
}
if (!strcmp(arg, "--bisect")) {
- for_each_ref_in("refs/bisect/bad", show_reference, NULL);
- for_each_ref_in("refs/bisect/good", anti_reference, NULL);
+ for_each_ref_in("refs/worktree/bisect/bad",
+ show_reference, NULL);
+ for_each_ref_in("refs/worktree/bisect/good",
+ anti_reference, NULL);
continue;
}
if (starts_with(arg, "--branches=")) {
diff --git a/git-bisect.sh b/git-bisect.sh
index ea63223..c16433d 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -210,7 +210,7 @@ bisect_write() {
*)
die "$(eval_gettext "Bad bisect_write argument: \$state")" ;;
esac
- git update-ref "refs/bisect/$tag" "$rev" || exit
+ git update-ref "refs/worktree/bisect/$tag" "$rev" || exit
echo "# $state: $(git show-branch $rev)" >>"$GIT_DIR/BISECT_LOG"
test -n "$nolog" || echo "git bisect $state $rev" >>"$GIT_DIR/BISECT_LOG"
}
@@ -282,8 +282,8 @@ bisect_state() {
bisect_next_check() {
missing_good= missing_bad=
- git show-ref -q --verify refs/bisect/$TERM_BAD || missing_bad=t
- test -n "$(git for-each-ref "refs/bisect/$TERM_GOOD-*")" || missing_good=t
+ git show-ref -q --verify refs/worktree/bisect/$TERM_BAD || missing_bad=t
+ test -n "$(git for-each-ref "refs/worktree/bisect/$TERM_GOOD-*")" || missing_good=t
case "$missing_good,$missing_bad,$1" in
,,*)
@@ -341,15 +341,15 @@ bisect_next() {
# Check if we should exit because bisection is finished
if test $res -eq 10
then
- bad_rev=$(git show-ref --hash --verify refs/bisect/$TERM_BAD)
+ bad_rev=$(git show-ref --hash --verify refs/worktree/bisect/$TERM_BAD)
bad_commit=$(git show-branch $bad_rev)
echo "# first $TERM_BAD commit: $bad_commit" >>"$GIT_DIR/BISECT_LOG"
exit 0
elif test $res -eq 2
then
echo "# only skipped commits left to test" >>"$GIT_DIR/BISECT_LOG"
- good_revs=$(git for-each-ref --format="%(objectname)" "refs/bisect/$TERM_GOOD-*")
- for skipped in $(git rev-list refs/bisect/$TERM_BAD --not $good_revs)
+ good_revs=$(git for-each-ref --format="%(objectname)" "refs/worktree/bisect/$TERM_GOOD-*")
+ for skipped in $(git rev-list refs/worktree/bisect/$TERM_BAD --not $good_revs)
do
skipped_commit=$(git show-branch $skipped)
echo "# possible first $TERM_BAD commit: $skipped_commit" >>"$GIT_DIR/BISECT_LOG"
@@ -412,7 +412,7 @@ Try 'git bisect reset <commit>'.")"
bisect_clean_state() {
# There may be some refs packed during bisection.
- git for-each-ref --format='%(refname) %(objectname)' refs/bisect/\* |
+ git for-each-ref --format='%(refname) %(objectname)' refs/worktree/bisect/\* |
while read ref hash
do
git update-ref -d $ref $hash || exit
diff --git a/revision.c b/revision.c
index b6b2cf7..974a11f 100644
--- a/revision.c
+++ b/revision.c
@@ -2084,7 +2084,7 @@ extern void read_bisect_terms(const char **bad, const char **good);
static int for_each_bisect_ref(const char *submodule, each_ref_fn fn, void *cb_data, const char *term) {
struct strbuf bisect_refs = STRBUF_INIT;
int status;
- strbuf_addf(&bisect_refs, "refs/bisect/%s", term);
+ strbuf_addf(&bisect_refs, "refs/worktree/bisect/%s", term);
status = for_each_ref_in_submodule(submodule, bisect_refs.buf, fn, cb_data);
strbuf_release(&bisect_refs);
return status;
diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh
index 9e2c203..bfd5463 100755
--- a/t/t6030-bisect-porcelain.sh
+++ b/t/t6030-bisect-porcelain.sh
@@ -68,7 +68,7 @@ test_expect_success 'bisect fails if given any junk instead of revs' '
git bisect reset &&
test_must_fail git bisect start foo $HASH1 -- &&
test_must_fail git bisect start $HASH4 $HASH1 bar -- &&
- test -z "$(git for-each-ref "refs/bisect/*")" &&
+ test -z "$(git for-each-ref "refs/worktree/bisect/*")" &&
test -z "$(ls .git/BISECT_* 2>/dev/null)" &&
git bisect start &&
test_must_fail git bisect good foo $HASH1 &&
@@ -77,7 +77,7 @@ test_expect_success 'bisect fails if given any junk instead of revs' '
test_must_fail git bisect bad $HASH3 $HASH4 &&
test_must_fail git bisect skip bar $HASH3 &&
test_must_fail git bisect skip $HASH1 foo &&
- test -z "$(git for-each-ref "refs/bisect/*")" &&
+ test -z "$(git for-each-ref "refs/worktree/bisect/*")" &&
git bisect good $HASH1 &&
git bisect bad $HASH4
'
@@ -115,7 +115,7 @@ test_expect_success 'bisect reset removes packed refs' '
git pack-refs --all --prune &&
git bisect next &&
git bisect reset &&
- test -z "$(git for-each-ref "refs/bisect/*")" &&
+ test -z "$(git for-each-ref "refs/worktree/bisect/*")" &&
test -z "$(git for-each-ref "refs/heads/bisect")"
'
@@ -126,7 +126,7 @@ test_expect_success 'bisect reset removes bisect state after --no-checkout' '
git bisect bad $HASH3 &&
git bisect next &&
git bisect reset &&
- test -z "$(git for-each-ref "refs/bisect/*")" &&
+ test -z "$(git for-each-ref "refs/worktree/bisect/*")" &&
test -z "$(git for-each-ref "refs/heads/bisect")" &&
test -z "$(git for-each-ref "BISECT_HEAD")"
'
@@ -176,7 +176,7 @@ test_expect_success 'bisect start: no ".git/BISECT_START" if checkout error' '
git branch > branch.output &&
grep "* other" branch.output > /dev/null &&
test_must_fail test -e .git/BISECT_START &&
- test -z "$(git for-each-ref "refs/bisect/*")" &&
+ test -z "$(git for-each-ref "refs/worktree/bisect/*")" &&
git checkout HEAD hello
'
@@ -671,7 +671,7 @@ test_expect_success 'bisect: --no-checkout - target before breakage' '
git bisect bad BISECT_HEAD &&
check_same BROKEN_HASH5 BISECT_HEAD &&
git bisect bad BISECT_HEAD &&
- check_same BROKEN_HASH5 bisect/bad &&
+ check_same BROKEN_HASH5 refs/worktree/bisect/bad &&
git bisect reset
'
@@ -682,7 +682,7 @@ test_expect_success 'bisect: --no-checkout - target in breakage' '
git bisect bad BISECT_HEAD &&
check_same BROKEN_HASH5 BISECT_HEAD &&
git bisect good BISECT_HEAD &&
- check_same BROKEN_HASH6 bisect/bad &&
+ check_same BROKEN_HASH6 refs/worktree/bisect/bad &&
git bisect reset
'
@@ -693,7 +693,7 @@ test_expect_success 'bisect: --no-checkout - target after breakage' '
git bisect good BISECT_HEAD &&
check_same BROKEN_HASH8 BISECT_HEAD &&
git bisect good BISECT_HEAD &&
- check_same BROKEN_HASH9 bisect/bad &&
+ check_same BROKEN_HASH9 refs/worktree/bisect/bad &&
git bisect reset
'
@@ -702,13 +702,13 @@ test_expect_success 'bisect: demonstrate identification of damage boundary' "
git checkout broken &&
git bisect start broken master --no-checkout &&
git bisect run \"\$SHELL_PATH\" -c '
- GOOD=\$(git for-each-ref \"--format=%(objectname)\" refs/bisect/good-*) &&
+ GOOD=\$(git for-each-ref \"--format=%(objectname)\" refs/worktree/bisect/good-*) &&
git rev-list --objects BISECT_HEAD --not \$GOOD >tmp.\$\$ &&
git pack-objects --stdout >/dev/null < tmp.\$\$
rc=\$?
rm -f tmp.\$\$
test \$rc = 0' &&
- check_same BROKEN_HASH6 bisect/bad &&
+ check_same BROKEN_HASH6 refs/worktree/bisect/bad &&
git bisect reset
"
--
2.0.4.315.gad8727a-twtrsrc
next prev parent reply other threads:[~2015-08-12 21:58 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-12 21:57 [PATCH v3 1/4] refs: clean up common_list David Turner
2015-08-12 21:57 ` [PATCH v3 2/4] path: optimize common dir checking David Turner
2015-08-12 22:48 ` Junio C Hamano
2015-08-13 9:05 ` Michael Haggerty
2015-08-14 17:04 ` Junio C Hamano
2015-08-14 20:04 ` David Turner
2015-08-14 20:27 ` Junio C Hamano
2015-08-14 20:54 ` David Turner
2015-08-15 18:20 ` Michael Haggerty
2015-08-15 18:12 ` Michael Haggerty
2015-08-17 15:55 ` Junio C Hamano
2015-08-15 7:59 ` Duy Nguyen
2015-08-16 5:04 ` David Turner
2015-08-16 12:20 ` Duy Nguyen
2015-08-12 21:57 ` [PATCH v3 3/4] refs: make refs/worktree/* per-worktree David Turner
2015-08-13 17:15 ` Eric Sunshine
2015-08-13 17:41 ` David Turner
2015-08-13 20:16 ` Michael Haggerty
2015-08-13 20:32 ` David Turner
2015-08-14 8:18 ` Michael Haggerty
2015-08-14 17:10 ` Junio C Hamano
2015-08-15 8:04 ` Duy Nguyen
2015-08-12 21:57 ` David Turner [this message]
2015-08-15 7:44 ` [PATCH v3 1/4] refs: clean up common_list Duy Nguyen
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=1439416645-19173-4-git-send-email-dturner@twopensource.com \
--to=dturner@twopensource.com \
--cc=chriscool@tuxfamily.org \
--cc=git@vger.kernel.org \
--cc=mhagger@alum.mit.edu \
--cc=pclouds@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.