Branch: Tag:

2010-10-04

2010-10-04 10:54:33 by Marcus Comstedt <marcus@mc.pp.se>

Add a post-rewrite hook to check rebases.

7:    "pre-commit" : PreCommitHook,    "pre-receive" : PreReceiveHook,    "post-commit" : PostCommitHook, +  "post-rewrite" : PostRewriteHook,   ]);      mapping(string:program) filters = ([
621:    }   }    + class PostRewriteHook + { +  inherit CommitHookUtilsRepo; +  +  int hook(string command) +  { +  if (command == "rebase") { +  int errs = 0; +  foreach(split_lf(Stdio.stdin->read()), string line) { +  string old_sha, new_sha, extra; +  if(sscanf(line, "%s %s%*[ ]%s", old_sha, new_sha, extra) != 4) +  fail("Unparsable input line %O!\n", line); +  errs += check_commit(new_sha); +  } +  if (errs) +  write("NOTICE: %d of the commits contain errors. Please amend before pushing.\n", errs); +  } +  return 0; +  } + } +    /* Filters */      /* A sample filter, not really useful... */