diff options
Diffstat (limited to 'tcwg-llvm-common.sh')
-rwxr-xr-x | tcwg-llvm-common.sh | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/tcwg-llvm-common.sh b/tcwg-llvm-common.sh index 7eaec6db..180faa88 100755 --- a/tcwg-llvm-common.sh +++ b/tcwg-llvm-common.sh @@ -88,9 +88,12 @@ update_git() { } # Find the SVN revision of a git-svn repository +# The first commit might not be upstream in a branch +# Assuming there won't be more than 10 non-upstream +# If this becomes common, we'll have to move this logic to a perl/python script find_svn_rev() { local BASE=$1 - rev="$(git -C "$BASE" log -n 1 | grep git-svn-id | perl -pe "s/.*@(\d+)\s.*/\$1/")" + rev="$(git -C "$BASE" log -n 10 | grep git-svn-id | perl -pe "s/.*@(\d+)\s.*/\$1/")" echo "$rev" } @@ -103,6 +106,18 @@ find_last_rev() { echo "$LAST" } +# Git remote has branch +has_remote_branch() { + local REPO="$1" + local BRANCH="$2" + REF="$(git ls-remote --heads "$REPO" "$BRANCH")" + if [ -z "$REF" ]; then + return 1 + else + return 0 + fi +} + # Environment Variables and default values CPUS=$(nproc --all) # We may use between 500MB and 1GB per link job |