From 58995b5b860bc84b7d726c0e5b2007a02a7c33ae Mon Sep 17 00:00:00 2001 From: Vincent Driessen Date: Thu, 28 Jan 2010 12:39:06 +0100 Subject: [PATCH] Include a globally available variable GIT_DIR, that points to the .git directory. Add a function that tests whether a specific commit is already merged into the given target branch. --- git-flow | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/git-flow b/git-flow index 5fbbf8c5d..8e2fa7897 100755 --- a/git-flow +++ b/git-flow @@ -18,6 +18,7 @@ if [ "$DEBUG" = "yes" ]; then set -x fi +export GIT_DIR=$(git rev-parse --git-dir) export GITFLOW_DIR=$(dirname "$0") export MASTER_BRANCH=$(git config --get gitflow.branch.master || echo master) export DEVELOP_BRANCH=$(git config --get gitflow.branch.develop || echo develop) @@ -162,4 +163,16 @@ gitflow_require_branches_equal() { fi } +# +# gitflow_is_branch_merged_into() +# +# Checks whether branch $1 is succesfully merged into $2 +# +gitflow_is_branch_merged_into() { + local SUBJECT=$1 + local BASE=$2 + ALL_MERGES=$(git branch --contains $SUBJECT | sed 's/^[* ] //') + has $BASE $ALL_MERGES +} + main "$@"