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

Re: [PATCH v6 8/8] update-ref: add --batch-updates flag for stdin mode

From
Junio C Hamano <gitster@pobox.com>
Date
Apr 8, 2025, 17:37 UTC
Message-ID
<xmqq7c3uy2ps.fsf@gitster.g>
In-Reply-To
<CAOLa=ZT4fOz1sd31EhyLGeyQzS6GO0aSYN0L4fdPALRixkD6xQ@mail.gmail.com>
Karthik Nayak <karthik.188@gmail.com> writes:
Show 20 quoted lines
> Junio C Hamano <gitster@pobox.com> writes:
>
>> Karthik Nayak <karthik.188@gmail.com> writes:
>>
>>> Content-Type: text/plain; charset=y
>>
>> Please don't ;-).
>>
>> More practically, is there something we can do to avoid this
>> happening in send-email?  It may be a not-so-uncommon end user
>> mistake that we would rather help our users avoid.
>>
>
> This seems like this was in response to the following question:
>      Which 8bit encoding should I declare [UTF-8]?
>
> Which I should have just clicked 'Enter' on, but typed 'y' as 'yes
> please pick UTF-8'. Which again confirms the encoding, which I
> presumably didn't read. So I guess the problem Exists Between Keyboard
> and Chair.

OK, we have seen enough people got burned by 'y', and made 852a15d7 (send-email: ask confirmation if given encoding name is very short, 2015-02-13) as a response exactly for that problem, but it is not effective as we wished X-<.

If there were a better validation method than "4 bytes or longer" we currently use for valid values for "charset=$auto_8bit_encoding", we could lose confirm_only from the call to ask() that asks the question, but I do not know if that is feasible.

Another more obvious alternative is to do something ugly like this patch, I suppose? Just like <ENTER> is taken as "I take the default value presented", this makes yes<ENTER> mean the same thing.

There is one question that asks yes/no question with default set to 'n', which would be broken by the patch below, so it needs a bit more thought, though.

 git-send-email.perl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git c/git-send-email.perl w/git-send-email.perl
index 798d59b84f..8b942e5bcf 100755
--- c/git-send-email.perl
+++ w/git-send-email.perl
@@ -986,7 +986,8 @@ sub ask {
 			print "\n";
 			return defined $default ? $default : undef;
 		}
-		if ($resp eq '' and defined $default) {
+		if (defined $default &&
+		    ($resp eq '' || $resp =~ /^y(?:es)$/i)) {
 			return $default;
 		}
 		if (!defined $valid_re or $resp =~ /$valid_re/) {
Previous: Karthik NayakNext: Karthik Nayak
Message 48 of 49 in “refs: introduce support for partial reference transactions”
  1. 0/6 refs: introduce support for partial reference transactionsKarthik Nayak, Feb 7, 2025
  2. 1/6 refs/files: remove duplicate check in `split_symref_update()`Karthik Nayak, Feb 7, 2025
  3. Patrick SteinhardtFeb 7, 2025
  4. Karthik NayakFeb 11, 2025
  5. 2/6 refs: move duplicate refname update check to generic layerKarthik Nayak, Feb 7, 2025
  6. Patrick SteinhardtFeb 7, 2025
  7. Karthik NayakFeb 11, 2025
  8. 3/6 refs/files: remove duplicate duplicates checkKarthik Nayak, Feb 7, 2025
  9. Patrick SteinhardtFeb 7, 2025
  10. 4/6 refs/reftable: extract code from the transaction preparationKarthik Nayak, Feb 7, 2025
  11. 5/6 refs: implement partial reference transaction supportKarthik Nayak, Feb 7, 2025
  12. Patrick SteinhardtFeb 7, 2025
  13. Karthik NayakFeb 21, 2025
  14. 6/6 update-ref: add --allow-partial flag for stdin modeKarthik Nayak, Feb 7, 2025
  15. Patrick SteinhardtFeb 7, 2025
  16. Karthik NayakFeb 21, 2025
  17. Phillip WoodFeb 11, 2025
  18. Phillip WoodFeb 11, 2025
  19. Karthik NayakFeb 12, 2025
  20. Karthik NayakFeb 12, 2025
  21. Phillip WoodFeb 19, 2025
  22. Patrick SteinhardtFeb 19, 2025
  23. Karthik NayakFeb 21, 2025
  24. 0/8 refs: introduce support for batched reference updatesKarthik Nayak, Mar 27, 2025
  25. 1/8 refs/files: remove redundant check in split_symref_update()Karthik Nayak, Mar 27, 2025
  26. 2/8 refs: move duplicate refname update check to generic layerKarthik Nayak, Mar 27, 2025
  27. 3/8 refs/files: remove duplicate duplicates checkKarthik Nayak, Mar 27, 2025
  28. 4/8 refs/reftable: extract code from the transaction preparationKarthik Nayak, Mar 27, 2025
  29. 5/8 refs: introduce enum-based transaction error typesKarthik Nayak, Mar 27, 2025
  30. 6/8 refs: implement batch reference update supportKarthik Nayak, Mar 27, 2025
  31. 7/8 refs: support rejection in batch updates during F/D checksKarthik Nayak, Mar 27, 2025
  32. 8/8 update-ref: add --batch-updates flag for stdin modeKarthik Nayak, Mar 27, 2025
  33. Jean-Noël AVILAMar 28, 2025
  34. Junio C HamanoMar 29, 2025
  35. Karthik NayakMar 29, 2025
  36. Patrick SteinhardtMar 28, 2025
  37. 0/8 refs: introduce support for batched reference updatesKarthik Nayak, Apr 8, 2025
  38. 1/8 refs/files: remove redundant check in split_symref_update()Karthik Nayak, Apr 8, 2025
  39. 2/8 refs: move duplicate refname update check to generic layerKarthik Nayak, Apr 8, 2025
  40. 3/8 refs/files: remove duplicate duplicates checkKarthik Nayak, Apr 8, 2025
  41. 4/8 refs/reftable: extract code from the transaction preparationKarthik Nayak, Apr 8, 2025
  42. 5/8 refs: introduce enum-based transaction error typesKarthik Nayak, Apr 8, 2025
  43. 6/8 refs: implement batch reference update supportKarthik Nayak, Apr 8, 2025
  44. 7/8 refs: support rejection in batch updates during F/D checksKarthik Nayak, Apr 8, 2025
  45. 8/8 update-ref: add --batch-updates flag for stdin modeKarthik Nayak, Apr 8, 2025
  46. Junio C HamanoApr 8, 2025
  47. Karthik NayakApr 8, 2025
  48. Junio C HamanoApr 8, 2025
  49. Karthik NayakApr 10, 2025

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.