diff options
author | Stig Thormodsrud <stig@vyatta.com> | 2010-10-01 11:37:54 -0700 |
---|---|---|
committer | Stig Thormodsrud <stig@vyatta.com> | 2010-10-01 11:37:54 -0700 |
commit | 2bbc81ebac9491274bca86865b804705c725e248 (patch) | |
tree | 9f05f733a970a6739b72a3e10e27cf16e35e6cbf /src | |
parent | a1f5b9e22b188f9d081db5a783455f926875c6e6 (diff) | |
download | vyatta-cfg-2bbc81ebac9491274bca86865b804705c725e248.tar.gz vyatta-cfg-2bbc81ebac9491274bca86865b804705c725e248.zip |
Pass optional commit comment through commit to commit hooks.
Diffstat (limited to 'src')
-rw-r--r-- | src/commit2.c | 11 |
1 files changed, 9 insertions, 2 deletions
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); |