mbox series

[0/4] use the pager in 'add -p'

Message ID 2653fb37-c8a8-49b1-a804-4be6654a2cad@gmail.com (mailing list archive)
Headers show
Series use the pager in 'add -p' | expand

Message

Rubén Justo July 12, 2024, 12:57 a.m. UTC
I'm resuming work on introducing a mechanism to use the PAGER to display
hunks during interactive "git add -p" sessions, which will make it
easier to review large hunks.

The thread where the previous discussion took place is:
https://lore.kernel.org/git/1d0cb55c-5f32-419a-b593-d5f0969a51fd@gmail.com/

I'm bringing back the proposal to introduce 'P' as a mechanism to
display the current hunks through the PAGER.

I think it's sensible to exclude from the scope of this series the
option of a new command '|[cmd]' and other modifications to the original
proposal that have raised questions that perhaps deserve their own
discussion, outside the scope of this series.  Questions like:

   - What to do with ANSI codes?
   - How to allow the definition of a default command?
   - How to facilitate the reuse of a command?
   - How to combine a default command with command reuse?
   - What to do if the command fails?

To mention a few...

I'm also leaving for a future series a possible configuration
"interactive.pipeCommand", "interactive.pager" or similar.

I hope this approach makes sense and allows us to move forward, and that
it doesn't represent a step back.

Thanks.

Rubén Justo (4):
  add-patch: test for 'p' command
  pager: do not close fd 2 unnecessarily
  pager: introduce wait_for_pager
  add-patch: render hunks through the pager

 add-patch.c                | 18 ++++++++++--
 pager.c                    | 45 ++++++++++++++++++++++++----
 pager.h                    |  1 +
 t/t3701-add-interactive.sh | 60 ++++++++++++++++++++++++++++++++++++++
 4 files changed, 116 insertions(+), 8 deletions(-)

Comments

Dragan Simic July 12, 2024, 8:56 a.m. UTC | #1
Hello Ruben,

On 2024-07-12 02:57, Rubén Justo wrote:
> I'm resuming work on introducing a mechanism to use the PAGER to 
> display
> hunks during interactive "git add -p" sessions, which will make it
> easier to review large hunks.
> 
> The thread where the previous discussion took place is:
> https://lore.kernel.org/git/1d0cb55c-5f32-419a-b593-d5f0969a51fd@gmail.com/
> 
> I'm bringing back the proposal to introduce 'P' as a mechanism to
> display the current hunks through the PAGER.
> 
> I think it's sensible to exclude from the scope of this series the
> option of a new command '|[cmd]' and other modifications to the 
> original
> proposal that have raised questions that perhaps deserve their own
> discussion, outside the scope of this series.  Questions like:
> 
>    - What to do with ANSI codes?
>    - How to allow the definition of a default command?
>    - How to facilitate the reuse of a command?
>    - How to combine a default command with command reuse?
>    - What to do if the command fails?
> 
> To mention a few...
> 
> I'm also leaving for a future series a possible configuration
> "interactive.pipeCommand", "interactive.pager" or similar.
> 
> I hope this approach makes sense and allows us to move forward, and 
> that
> it doesn't represent a step back.

I find this approach fine.  It would allow us to have this neat feature
available in its initial, simplified form, while the future improvements
would belong to follow-up discussions and patches.

> Rubén Justo (4):
>   add-patch: test for 'p' command
>   pager: do not close fd 2 unnecessarily
>   pager: introduce wait_for_pager
>   add-patch: render hunks through the pager
> 
>  add-patch.c                | 18 ++++++++++--
>  pager.c                    | 45 ++++++++++++++++++++++++----
>  pager.h                    |  1 +
>  t/t3701-add-interactive.sh | 60 ++++++++++++++++++++++++++++++++++++++
>  4 files changed, 116 insertions(+), 8 deletions(-)