Skip to content

Commit

Permalink
Include a globally available variable GIT_DIR, that points to the .gi…
Browse files Browse the repository at this point in the history
…t directory.

Add a function that tests whether a specific commit is already merged into the given target branch.
  • Loading branch information
nvie committed Jan 29, 2010
1 parent 17a8112 commit 58995b5
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions git-flow
Expand Up @@ -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)
Expand Down Expand Up @@ -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 "$@"

0 comments on commit 58995b5

Please sign in to comment.