Skip to content

fix "v"iew subcommand in "git am -i"

Junio C Hamano git 2 versions In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest3 patches 1 replyIn review
  2. v13 patches 3 repliesSuperseded

Patches in v2 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/3pager: lose a separate argv[]pager.c+1 -30 replies
2/3pager: factor out a helper to prepare a child process to run the pagercache.h pager.c+14 -60 replies
3/3am -i: fix "v"iewbuiltin/am.c+1 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [PATCH v2 0/3] fix "v"iew subcommand in "git am -i"

The 'v'iew subcommand of the interactive mode of "git am -i" was broken by the rewrite to C we did at around 2.6.0 timeframe at 7ff26832 (builtin-am: implement -i/--interactive, 2015-08-04); we used to spawn the pager via the shell, accepting things like

	PAGER='less -S'

in the environment, but the rewrite forgot and tried to directly spawn a command whose name is the entire string.

The bug is understandable, because there are things we need to do other than just run_command() to run the pager, such as running it with default LESS/LV settings and running it via the shell, but these pieces of necessary knowledge about what is the right thing to do are hoarded by the setup_pager() entry point, which is only good if we are feeding our own standard output to the pager. A codepath that wants to run the pager but not on our output needs to do the right thing on its own.

So the first patch in this series factors out a helper function to let the caller run the pager the right way. They make the third patch to fix the breakage in "am" trivial. Compared to v1, the helper was much simplified with help by Peff: it always and only takes child-process and the pager command string. The caller can append extra command line arguments after the helper returns if it wants to.

Junio C Hamano (3):
pager: lose a separate argv[]
pager: factor out a helper to prepare a child process to run the pager am -i: fix "v"iew

 builtin/am.c |  2 +-
 cache.h      |  3 +++
 pager.c      | 19 +++++++++++--------
 3 files changed, 15 insertions(+), 9 deletions(-)
Signature · 1 line
2.7.1-489-g20b2cbe