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

js/use-builtin-add-i (was Re: What's cooking in git.git (Feb 2022, #03; Sat, 12))

From
PWPhillip Wood <phillip.wood123@gmail.com>
Date
Feb 15, 2022, 16:24 UTC
Message-ID
<005d5f82-ae13-992a-3df9-2738f348e01e@gmail.com>
In-Reply-To
<xmqq5ypj6rw6.fsf@gitster.g>
Show 15 quoted lines
> * js/use-builtin-add-i (2021-12-01) 2 commits
>   - add -i: default to the built-in implementation
>   - t2016: require the PERL prereq only when necessary
> 
>   "git add -i" was rewritten in C some time ago and has been in
>   testing; the reimplementation is now exposed to general public by
>   default.
> 
>   On hold.
> 
>   What's the status of the "known breakage"?
>   Are we ready to switch if we wanted to?
>   There are known breakages on macOS.
>   cf. <nycvar.QRO.7.76.6.2112021832060.63@tvgsbejvaqbjf.bet>
>   source: <pull.1087.git.1638281655.gitgitgadget@gmail.com>
[disclaimer: I don't have access to a mac so this is based on web searches]

As I understand it the breakage is that we don't handle escape sequences properly on macos and a key that emits an escape sequence may be interpreted as a different key and confuse the user. However there is no way to remap the keys used by "add -p" and we don't use any keys that emit escape sequences.

On my linux laptop the builtin "add -p" recognizes "F2" as "Q" so there is another bug with the escape sequence handling that is not macos specific (the perl version reads the escape sequence correctly).

The macos problem is caused by poll() not working with stdin as it is a device (see bugs in [1]). It is possible to use select() instead and this is what libuv does[2]. Looking at the result of "git grep 'poll('" we never poll more than three file descriptors so we could add a git_poll() function in compat/ which uses select() and add

#ifdef __APPLE__ #define poll(fds, nfds, timeout) git_poll(fds, nfds, timeout) #endif

to git-compat-util.h

I haven't looked at what's causing the problem with "F2" being recognized as "Q" yet. That and the macos problem feel like fairly minor regressions as they only affect keys that we do not use.

Best Wishes
Phillip

[1] https://developer.apple.com/library/archive/documentation/System/Conceptual/ManPages_iPhoneOS/man2/poll.2.html

[2] https://github.com/libuv/libuv/commit/731adacad2426d349d4c51ca608184f7e01c93c6

Previous: Junio C Hamano
Message 6 of 6 in “What's cooking in git.git (Feb 2022, #03; Sat, 12)”
  1. Junio C HamanoFeb 13, 2022
  2. Jonathan TanFeb 14, 2022
  3. Junio C HamanoFeb 14, 2022
  4. Chen BoJunFeb 15, 2022
  5. Junio C HamanoFeb 15, 2022
  6. js/use-builtin-add-i (was Re: What's cooking in git.git (Feb 2022, #03; Sat, 12))Phillip Wood, Feb 15, 2022

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.