githelper.git
/
githelper.pike
version
»
Context lines:
10
20
40
80
file
none
3
githelper.git/githelper.pike:24:
"post-rewrite" : PostRewriteHook, "githelper-plugins" : 0, ]); mapping(string:program) filters = ([ #if 0 "nice_ident" : NiceIdentFilter, #endif ]);
+
string plugin_name = getenv("GITHELPER_PLUGIN")
+
#ifdef COMMIT_PLUGIN
+
|| COMMIT_PLUGIN
+
#endif
+
;
constant filterops = ({ "clean", "smudge" }); void fail(string msg, mixed ... args) { werror(msg, @args); exit(1); }
githelper.git/githelper.pike:352:
GitAttributes attrs; private string git_dir; string get_git_dir() { return git_dir || (git_dir = String.trim_all_whites(run_git("rev-parse", "--git-dir"))); }
-
class
Plugin
+
class
GithelperPlugin
{ optional string check_message_body(string sha, array(string) headers, string body); optional int(0..1) check_commit(string branch, string sha, array(string) paths); }
-
Plugin
plugin;
+
GithelperPlugin
plugin;
-
#ifdef COMMIT_PLUGIN
+
private class PluginHandler { mixed resolv(string symbol, string file) { switch(symbol) {
-
+
case "GithelperPlugin": return GithelperPlugin;
case "get_git_dir": return get_git_dir; } return master()->resolv(symbol, file); } } private PluginHandler plugin_handler = PluginHandler(); protected void create() {
-
+
if (!sizeof(plugin_name || "")) return;
+
string plugin_path = combine_path(get_git_dir(), "hooks/githelper-plugins",
-
COMMIT
_
PLUGIN
);
+
plugin
_
name
);
if (Stdio.exist(plugin_path)) {
-
program(
Plugin
) plugin_program =
+
program(
GithelperPlugin
) plugin_program =
compile_file(plugin_path, plugin_handler); plugin = plugin_program(); } else { write("NOTICE: Plugin %s not found.\n", plugin_path); write("You may want to reinstall githelper.\n"); } }
-
#endif
+
string get_file(string filename, int|void allow_empty); string get_old_file(string filename, int|void allow_empty); int entry_is_new(string filename) { return 0; } int find_expanded_ident(string data) { int p=0; while ((p = search(data, DOLLAR"Id", p))>=0) { if (data[p..p+3] != unexpanded_id) {