Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2019-11-10 12:02:12 +0300
committerJunio C Hamano <gitster@pobox.com>2019-11-10 12:02:12 +0300
commit5c8c0a0d78b0e0ee50ba13823f0cfbee05334461 (patch)
tree8b4ebc4676440e47f24351824e16a072796772d1 /commit.c
parentb75ba9bbd13877ff3351e150d3d053baec81f0db (diff)
parent4627bc777e9ade5e3a85d6b8e8630fc4b6e2f8f6 (diff)
Merge branch 'pw/post-commit-from-sequencer'
"rebase -i" ceased to run post-commit hook by mistake in an earlier update, which has been corrected. * pw/post-commit-from-sequencer: sequencer: run post-commit hook move run_commit_hook() to libgit and use it there sequencer.h fix placement of #endif t3404: remove uneeded calls to set_fake_editor t3404: set $EDITOR in subshell t3404: remove unnecessary subshell
Diffstat (limited to 'commit.c')
-rw-r--r--commit.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/commit.c b/commit.c
index 40890ae7ce..52036bc90f 100644
--- a/commit.c
+++ b/commit.c
@@ -19,6 +19,7 @@
#include "advice.h"
#include "refs.h"
#include "commit-reach.h"
+#include "run-command.h"
static struct commit_extra_header *read_commit_extra_header_lines(const char *buf, size_t len, const char **);
@@ -1581,3 +1582,26 @@ size_t ignore_non_trailer(const char *buf, size_t len)
}
return boc ? len - boc : len - cutoff;
}
+
+int run_commit_hook(int editor_is_used, const char *index_file,
+ const char *name, ...)
+{
+ struct argv_array hook_env = ARGV_ARRAY_INIT;
+ va_list args;
+ int ret;
+
+ argv_array_pushf(&hook_env, "GIT_INDEX_FILE=%s", index_file);
+
+ /*
+ * Let the hook know that no editor will be launched.
+ */
+ if (!editor_is_used)
+ argv_array_push(&hook_env, "GIT_EDITOR=:");
+
+ va_start(args, name);
+ ret = run_hook_ve(hook_env.argv,name, args);
+ va_end(args);
+ argv_array_clear(&hook_env);
+
+ return ret;
+}