From: Junio C Hamano Date: Thu, 24 Jan 2013 05:19:25 +0000 (-0800) Subject: Merge branch 'as/pre-push-hook' X-Git-Tag: v1.8.2-rc0~87 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/bb9a69694f27aa299777c679979f75bdef75735d?ds=inline;hp=-c Merge branch 'as/pre-push-hook' Add an extra hook so that "git push" that is run without making sure what is being pushed is sane can be checked and rejected (as opposed to the user deciding not pushing). * as/pre-push-hook: Add sample pre-push hook script push: Add support for pre-push hooks hooks: Add function to check if a hook exists --- bb9a69694f27aa299777c679979f75bdef75735d diff --combined builtin/commit.c index 7c2a3d48b4,65d08d21f4..38b9a9cc0d --- a/builtin/commit.c +++ b/builtin/commit.c @@@ -103,7 -103,7 +103,7 @@@ static enum CLEANUP_NONE, CLEANUP_ALL } cleanup_mode; -static char *cleanup_arg; +static const char *cleanup_arg; static enum commit_whence whence; static int use_editor = 1, include_status = 1; @@@ -1320,8 -1320,6 +1320,8 @@@ static int git_commit_config(const cha include_status = git_config_bool(k, v); return 0; } + if (!strcmp(k, "commit.cleanup")) + return git_config_string(&cleanup_arg, k, v); status = git_gpg_config(k, v, NULL); if (status) @@@ -1329,8 -1327,6 +1329,6 @@@ return git_status_config(k, v, s); } - static const char post_rewrite_hook[] = "hooks/post-rewrite"; - static int run_rewrite_hook(const unsigned char *oldsha1, const unsigned char *newsha1) { @@@ -1341,10 -1337,10 +1339,10 @@@ int code; size_t n; - if (access(git_path(post_rewrite_hook), X_OK) < 0) + argv[0] = find_hook("post-rewrite"); + if (!argv[0]) return 0; - argv[0] = git_path(post_rewrite_hook); argv[1] = "amend"; argv[2] = NULL;