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

Re: [PATCH 4/7] commit: fix patch hunk editing with "commit -p -m"

From
Jeff King <peff@peff.net>
Date
Mar 10, 2014, 20:07 UTC
Message-ID
<20140310200756.GC24568@sigill.intra.peff.net>
In-Reply-To
<1394477377-10994-5-git-send-email-benoit.pierre@gmail.com>
On Mon, Mar 10, 2014 at 07:49:34PM +0100, Benoit Pierre wrote:
Show 15 quoted lines
> Don't change git environment: move the GIT_EDITOR=":" override to the
> hook command subprocess, like it's already done for GIT_INDEX_FILE.
> 
> Signed-off-by: Benoit Pierre <benoit.pierre@gmail.com>
> ---
>  builtin/checkout.c                |  8 +++----
>  builtin/clone.c                   |  4 ++--
>  builtin/commit.c                  | 35 ++++++++++++++++++++++++-------
>  builtin/gc.c                      |  2 +-
>  builtin/merge.c                   |  6 +++---
>  commit.h                          |  3 +++
>  run-command.c                     | 44 ++++++++++++++++++++++++++++-----------
>  run-command.h                     |  6 +++++-
>  t/t7513-commit_-p_-m_hunk_edit.sh |  2 +-
>  9 files changed, 79 insertions(+), 31 deletions(-)

This is a lot of change, and in some ways I think it is making things better overall. However, the simplest fix for this is basically to move the setting of GIT_EDITOR down to after we prepare the index.

Jun Hao (cc'd) has been preparing a series for this based on the Bloomberg git hackday a few weeks ago, but it hasn't been sent to the list yet.

Commits are here:
  https://github.com/bloomberg/git/compare/commit-patch-allow-hunk-editing

if you care to look. I'm not sure which solution is technically superior, but it's worth considering both.

I regret not encouraging Jun to post to the list sooner, as we might have avoided some duplicated effort. But that's a sunk cost, and we should pick up whichever is the best for the project.

-Peff
Previous: Benoit PierreNext: Jun Hao
Message 38 of 50 in “fix hunk editing with 'commit -p -m'”
  1. 0/7 fix hunk editing with 'commit -p -m'Benoit Pierre, Mar 10, 2014
  2. 1/7 merge hook tests: fix missing '&&' in testBenoit Pierre, Mar 10, 2014
  3. 2/7 merge hook tests: use 'test_must_fail' instead of '!'Benoit Pierre, Mar 10, 2014
  4. 3/7 test patch hunk editing with "commit -p -m"Benoit Pierre, Mar 10, 2014
  5. Eric SunshineMar 10, 2014
  6. Junio C HamanoMar 11, 2014
  7. Philip OakleyMar 10, 2014
  8. Junio C HamanoMar 11, 2014
  9. Torsten BögershausenMar 15, 2014
  10. Benoit PierreMar 15, 2014
  11. Torsten BögershausenMar 15, 2014
  12. 1/7 merge hook tests: fix missing '&&' in testBenoit Pierre, Mar 15, 2014
  13. 2/7 merge hook tests: use 'test_must_fail' instead of '!'Benoit Pierre, Mar 15, 2014
  14. 3/7 test patch hunk editing with "commit -p -m"Benoit Pierre, Mar 15, 2014
  15. Junio C HamanoMar 17, 2014
  16. Benoit PierreMar 17, 2014
  17. Eric SunshineMar 17, 2014
  18. Benoit PierreMar 17, 2014
  19. Junio C HamanoMar 17, 2014
  20. Junio C HamanoMar 17, 2014
  21. Benoit PierreMar 17, 2014
  22. Junio C HamanoMar 17, 2014
  23. 1/7 merge hook tests: fix missing '&&' in testBenoit Pierre, Mar 18, 2014
  24. 2/7 merge hook tests: use 'test_must_fail' instead of '!'Benoit Pierre, Mar 18, 2014
  25. 3/7 test patch hunk editing with "commit -p -m"Benoit Pierre, Mar 18, 2014
  26. 4/7 commit: fix patch hunk editing with "commit -p -m"Benoit Pierre, Mar 18, 2014
  27. Torsten BögershausenMar 19, 2014
  28. Junio C HamanoMar 19, 2014
  29. 5/7 merge: fix GIT_EDITOR override for commit hookBenoit Pierre, Mar 18, 2014
  30. 6/7 merge hook tests: fix and update testsBenoit Pierre, Mar 18, 2014
  31. 7/7 run-command: mark run_hook_with_custom_index as deprecatedBenoit Pierre, Mar 18, 2014
  32. Junio C HamanoMar 18, 2014
  33. 4/7 commit: fix patch hunk editing with "commit -p -m"Benoit Pierre, Mar 15, 2014
  34. 5/7 merge: fix GIT_EDITOR override for commit hookBenoit Pierre, Mar 15, 2014
  35. 6/7 merge hook tests: fix and update testsBenoit Pierre, Mar 15, 2014
  36. 7/7 run-command: mark run_hook_with_custom_index as deprecatedBenoit Pierre, Mar 15, 2014
  37. 4/7 commit: fix patch hunk editing with "commit -p -m"Benoit Pierre, Mar 10, 2014
  38. Jeff KingMar 10, 2014
  39. Jun HaoMar 11, 2014
  40. Benoit PierreMar 11, 2014
  41. Jeff KingMar 11, 2014
  42. Jun HaoMar 11, 2014
  43. Junio C HamanoMar 11, 2014
  44. 5/7 merge: fix GIT_EDITOR override for commit hookBenoit Pierre, Mar 10, 2014
  45. 6/7 merge hook tests: fix and update testsBenoit Pierre, Mar 10, 2014
  46. Eric SunshineMar 10, 2014
  47. 7/7 run-command: mark run_hook_with_custom_index as deprecatedBenoit Pierre, Mar 10, 2014
  48. brian m. carlsonMar 11, 2014
  49. Benoit PierreMar 11, 2014
  50. Jonathan NiederApr 3, 2014

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.