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

Re: [PATCH v10 7/7] bisect: allow any terms set by user

From
Matthieu Moy <matthieu.moy@grenoble-inp.fr>
Date
Jun 26, 2015, 20:59 UTC
Message-ID
<vpq7fqqqj7f.fsf@anie.imag.fr>
In-Reply-To
<CAP8UFD1Donr4v3Z8bpawv0_heDUQ+-EkepZF6UvuXOed7TQBXA@mail.gmail.com>
Christian Couder <christian.couder@gmail.com> writes:
Show 11 quoted lines
> On Fri, Jun 26, 2015 at 6:58 PM, Matthieu Moy <Matthieu.Moy@imag.fr> wrote:
>> From: Antoine Delaite <antoine.delaite@ensimag.grenoble-inp.fr>
>>
>> Introduction of the git bisect terms command. The user can set his own
>> terms. It will work exactly like before. The terms must be set before the
>> start.
>
> After looking a bit at the code, I think that for now existing
> predefined terms ("bad", "good", "new" and "old") as well as some
> other terms that look like bisect subcommands like "skip", "start" and
> "terms" should be disallowed as arguments to "git bisect terms",

More importantly, subcommands should be disallowed, or the user may completely break bisect (e.g. running 'git bisect terms reset bar' prevents you from running 'git bisect reset' later).

And they should be different, or some more funny situation will occur.
I've just squashed this into my last patch:
diff --git a/git-bisect.sh b/git-bisect.sh
index cf07a91..f6be218 100755
--- a/git-bisect.sh
+++ b/git-bisect.sh
@@ -607,9 +607,21 @@ bisect_terms () {
 			gettextln "Your current terms are $NAME_GOOD for the old state
 and $NAME_BAD for the new state."
 		else
-			die "$(gettext "No terms defined.")"
+			die "$(gettext "no terms defined")"
 		fi ;;
 	2)
+		for term in "$@"
+		do
+			case "$term" in
+				help|start|bad|good|new|old|terms|skip|next|reset|visualize|replay|log|run)
+				die "$(eval_gettext "can't use the builtin command '\$term' as a term")"
+				;;
+			esac
+		done
+		if test "$1" = "$2"
+		then
+			die "$(gettext "please use two different terms")"
+		fi
 		if ! test -s "$GIT_DIR/BISECT_START"
 		then
 			write_terms "$1" "$2"
diff --git a/t/t6030-bisect-porcelain.sh b/t/t6030-bisect-porcelain.sh
index eb8cc80..5a7243b 100755
--- a/t/t6030-bisect-porcelain.sh
+++ b/t/t6030-bisect-porcelain.sh
@@ -852,7 +852,7 @@ test_expect_success 'bisect terms needs 0 or 2 arguments' '
 	test_must_fail git bisect terms only-one &&
 	test_must_fail git bisect terms 1 2 3 &&
 	test_must_fail git bisect terms 2>actual &&
-	echo "No terms defined." >expected &&
+	echo "no terms defined" >expected &&
 	test_cmp expected actual
 '
 
Updated my GitHub branch, but I'll stop spamming the list with git
send-email for a while ;-).
-- 
Matthieu Moy
http://www-verimag.imag.fr/~moy/
Previous: Christian Couder
Message 38 of 38 in “bisect terms”
  1. 0/7 bisect termsMatthieu Moy, Jun 26, 2015
  2. 1/7 bisect: correction of typoMatthieu Moy, Jun 26, 2015
  3. 2/7 Documentation/bisect: move getting help section to the endMatthieu Moy, Jun 26, 2015
  4. 3/7 Documentation/bisect: revise overall contentMatthieu Moy, Jun 26, 2015
  5. 4/7 bisect: replace hardcoded "bad|good" by variablesMatthieu Moy, Jun 26, 2015
  6. 5/7 bisect: simplify the addition of new bisect termsMatthieu Moy, Jun 26, 2015
  7. Christian CouderJun 26, 2015
  8. 5/7 bisect: simplify the addition of new bisect termsMatthieu Moy, Jun 26, 2015
  9. Junio C HamanoJun 26, 2015
  10. Matthieu MoyJun 26, 2015
  11. 6/7 bisect: add the terms old/newMatthieu Moy, Jun 26, 2015
  12. 7/7 bisect: allow any terms set by userMatthieu Moy, Jun 26, 2015
  13. Junio C HamanoJun 26, 2015
  14. 7/7 bisect: allow any terms set by userMatthieu Moy, Jun 26, 2015
  15. Junio C HamanoJun 26, 2015
  16. Christian CouderJun 27, 2015
  17. Junio C HamanoJun 27, 2015
  18. Christian CouderJun 27, 2015
  19. Matthieu MoyJun 27, 2015
  20. Junio C HamanoJun 27, 2015
  21. Matthieu MoyJun 29, 2015
  22. Junio C HamanoJun 29, 2015
  23. Michael HaggertyJun 28, 2015
  24. Junio C HamanoJun 28, 2015
  25. Michael HaggertyJun 28, 2015
  26. Junio C HamanoJun 28, 2015
  27. Michael HaggertyJun 28, 2015
  28. Junio C HamanoJun 28, 2015
  29. Matthieu MoyJun 29, 2015
  30. Junio C HamanoJun 29, 2015
  31. Christian CouderJun 29, 2015
  32. Matthieu MoyJun 29, 2015
  33. Christian CouderJun 29, 2015
  34. Matthieu MoyJun 29, 2015
  35. Christian CouderJun 29, 2015
  36. Matthieu MoyJun 29, 2015
  37. Christian CouderJun 26, 2015
  38. Matthieu MoyJun 26, 2015

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.