[ARVADOS-DEV] created: 6c00c1f481e97eaaa0c5cf9b39f50de4a896d37e

Git user git at public.curoverse.com
Thu Jan 19 15:46:20 EST 2017


        at  6c00c1f481e97eaaa0c5cf9b39f50de4a896d37e (commit)


commit 6c00c1f481e97eaaa0c5cf9b39f50de4a896d37e
Author: Javier Bértoli <javier at curoverse.com>
Date:   Thu Jan 19 17:45:37 2017 -0300

    Add script to delete merged branches
    
    refs #9050

diff --git a/jenkins/run-delete-merged-branches.sh b/jenkins/run-delete-merged-branches.sh
new file mode 100755
index 0000000..179d482
--- /dev/null
+++ b/jenkins/run-delete-merged-branches.sh
@@ -0,0 +1,27 @@
+#!/usr/bin/env bash
+
+# Provide generic exit strategy for any error in execution
+_exit_handler() {
+    local rc="${?}"
+    trap - EXIT
+    if [ "${rc}" -ne 0 ]; then
+        echo "Error occurred (${rc}) while running ${0} at line ${1}: ${BASH_COMMAND}"
+    fi
+    exit "${rc}"
+}
+
+set -Ee
+trap '_exit_handler $LINENO' EXIT ERR
+
+# List here branches that you don't want to ever delete, separated with "|"
+# (as they will be passed as a parameter to egrep)
+# IE: "keep_this_branch|also_this_other|and_this_one"
+branches_to_keep="master"
+
+git checkout master
+
+git branch --remote --merged | \
+    egrep -v ${branches_to_keep} | \
+    sed 's/origin\///' | \
+    xargs -n 1 git push --delete origin
+

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list