summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/commit2.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/commit2.c b/src/commit2.c
index 97c3b26..0333411 100644
--- a/src/commit2.c
+++ b/src/commit2.c
@@ -112,6 +112,7 @@ usage(void)
printf("\t-o\t\tdisable partial commit\n");
printf("\t-f\t\tfull iteration over configuration on commit check\n");
printf("\t-b\t\tbreak on each priority node (debug mode)\n");
+ printf("\t-r [FILE]\trun hook script on finishing commit\n");
printf("\t-h\t\thelp\n");
}
@@ -128,12 +129,13 @@ main(int argc, char** argv)
boolean disable_partial_commit = FALSE;
boolean full_commit_check = FALSE;
boolean break_priority = FALSE;
+ char *hook = NULL;
/* this is needed before calling certain glib functions */
g_type_init();
//grab inputs
- while ((ch = getopt(argc, argv, "dpthsecoafb")) != -1) {
+ while ((ch = getopt(argc, argv, "dpthsecoafbr:")) != -1) {
switch (ch) {
case 'd':
g_debug = TRUE;
@@ -169,6 +171,9 @@ main(int argc, char** argv)
case 'b':
break_priority = TRUE;
break;
+ case 'r':
+ hook = optarg;
+ break;
default:
usage();
exit(0);
@@ -342,6 +347,10 @@ main(int argc, char** argv)
fclose(fp_changes);
}
+ if (hook != NULL) {
+ system(hook);
+ }
+
//remove tmp changes file as all the work is now done
unlink("/tmp/.changes");