Hi,
please find attached a small script that if placed at:
${LEDGER_SOURCE}/.git/hooks/prepare-commit-msg
will add a [ci skip] line to the commit message if the
changes made seem irrelevant (e.g. README, lisp, etc.)
for a continuous integration run.
(see http://docs.travis-ci.com/user/how-to-skip-a-build/)

With this only changes to files matching:
'\(^src\|^test\|^doc/ledger3.texi\|CMakeLists.txt\)'
will trigger the continuous integration run.

Are there other files that have an effect on the current
test suite, which therefore should be included in the above pattern?

If you think the script is a valuable contribution to the project
itself and should be included in the repository, where should
it reside, contrib/git?


Let's save some computing power ;)
Alexis

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.
#!/bin/sh
#
# Prepare git commit message:
#   - Add [ci skip] if the changes seem irrelevant for continuous integration

# Add [ci skip] to the commit message unless there are changes to files
# that are relevant for testing such as src/*, test/*, ledger3.texi, ...
function add_ci_skip()
{
  pattern="$1"; shift
  if [ $(git diff --cached --name-only | grep --count "$pattern") -eq 0 ]; then
    tempfile=$(mktemp $0.XXXXXX)
    cat - "$1" <<EOF > "$tempfile"

# It seems the changes to be committed are irrelevant for the continuous
# integration, therefore it will be skipped for this commit.
#
# If you still want continuous integration to run for this commit
# comment or remove the next line.
[ci skip]
EOF
    mv "$tempfile" "$1"
  fi
}

## MAIN
add_ci_skip '\(^src\|^test\|^doc/ledger3.texi\|CMakeLists.txt\)' "$@"

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"Ledger" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to