From 2bbc81ebac9491274bca86865b804705c725e248 Mon Sep 17 00:00:00 2001 From: Stig Thormodsrud Date: Fri, 1 Oct 2010 11:37:54 -0700 Subject: Pass optional commit comment through commit to commit hooks. --- src/commit2.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/commit2.c') diff --git a/src/commit2.c b/src/commit2.c index 884d2fe..51bb7dd 100644 --- a/src/commit2.c +++ b/src/commit2.c @@ -133,12 +133,13 @@ main(int argc, char** argv) boolean full_commit_check = FALSE; boolean break_priority = FALSE; boolean disable_hook = FALSE; + char *commit_comment = NULL; /* this is needed before calling certain glib functions */ g_type_init(); //grab inputs - while ((ch = getopt(argc, argv, "dpthsecoafbr")) != -1) { + while ((ch = getopt(argc, argv, "dpthsecoafbrC:")) != -1) { switch (ch) { case 'd': g_debug = TRUE; @@ -177,6 +178,9 @@ main(int argc, char** argv) case 'r': disable_hook = TRUE; break; + case 'C': + commit_comment = strdup(optarg); + break; default: usage(); exit(0); @@ -374,7 +378,10 @@ main(int argc, char** argv) if (strcmp(dirp->d_name, ".") != 0 && strcmp(dirp->d_name, "..") != 0) { char buf[MAX_LENGTH_DIR_PATH*sizeof(char)]; - sprintf(buf,"%s/%s",COMMIT_HOOK_DIR,dirp->d_name); + if (commit_comment == NULL) { + commit_comment="commit"; + } + sprintf(buf,"%s/%s %s",COMMIT_HOOK_DIR,dirp->d_name, commit_comment); syslog(LOG_DEBUG,"Starting commit hook: %s",buf); if (system(buf) == -1) { syslog(LOG_WARNING,"Error on call to hook: %s", buf); -- cgit v1.2.3 From 73ee5b7ec3ad013fee079830969fb1ddec6ae2da Mon Sep 17 00:00:00 2001 From: root Date: Mon, 11 Oct 2010 15:50:36 -0700 Subject: change error location tag from commit process --- src/commit2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/commit2.c') diff --git a/src/commit2.c b/src/commit2.c index 51bb7dd..0eb75f0 100644 --- a/src/commit2.c +++ b/src/commit2.c @@ -590,7 +590,7 @@ process_func(GNode *node, gpointer data) if (!status) { //EXECUTE_LIST RETURNS FALSE ON FAILURE.... syslog(LOG_ERR,"commit error for %s:[%s]\n",ActionNames[result->_action],d->_path); if (g_display_error_node) { - fprintf(out_stream,"%s:[%s]\n",ActionNames[result->_action],d->_path); + fprintf(out_stream,"%s@errloc:[%s]\n",ActionNames[result->_action],d->_path); } result->_err_code = 1; if (g_debug) { @@ -1404,7 +1404,7 @@ validate_func(GNode *node, gpointer data) } syslog(LOG_ERR,"commit error for %s:[%s]\n",ActionNames[result->_action],d->_path); if (g_display_error_node) { - fprintf(out_stream,"%s:[%s]\n",ActionNames[result->_action],d->_path); + fprintf(out_stream,"%s@errloc:[%s]\n",ActionNames[result->_action],d->_path); } result->_err_code = 1; if (g_debug) { -- cgit v1.2.3