Force a non-lazy run if global.ini has changed
[puppet-git.git] / ppg-is-ancestor
blobd7ed6459871bbe576af6c7abf8e4382371b8f42f
1 #!/bin/bash
3 # emulates git merge-base --is-ancestor
4 # until git >= 1.8 is prevalent
6 ## Check if the first <commit> is an ancestor of the second <commit>,
7 ## and exit with status 0 if true, or with status 1 if not.
8 ## Errors are signaled by a non-zero status that is not 1.
10 PARENT=$1
11 CHILD=$2
13 # they may be symbolic, a refname or a pointer to a full tag,
14 # make sure we resolve to sha1 of the commit
15 PARENT=$(git rev-parse --revs-only ${PARENT}^{commit} ) || exit 1
16 CHILD=$(git rev-parse --revs-only ${CHILD}^{commit} ) || exit 1
18 MB=$(git merge-base $PARENT $CHILD) || exit 1
20 if [ "$MB" = "$PARENT" ]; then
21 exit 0
23 exit 1