githelper.git / githelper.pike

version» Context lines:

githelper.git/githelper.pike:15:   #endif /* /bin/sh code above */      #define DOLLAR "$"   constant unexpanded_id = DOLLAR"Id"DOLLAR;      mapping(string:program) hooks = ([    "pre-commit" : PreCommitHook,    "pre-receive" : PreReceiveHook,    "post-commit" : PostCommitHook,    "post-rewrite" : PostRewriteHook, +  "githelper-plugins" : 0,   ]);      mapping(string:program) filters = ([   #if 0    "nice_ident" : NiceIdentFilter,   #endif   ]);         
githelper.git/githelper.pike:911:    void setup_hooks()    {    constant hooksdir = "hooks";    if (!sizeof(hooks))    return;    if (!file_stat(hooksdir)) {    write("Creating the hooks directory\n");    if (!mkdir(hooksdir))    iofail("Failed to create %s", hooksdir);    } -  foreach (hooks; string name; ) { +  foreach (hooks; string name; program p) {    string path = combine_path(hooksdir, name); -  +  string src = p?__FILE__:combine_path(__DIR__, name); +  if (!file_stat(src)) { +  iofail("Source file %s not found"); +  }    Stdio.Stat s = file_stat(path, 1);    if (!s) {    write("Installing %s\n", path); -  System.symlink(__FILE__, path); +  System.symlink(src, path);    } else if (s->islnk) {    /* Already setup ok, it seems */    } else {    write("Hook %s already exists, so won't overwrite it...\n", name);    }    }    }       void setup_filter(string name, string op)    {