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

[PATCH 3/6] merge: fix GIT_EDITOR override for commit hook

From
Benoit Pierre <benoit.pierre@gmail.com>
Date
Mar 6, 2014, 14:50 UTC
Message-ID
<1394117424-29780-4-git-send-email-benoit.pierre@gmail.com>
In-Reply-To
<1394117424-29780-1-git-send-email-benoit.pierre@gmail.com>

Don't set GIT_EDITOR to ":" when calling prepare-commit-msg hook if the editor is going to be called (e.g. with "merge -e").

Signed-off-by: Benoit Pierre <benoit.pierre@gmail.com>
---
 builtin/merge.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/builtin/merge.c b/builtin/merge.c
index d2a1bfe..da7cafe 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -821,7 +821,7 @@ static void prepare_to_commit(struct commit_list *remoteheads)
 	if (0 < option_edit)
 		strbuf_commented_addf(&msg, _(merge_editor_comment), comment_line_char);
 	write_merge_msg(&msg);
-	if (run_commit_hook(1, get_index_file(), "prepare-commit-msg",
+	if (run_commit_hook(0 < option_edit, get_index_file(), "prepare-commit-msg",
 			    git_path("MERGE_MSG"), "merge", NULL))
 		abort_commit(remoteheads, NULL);
 	if (0 < option_edit) {
-- 
1.9.0
Previous: Junio C HamanoNext: Benoit Pierre
Message 8 of 16 in “fix hunk editing with 'commit -p -m'”
  1. 0/6 fix hunk editing with 'commit -p -m'Benoit Pierre, Mar 6, 2014
  2. 1/6 test patch hunk editing with "commit -p -m"Benoit Pierre, Mar 6, 2014
  3. Eric SunshineMar 6, 2014
  4. Junio C HamanoMar 6, 2014
  5. 2/6 commit: fix patch hunk editing with "commit -p -m"Benoit Pierre, Mar 6, 2014
  6. Junio C HamanoMar 6, 2014
  7. Junio C HamanoMar 6, 2014
  8. 3/6 merge: fix GIT_EDITOR override for commit hookBenoit Pierre, Mar 6, 2014
  9. 4/6 merge hook tests: fix and update testsBenoit Pierre, Mar 6, 2014
  10. Eric SunshineMar 6, 2014
  11. 5/6 merge hook tests: fix missing '&&' in testBenoit Pierre, Mar 6, 2014
  12. Junio C HamanoMar 6, 2014
  13. 6/6 merge hook tests: use 'test_must_fail' instead of '!'Benoit Pierre, Mar 6, 2014
  14. Junio C HamanoMar 6, 2014
  15. Junio C HamanoMar 7, 2014
  16. Junio C HamanoMar 6, 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.