| 1346 | } |
| 1347 | |
| 1348 | static int run_prepare_commit_msg_hook(struct repository *r, |
| 1349 | struct strbuf *msg, |
| 1350 | const char *commit) |
| 1351 | { |
| 1352 | int ret = 0; |
| 1353 | const char *name, *arg1 = NULL, *arg2 = NULL; |
| 1354 | |
| 1355 | name = git_path_commit_editmsg(); |
| 1356 | if (write_message(msg->buf, msg->len, name, 0)) |
| 1357 | return -1; |
| 1358 | |
| 1359 | if (commit) { |
| 1360 | arg1 = "commit"; |
| 1361 | arg2 = commit; |
| 1362 | } else { |
| 1363 | arg1 = "message"; |
| 1364 | } |
| 1365 | if (run_commit_hook(0, r->index_file, NULL, "prepare-commit-msg", name, |
| 1366 | arg1, arg2, NULL)) |
| 1367 | ret = error(_("'prepare-commit-msg' hook failed")); |
| 1368 | |
| 1369 | return ret; |
| 1370 | } |
| 1371 | |
| 1372 | static const char implicit_ident_advice_noconfig[] = |
| 1373 | N_("Your name and email address were configured automatically based\n" |
no test coverage detected