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

Re: [PATCH 2/2] add-patch: quit on EOF

From
Junio C Hamano <gitster@pobox.com>
Date
Oct 26, 2025, 00:37 UTC
Message-ID
<xmqqjz0imrax.fsf@gitster.g>
In-Reply-To
<06b8485e-1e64-4c57-be3a-34b1f900c526@web.de>
René Scharfe <l.s.r@web.de> writes:
Show 14 quoted lines
> On 10/25/25 6:20 PM, Junio C Hamano wrote:
>> 
>> I wonder if we want to 'echo" something in this case, though.  If I
>> say 'q', whether interactive.singlekey is active or not, I see
>> 
>>     (1/1) Stage this hunk [y,n,q,a,d,s,e,p,P,?]? q
>> 
>> on the last line before getting the shell prompt back.  With this
>> change, I won't see anything after the prompt.  Perhaps it is OK?  I
>> dunno.  Perhaps we want to pretend as if 'q' were given instead of
>> EOF, like the following?  I dunno.
> I'm used to no feedback when writing to a file using cat and finishing
> with ctrl-D to signal end-of-file.  So I don't need a q "echoed", and
> would actually be slightly surprised.  But that's just me.

I do not have a strong preference either way myself. It just looked a bit abrupt the way the session transcript ends, when it gets shut down with ctrl-D, but after all it is a shutdown, so it may be more natural that way ;-).

I am kind of surprised that this EOF behaviour has not been brought up until now, and your patch did not have to touch expected output of existing tests (certainly they are taking prepackaged series of commands but I would not imagine all the previous test authors are careful enough to end their tests with 'q'). Perhaps we do not have enough multi-hunk and/or multi-file tests on "git add -p" and when the tests react to EOF they were already at the "final" hunk of the "final" file and nobody noticed the unnecessary output to skip all the remaining hunks and files, perhaps.

Previous: René ScharfeNext: Junio C Hamano
Message 5 of 8 in “add-patch: quit without skipping undecided hunks”
  1. 1/2 add-patch: quit without skipping undecided hunksRené Scharfe, Oct 25, 2025
  2. 2/2 add-patch: quit on EOFRené Scharfe, Oct 25, 2025
  3. Junio C HamanoOct 25, 2025
  4. René ScharfeOct 25, 2025
  5. Junio C HamanoOct 26, 2025
  6. Junio C HamanoOct 26, 2025
  7. René ScharfeOct 26, 2025
  8. Junio C HamanoOct 25, 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.