The old git-commit.sh script allowed the commit-msg hook to not only prevent a commit from proceding, but also to edit the commit message on the fly and allow it to proceed. So here we teach builtin-commit to do the same. Signed-off-by: Wincent Colaiuta <win@xxxxxxxxxxx> --- builtin-commit.c | 16 ++++++++++------ 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/builtin-commit.c b/builtin-commit.c index df9377e..a6223d2 100644 --- a/builtin-commit.c +++ b/builtin-commit.c @@ -787,14 +787,18 @@ int cmd_commit(int argc, const char **argv, const char *prefix) const char *env[2] = { index, NULL }; snprintf(index, sizeof(index), "GIT_INDEX_FILE=%s", index_file); launch_editor(git_path(commit_editmsg), &sb, env); - } else if (strbuf_read_file(&sb, git_path(commit_editmsg), 0) < 0) { - rollback_index_files(); - die("could not read commit message"); } - if (!no_verify && - run_hook(index_file, "commit-msg", git_path(commit_editmsg))) { + if (!no_verify) { + if (run_hook(index_file, "commit-msg", git_path(commit_editmsg))) { + rollback_index_files(); + exit(1); + } + strbuf_setlen(&sb, header_len); + } + if ((no_edit || !no_verify) && + strbuf_read_file(&sb, git_path(commit_editmsg), 0) < 0) { rollback_index_files(); - exit(1); + die("could not read commit message"); } /* Truncate the message just before the diff, if any. */ -- 1.5.3.7.1115.gaa595 - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html