Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitflow
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
tools
gitflow
Commits
15aab264
Commit
15aab264
authored
Sep 25, 2012
by
Jerome Baum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use git_do where appropriate
parent
5bca8d93
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
92 additions
and
92 deletions
+92
-92
git-flow-feature
git-flow-feature
+29
-29
git-flow-hotfix
git-flow-hotfix
+19
-19
git-flow-init
git-flow-init
+14
-14
git-flow-release
git-flow-release
+28
-28
git-flow-support
git-flow-support
+2
-2
No files found.
git-flow-feature
View file @
15aab264
...
@@ -204,7 +204,7 @@ cmd_start() {
...
@@ -204,7 +204,7 @@ cmd_start() {
# update the local repo with remote changes, if asked
# update the local repo with remote changes, if asked
if flag fetch; then
if flag fetch; then
git fetch -q "$ORIGIN" "$DEVELOP_BRANCH"
git
_do
fetch -q "$ORIGIN" "$DEVELOP_BRANCH"
fi
fi
# if the origin branch counterpart exists, assert that the local branch
# if the origin branch counterpart exists, assert that the local branch
...
@@ -214,7 +214,7 @@ cmd_start() {
...
@@ -214,7 +214,7 @@ cmd_start() {
fi
fi
# create branch
# create branch
if ! git checkout -b "$BRANCH" "$BASE"; then
if ! git
_do
checkout -b "$BRANCH" "$BASE"; then
die "Could not create feature branch '$BRANCH'"
die "Could not create feature branch '$BRANCH'"
fi
fi
...
@@ -287,8 +287,8 @@ cmd_finish() {
...
@@ -287,8 +287,8 @@ cmd_finish() {
# update local repo with remote changes first, if asked
# update local repo with remote changes first, if asked
if has "$ORIGIN/$BRANCH" $(git_remote_branches); then
if has "$ORIGIN/$BRANCH" $(git_remote_branches); then
if flag fetch; then
if flag fetch; then
git fetch -q "$ORIGIN" "$BRANCH"
git
_do
fetch -q "$ORIGIN" "$BRANCH"
git fetch -q "$ORIGIN" "$DEVELOP_BRANCH"
git
_do
fetch -q "$ORIGIN" "$DEVELOP_BRANCH"
fi
fi
fi
fi
...
@@ -311,16 +311,16 @@ cmd_finish() {
...
@@ -311,16 +311,16 @@ cmd_finish() {
fi
fi
# merge into BASE
# merge into BASE
git checkout "$DEVELOP_BRANCH"
git
_do
checkout "$DEVELOP_BRANCH"
if [ "$(git rev-list -n2 "$DEVELOP_BRANCH..$BRANCH" | wc -l)" -eq 1 ]; then
if [ "$(git rev-list -n2 "$DEVELOP_BRANCH..$BRANCH" | wc -l)" -eq 1 ]; then
git merge --ff "$BRANCH"
git
_do
merge --ff "$BRANCH"
else
else
if noflag squash; then
if noflag squash; then
git merge --no-ff "$BRANCH"
git
_do
merge --no-ff "$BRANCH"
else
else
git merge --squash "$BRANCH"
git
_do
merge --squash "$BRANCH"
git commit
git
_do
commit
git merge "$BRANCH"
git
_do
merge "$BRANCH"
fi
fi
fi
fi
...
@@ -351,15 +351,15 @@ helper_finish_cleanup() {
...
@@ -351,15 +351,15 @@ helper_finish_cleanup() {
# delete branch
# delete branch
if flag fetch; then
if flag fetch; then
git push "$ORIGIN" ":refs/heads/$BRANCH"
git
_do
push "$ORIGIN" ":refs/heads/$BRANCH"
fi
fi
if noflag keep; then
if noflag keep; then
if flag force_delete; then
if flag force_delete; then
git branch -D "$BRANCH"
git
_do
branch -D "$BRANCH"
else
else
git branch -d "$BRANCH"
git
_do
branch -d "$BRANCH"
fi
fi
fi
fi
...
@@ -383,17 +383,17 @@ cmd_publish() {
...
@@ -383,17 +383,17 @@ cmd_publish() {
# sanity checks
# sanity checks
require_clean_working_tree
require_clean_working_tree
require_branch "$BRANCH"
require_branch "$BRANCH"
git fetch -q "$ORIGIN"
git
_do
fetch -q "$ORIGIN"
require_branch_absent "$ORIGIN/$BRANCH"
require_branch_absent "$ORIGIN/$BRANCH"
# create remote branch
# create remote branch
git push "$ORIGIN" "$BRANCH:refs/heads/$BRANCH"
git
_do
push "$ORIGIN" "$BRANCH:refs/heads/$BRANCH"
git fetch -q "$ORIGIN"
git
_do
fetch -q "$ORIGIN"
# configure remote tracking
# configure remote tracking
git config "branch.$BRANCH.remote" "$ORIGIN"
git
_do
config "branch.$BRANCH.remote" "$ORIGIN"
git config "branch.$BRANCH.merge" "refs/heads/$BRANCH"
git
_do
config "branch.$BRANCH.merge" "refs/heads/$BRANCH"
git checkout "$BRANCH"
git
_do
checkout "$BRANCH"
echo
echo
echo "Summary of actions:"
echo "Summary of actions:"
...
@@ -410,11 +410,11 @@ cmd_track() {
...
@@ -410,11 +410,11 @@ cmd_track() {
# sanity checks
# sanity checks
require_clean_working_tree
require_clean_working_tree
require_branch_absent "$BRANCH"
require_branch_absent "$BRANCH"
git fetch -q "$ORIGIN"
git
_do
fetch -q "$ORIGIN"
require_branch "$ORIGIN/$BRANCH"
require_branch "$ORIGIN/$BRANCH"
# create tracking branch
# create tracking branch
git checkout -b "$BRANCH" "$ORIGIN/$BRANCH"
git
_do
checkout -b "$BRANCH" "$ORIGIN/$BRANCH"
echo
echo
echo "Summary of actions:"
echo "Summary of actions:"
...
@@ -445,7 +445,7 @@ cmd_checkout() {
...
@@ -445,7 +445,7 @@ cmd_checkout() {
if [ "$NAME" != "" ]; then
if [ "$NAME" != "" ]; then
expand_nameprefix_arg
expand_nameprefix_arg
git checkout "$BRANCH"
git
_do
checkout "$BRANCH"
else
else
die "Name a feature branch explicitly."
die "Name a feature branch explicitly."
fi
fi
...
@@ -464,12 +464,12 @@ cmd_rebase() {
...
@@ -464,12 +464,12 @@ cmd_rebase() {
require_clean_working_tree
require_clean_working_tree
require_branch "$BRANCH"
require_branch "$BRANCH"
git checkout -q "$BRANCH"
git
_do
checkout -q "$BRANCH"
local OPTS=
local OPTS=
if flag interactive; then
if flag interactive; then
OPTS="$OPTS -i"
OPTS="$OPTS -i"
fi
fi
git rebase $OPTS "$DEVELOP_BRANCH"
git
_do
rebase $OPTS "$DEVELOP_BRANCH"
}
}
avoid_accidental_cross_branch_action() {
avoid_accidental_cross_branch_action() {
...
@@ -511,20 +511,20 @@ cmd_pull() {
...
@@ -511,20 +511,20 @@ cmd_pull() {
# we already have a local branch called like this, so simply pull the
# we already have a local branch called like this, so simply pull the
# remote changes in
# remote changes in
if flag rebase; then
if flag rebase; then
if ! git pull --rebase -q "$REMOTE" "$BRANCH"; then
if ! git
_do
pull --rebase -q "$REMOTE" "$BRANCH"; then
warn "Pull was aborted. There might be conflicts during rebase or '$REMOTE' might be inaccessible."
warn "Pull was aborted. There might be conflicts during rebase or '$REMOTE' might be inaccessible."
exit 1
exit 1
fi
fi
else
else
git pull -q "$REMOTE" "$BRANCH" || die "Failed to pull from remote '$REMOTE'."
git
_do
pull -q "$REMOTE" "$BRANCH" || die "Failed to pull from remote '$REMOTE'."
fi
fi
echo "Pulled $REMOTE's changes into $BRANCH."
echo "Pulled $REMOTE's changes into $BRANCH."
else
else
# setup the local branch clone for the first time
# setup the local branch clone for the first time
git fetch -q "$REMOTE" "$BRANCH" || die "Fetch failed." # stores in FETCH_HEAD
git
_do
fetch -q "$REMOTE" "$BRANCH" || die "Fetch failed." # stores in FETCH_HEAD
git branch --no-track "$BRANCH" FETCH_HEAD || die "Branch failed."
git
_do
branch --no-track "$BRANCH" FETCH_HEAD || die "Branch failed."
git checkout -q "$BRANCH" || die "Checking out new local branch failed."
git
_do
checkout -q "$BRANCH" || die "Checking out new local branch failed."
echo "Created local branch $BRANCH based on $REMOTE's $BRANCH."
echo "Created local branch $BRANCH based on $REMOTE's $BRANCH."
fi
fi
}
}
git-flow-hotfix
View file @
15aab264
...
@@ -169,14 +169,14 @@ cmd_start() {
...
@@ -169,14 +169,14 @@ cmd_start() {
require_branch_absent "$BRANCH"
require_branch_absent "$BRANCH"
require_tag_absent "$VERSION_PREFIX$VERSION"
require_tag_absent "$VERSION_PREFIX$VERSION"
if flag fetch; then
if flag fetch; then
git fetch -q "$ORIGIN" "$MASTER_BRANCH"
git
_do
fetch -q "$ORIGIN" "$MASTER_BRANCH"
fi
fi
if has "$ORIGIN/$MASTER_BRANCH" $(git_remote_branches); then
if has "$ORIGIN/$MASTER_BRANCH" $(git_remote_branches); then
require_branches_equal "$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH"
require_branches_equal "$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH"
fi
fi
# create branch
# create branch
git checkout -b "$BRANCH" "$BASE"
git
_do
checkout -b "$BRANCH" "$BASE"
echo
echo
echo "Summary of actions:"
echo "Summary of actions:"
...
@@ -199,17 +199,17 @@ cmd_publish() {
...
@@ -199,17 +199,17 @@ cmd_publish() {
# sanity checks
# sanity checks
require_clean_working_tree
require_clean_working_tree
require_branch "$BRANCH"
require_branch "$BRANCH"
git fetch -q "$ORIGIN"
git
_do
fetch -q "$ORIGIN"
require_branch_absent "$ORIGIN/$BRANCH"
require_branch_absent "$ORIGIN/$BRANCH"
# create remote branch
# create remote branch
git push "$ORIGIN" "$BRANCH:refs/heads/$BRANCH"
git
_do
push "$ORIGIN" "$BRANCH:refs/heads/$BRANCH"
git fetch -q "$ORIGIN"
git
_do
fetch -q "$ORIGIN"
# configure remote tracking
# configure remote tracking
git config "branch.$BRANCH.remote" "$ORIGIN"
git config "branch.$BRANCH.remote" "$ORIGIN"
git config "branch.$BRANCH.merge" "refs/heads/$BRANCH"
git config "branch.$BRANCH.merge" "refs/heads/$BRANCH"
git checkout "$BRANCH"
git
_do
checkout "$BRANCH"
echo
echo
echo "Summary of actions:"
echo "Summary of actions:"
...
@@ -226,11 +226,11 @@ cmd_track() {
...
@@ -226,11 +226,11 @@ cmd_track() {
# sanity checks
# sanity checks
require_clean_working_tree
require_clean_working_tree
require_branch_absent "$BRANCH"
require_branch_absent "$BRANCH"
git fetch -q "$ORIGIN"
git
_do
fetch -q "$ORIGIN"
require_branch "$ORIGIN/$BRANCH"
require_branch "$ORIGIN/$BRANCH"
# create tracking branch
# create tracking branch
git checkout -b "$BRANCH" "$ORIGIN/$BRANCH"
git
_do
checkout -b "$BRANCH" "$ORIGIN/$BRANCH"
echo
echo
echo "Summary of actions:"
echo "Summary of actions:"
...
@@ -260,9 +260,9 @@ cmd_finish() {
...
@@ -260,9 +260,9 @@ cmd_finish() {
require_branch "$BRANCH"
require_branch "$BRANCH"
require_clean_working_tree
require_clean_working_tree
if flag fetch; then
if flag fetch; then
git fetch -q "$ORIGIN" "$MASTER_BRANCH" || \
git
_do
fetch -q "$ORIGIN" "$MASTER_BRANCH" || \
die "Could not fetch $MASTER_BRANCH from $ORIGIN."
die "Could not fetch $MASTER_BRANCH from $ORIGIN."
git fetch -q "$ORIGIN" "$DEVELOP_BRANCH" || \
git
_do
fetch -q "$ORIGIN" "$DEVELOP_BRANCH" || \
die "Could not fetch $DEVELOP_BRANCH from $ORIGIN."
die "Could not fetch $DEVELOP_BRANCH from $ORIGIN."
fi
fi
if has "$ORIGIN/$MASTER_BRANCH" $(git_remote_branches); then
if has "$ORIGIN/$MASTER_BRANCH" $(git_remote_branches); then
...
@@ -276,9 +276,9 @@ cmd_finish() {
...
@@ -276,9 +276,9 @@ cmd_finish() {
# in case a previous attempt to finish this release branch has failed,
# in case a previous attempt to finish this release branch has failed,
# but the merge into master was successful, we skip it now
# but the merge into master was successful, we skip it now
if ! git_is_branch_merged_into "$BRANCH" "$MASTER_BRANCH"; then
if ! git_is_branch_merged_into "$BRANCH" "$MASTER_BRANCH"; then
git checkout "$MASTER_BRANCH" || \
git
_do
checkout "$MASTER_BRANCH" || \
die "Could not check out $MASTER_BRANCH."
die "Could not check out $MASTER_BRANCH."
git merge --no-ff "$BRANCH" || \
git
_do
merge --no-ff "$BRANCH" || \
die "There were merge conflicts."
die "There were merge conflicts."
# TODO: What do we do now?
# TODO: What do we do now?
fi
fi
...
@@ -294,7 +294,7 @@ cmd_finish() {
...
@@ -294,7 +294,7 @@ cmd_finish() {
[ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
[ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
[ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'"
[ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'"
[ "$FLAGS_messagefile" != "" ] && opts="$opts -F '$FLAGS_messagefile'"
[ "$FLAGS_messagefile" != "" ] && opts="$opts -F '$FLAGS_messagefile'"
eval git tag $opts "$VERSION_PREFIX$VERSION" "$BRANCH" || \
eval git
_do
tag $opts "$VERSION_PREFIX$VERSION" "$BRANCH" || \
die "Tagging failed. Please run finish again to retry."
die "Tagging failed. Please run finish again to retry."
fi
fi
fi
fi
...
@@ -303,28 +303,28 @@ cmd_finish() {
...
@@ -303,28 +303,28 @@ cmd_finish() {
# in case a previous attempt to finish this release branch has failed,
# in case a previous attempt to finish this release branch has failed,
# but the merge into develop was successful, we skip it now
# but the merge into develop was successful, we skip it now
if ! git_is_branch_merged_into "$BRANCH" "$DEVELOP_BRANCH"; then
if ! git_is_branch_merged_into "$BRANCH" "$DEVELOP_BRANCH"; then
git checkout "$DEVELOP_BRANCH" || \
git
_do
checkout "$DEVELOP_BRANCH" || \
die "Could not check out $DEVELOP_BRANCH."
die "Could not check out $DEVELOP_BRANCH."
# TODO: Actually, accounting for 'git describe' pays, so we should
# TODO: Actually, accounting for 'git describe' pays, so we should
# ideally git merge --no-ff $tagname here, instead!
# ideally git merge --no-ff $tagname here, instead!
git merge --no-ff "$BRANCH" || \
git
_do
merge --no-ff "$BRANCH" || \
die "There were merge conflicts."
die "There were merge conflicts."
# TODO: What do we do now?
# TODO: What do we do now?
fi
fi
# delete branch
# delete branch
if noflag keep; then
if noflag keep; then
git branch -d "$BRANCH"
git
_do
branch -d "$BRANCH"
fi
fi
if flag push; then
if flag push; then
git push "$ORIGIN" "$DEVELOP_BRANCH" || \
git
_do
push "$ORIGIN" "$DEVELOP_BRANCH" || \
die "Could not push to $DEVELOP_BRANCH from $ORIGIN."
die "Could not push to $DEVELOP_BRANCH from $ORIGIN."
git push "$ORIGIN" "$MASTER_BRANCH" || \
git
_do
push "$ORIGIN" "$MASTER_BRANCH" || \
die "Could not push to $MASTER_BRANCH from $ORIGIN."
die "Could not push to $MASTER_BRANCH from $ORIGIN."
if noflag notag; then
if noflag notag; then
git push --tags "$ORIGIN" || \
git
_do
push --tags "$ORIGIN" || \
die "Could not push tags to $ORIGIN."
die "Could not push tags to $ORIGIN."
fi
fi
fi
fi
...
...
git-flow-init
View file @
15aab264
...
@@ -53,7 +53,7 @@ cmd_default() {
...
@@ -53,7 +53,7 @@ cmd_default() {
parse_args "$@"
parse_args "$@"
if ! git rev-parse --git-dir >/dev/null 2>&1; then
if ! git rev-parse --git-dir >/dev/null 2>&1; then
git init
git
_do
init
else
else
# assure that we are not working in a repo with local changes
# assure that we are not working in a repo with local changes
git_repo_is_headless || require_clean_working_tree
git_repo_is_headless || require_clean_working_tree
...
@@ -121,14 +121,14 @@ cmd_default() {
...
@@ -121,14 +121,14 @@ cmd_default() {
# name exists, checkout that branch and use it for master
# name exists, checkout that branch and use it for master
if ! git_local_branch_exists "$master_branch" && \
if ! git_local_branch_exists "$master_branch" && \
git_remote_branch_exists "origin/$master_branch"; then
git_remote_branch_exists "origin/$master_branch"; then
git branch "$master_branch" "origin/$master_branch" >/dev/null 2>&1
git
_do
branch "$master_branch" "origin/$master_branch" >/dev/null 2>&1
elif ! git_local_branch_exists "$master_branch"; then
elif ! git_local_branch_exists "$master_branch"; then
die "Local branch '$master_branch' does not exist."
die "Local branch '$master_branch' does not exist."
fi
fi
fi
fi
# store the name of the master branch
# store the name of the master branch
git config gitflow.branch.master "$master_branch"
git
_do
config gitflow.branch.master "$master_branch"
fi
fi
# add a develop branch if no such branch exists yet
# add a develop branch if no such branch exists yet
...
@@ -185,7 +185,7 @@ cmd_default() {
...
@@ -185,7 +185,7 @@ cmd_default() {
fi
fi
# store the name of the develop branch
# store the name of the develop branch
git config gitflow.branch.develop "$develop_branch"
git
_do
config gitflow.branch.develop "$develop_branch"
fi
fi
# Creation of HEAD
# Creation of HEAD
...
@@ -194,8 +194,8 @@ cmd_default() {
...
@@ -194,8 +194,8 @@ cmd_default() {
# it to be able to create new branches.
# it to be able to create new branches.
local created_gitflow_branch=0
local created_gitflow_branch=0
if ! git rev-parse --quiet --verify HEAD >/dev/null 2>&1; then
if ! git rev-parse --quiet --verify HEAD >/dev/null 2>&1; then
git symbolic-ref HEAD "refs/heads/$master_branch"
git
_do
symbolic-ref HEAD "refs/heads/$master_branch"
git commit --allow-empty --quiet -m "Initial commit"
git
_do
commit --allow-empty --quiet -m "Initial commit"
created_gitflow_branch=1
created_gitflow_branch=1
fi
fi
...
@@ -213,9 +213,9 @@ cmd_default() {
...
@@ -213,9 +213,9 @@ cmd_default() {
# the develop branch now in that case (we base it on master, of course)
# the develop branch now in that case (we base it on master, of course)
if ! git_local_branch_exists "$develop_branch"; then
if ! git_local_branch_exists "$develop_branch"; then
if git_remote_branch_exists "origin/$develop_branch"; then
if git_remote_branch_exists "origin/$develop_branch"; then
git branch "$develop_branch" "origin/$develop_branch" >/dev/null 2>&1
git
_do
branch "$develop_branch" "origin/$develop_branch" >/dev/null 2>&1
else
else
git branch --no-track "$develop_branch" "$master_branch"
git
_do
branch --no-track "$develop_branch" "$master_branch"
fi
fi
created_gitflow_branch=1
created_gitflow_branch=1
fi
fi
...
@@ -225,7 +225,7 @@ cmd_default() {
...
@@ -225,7 +225,7 @@ cmd_default() {
# switch to develop branch if its newly created
# switch to develop branch if its newly created
if [ $created_gitflow_branch -eq 1 ]; then
if [ $created_gitflow_branch -eq 1 ]; then
git checkout -q "$develop_branch"
git
_do
checkout -q "$develop_branch"
fi
fi
# finally, ask the user for naming conventions (branch and tag prefixes)
# finally, ask the user for naming conventions (branch and tag prefixes)
...
@@ -251,7 +251,7 @@ cmd_default() {
...
@@ -251,7 +251,7 @@ cmd_default() {
printf "\n"
printf "\n"
fi
fi
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
git config gitflow.prefix.feature "$prefix"
git
_do
config gitflow.prefix.feature "$prefix"
fi
fi
# Release branches
# Release branches
...
@@ -264,7 +264,7 @@ cmd_default() {
...
@@ -264,7 +264,7 @@ cmd_default() {
printf "\n"
printf "\n"
fi
fi
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
git config gitflow.prefix.release "$prefix"
git
_do
config gitflow.prefix.release "$prefix"
fi
fi
...
@@ -278,7 +278,7 @@ cmd_default() {
...
@@ -278,7 +278,7 @@ cmd_default() {
printf "\n"
printf "\n"
fi
fi
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
git config gitflow.prefix.hotfix "$prefix"
git
_do
config gitflow.prefix.hotfix "$prefix"
fi
fi
...
@@ -292,7 +292,7 @@ cmd_default() {
...
@@ -292,7 +292,7 @@ cmd_default() {
printf "\n"
printf "\n"
fi
fi
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
git config gitflow.prefix.support "$prefix"
git
_do
config gitflow.prefix.support "$prefix"
fi
fi
...
@@ -306,7 +306,7 @@ cmd_default() {
...
@@ -306,7 +306,7 @@ cmd_default() {
printf "\n"
printf "\n"
fi
fi
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
git config gitflow.prefix.versiontag "$prefix"
git
_do
config gitflow.prefix.versiontag "$prefix"
fi
fi
...
...
git-flow-release
View file @
15aab264
...
@@ -136,7 +136,7 @@ require_version_arg() {
...
@@ -136,7 +136,7 @@ require_version_arg() {
}
}
require_base_is_on_develop() {
require_base_is_on_develop() {
if ! git branch --no-color --contains "$BASE" 2>/dev/null \
if ! git
_do
branch --no-color --contains "$BASE" 2>/dev/null \
| sed 's/[* ] //g' \
| sed 's/[* ] //g' \
| grep -q "^$DEVELOP_BRANCH\$"; then
| grep -q "^$DEVELOP_BRANCH\$"; then
die "fatal: Given base '$BASE' is not a valid commit on '$DEVELOP_BRANCH'."
die "fatal: Given base '$BASE' is not a valid commit on '$DEVELOP_BRANCH'."
...
@@ -164,14 +164,14 @@ cmd_start() {
...
@@ -164,14 +164,14 @@ cmd_start() {
require_branch_absent "$BRANCH"
require_branch_absent "$BRANCH"
require_tag_absent "$VERSION_PREFIX$VERSION"
require_tag_absent "$VERSION_PREFIX$VERSION"
if flag fetch; then
if flag fetch; then
git fetch -q "$ORIGIN" "$DEVELOP_BRANCH"
git
_do
fetch -q "$ORIGIN" "$DEVELOP_BRANCH"
fi
fi
if has "$ORIGIN/$DEVELOP_BRANCH" $(git_remote_branches); then
if has "$ORIGIN/$DEVELOP_BRANCH" $(git_remote_branches); then
require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
fi
fi
# create branch
# create branch
git checkout -b "$BRANCH" "$BASE"
git
_do
checkout -b "$BRANCH" "$BASE"
echo
echo
echo "Summary of actions:"
echo "Summary of actions:"
...
@@ -210,9 +210,9 @@ cmd_finish() {
...
@@ -210,9 +210,9 @@ cmd_finish() {
require_branch "$BRANCH"
require_branch "$BRANCH"
require_clean_working_tree
require_clean_working_tree
if flag fetch; then
if flag fetch; then
git fetch -q "$ORIGIN" "$MASTER_BRANCH" || \
git
_do
fetch -q "$ORIGIN" "$MASTER_BRANCH" || \
die "Could not fetch $MASTER_BRANCH from $ORIGIN."
die "Could not fetch $MASTER_BRANCH from $ORIGIN."
git fetch -q "$ORIGIN" "$DEVELOP_BRANCH" || \
git
_do
fetch -q "$ORIGIN" "$DEVELOP_BRANCH" || \
die "Could not fetch $DEVELOP_BRANCH from $ORIGIN."
die "Could not fetch $DEVELOP_BRANCH from $ORIGIN."
fi
fi
if has "$ORIGIN/$MASTER_BRANCH" $(git_remote_branches); then
if has "$ORIGIN/$MASTER_BRANCH" $(git_remote_branches); then
...
@@ -226,16 +226,16 @@ cmd_finish() {
...
@@ -226,16 +226,16 @@ cmd_finish() {
# in case a previous attempt to finish this release branch has failed,
# in case a previous attempt to finish this release branch has failed,
# but the merge into master was successful, we skip it now
# but the merge into master was successful, we skip it now
if ! git_is_branch_merged_into "$BRANCH" "$MASTER_BRANCH"; then
if ! git_is_branch_merged_into "$BRANCH" "$MASTER_BRANCH"; then
git checkout "$MASTER_BRANCH" || \
git
_do
checkout "$MASTER_BRANCH" || \
die "Could not check out $MASTER_BRANCH."
die "Could not check out $MASTER_BRANCH."
if noflag squash; then
if noflag squash; then
git merge --no-ff "$BRANCH" || \
git
_do
merge --no-ff "$BRANCH" || \
die "There were merge conflicts."
die "There were merge conflicts."
# TODO: What do we do now?
# TODO: What do we do now?
else
else
git merge --squash "$BRANCH" || \
git
_do
merge --squash "$BRANCH" || \
die "There were merge conflicts."
die "There were merge conflicts."
git commit
git
_do
commit
fi
fi
fi
fi
...
@@ -250,7 +250,7 @@ cmd_finish() {
...
@@ -250,7 +250,7 @@ cmd_finish() {
[ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
[ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
[ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'"
[ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'"
[ "$FLAGS_messagefile" != "" ] && opts="$opts -F '$FLAGS_messagefile'"
[ "$FLAGS_messagefile" != "" ] && opts="$opts -F '$FLAGS_messagefile'"
eval git tag $opts "$tagname" "$BRANCH" || \
eval git
_do
tag $opts "$tagname" "$BRANCH" || \
die "Tagging failed. Please run finish again to retry."
die "Tagging failed. Please run finish again to retry."
fi
fi
fi
fi
...
@@ -259,41 +259,41 @@ cmd_finish() {
...
@@ -259,41 +259,41 @@ cmd_finish() {
# in case a previous attempt to finish this release branch has failed,
# in case a previous attempt to finish this release branch has failed,
# but the merge into develop was successful, we skip it now
# but the merge into develop was successful, we skip it now
if ! git_is_branch_merged_into "$BRANCH" "$DEVELOP_BRANCH"; then
if ! git_is_branch_merged_into "$BRANCH" "$DEVELOP_BRANCH"; then
git checkout "$DEVELOP_BRANCH" || \
git
_do
checkout "$DEVELOP_BRANCH" || \
die "Could not check out $DEVELOP_BRANCH."
die "Could not check out $DEVELOP_BRANCH."
# TODO: Actually, accounting for 'git describe' pays, so we should
# TODO: Actually, accounting for 'git describe' pays, so we should
# ideally git merge --no-ff $tagname here, instead!
# ideally git merge --no-ff $tagname here, instead!
if noflag squash; then
if noflag squash; then
git merge --no-ff "$BRANCH" || \
git
_do
merge --no-ff "$BRANCH" || \
die "There were merge conflicts."
die "There were merge conflicts."
# TODO: What do we do now?
# TODO: What do we do now?
else
else
git merge --squash "$BRANCH" || \
git
_do
merge --squash "$BRANCH" || \
die "There were merge conflicts."
die "There were merge conflicts."
# TODO: What do we do now?
# TODO: What do we do now?
git commit
git
_do
commit
fi
fi
fi
fi
# delete branch
# delete branch
if noflag keep; then
if noflag keep; then
if [ "$BRANCH" = "$(git_current_branch)" ]; then
if [ "$BRANCH" = "$(git_current_branch)" ]; then
git checkout "$MASTER_BRANCH"
git
_do
checkout "$MASTER_BRANCH"
fi
fi
git branch -d "$BRANCH"
git
_do
branch -d "$BRANCH"
fi
fi
if flag push; then
if flag push; then
git push "$ORIGIN" "$DEVELOP_BRANCH" || \
git
_do
push "$ORIGIN" "$DEVELOP_BRANCH" || \
die "Could not push to $DEVELOP_BRANCH from $ORIGIN."
die "Could not push to $DEVELOP_BRANCH from $ORIGIN."
git push "$ORIGIN" "$MASTER_BRANCH" || \
git
_do
push "$ORIGIN" "$MASTER_BRANCH" || \
die "Could not push to $MASTER_BRANCH from $ORIGIN."
die "Could not push to $MASTER_BRANCH from $ORIGIN."
if noflag notag; then
if noflag notag; then
git push --tags "$ORIGIN" || \
git
_do
push --tags "$ORIGIN" || \
die "Could not push tags to $ORIGIN."
die "Could not push tags to $ORIGIN."
fi
fi
git push "$ORIGIN" :"$BRANCH" || \
git
_do
push "$ORIGIN" :"$BRANCH" || \
die "Could not delete the remote $BRANCH in $ORIGIN."
die "Could not delete the remote $BRANCH in $ORIGIN."
fi
fi
...
@@ -324,17 +324,17 @@ cmd_publish() {
...
@@ -324,17 +324,17 @@ cmd_publish() {
# sanity checks
# sanity checks
require_clean_working_tree
require_clean_working_tree
require_branch "$BRANCH"
require_branch "$BRANCH"
git fetch -q "$ORIGIN"
git
_do
fetch -q "$ORIGIN"
require_branch_absent "$ORIGIN/$BRANCH"
require_branch_absent "$ORIGIN/$BRANCH"
# create remote branch
# create remote branch
git push "$ORIGIN" "$BRANCH:refs/heads/$BRANCH"
git
_do
push "$ORIGIN" "$BRANCH:refs/heads/$BRANCH"
git fetch -q "$ORIGIN"
git
_do
fetch -q "$ORIGIN"
# configure remote tracking
# configure remote tracking
git config "branch.$BRANCH.remote" "$ORIGIN"
git
_do
config "branch.$BRANCH.remote" "$ORIGIN"
git config "branch.$BRANCH.merge" "refs/heads/$BRANCH"
git
_do
config "branch.$BRANCH.merge" "refs/heads/$BRANCH"
git checkout "$BRANCH"
git
_do
checkout "$BRANCH"
echo
echo
echo "Summary of actions:"
echo "Summary of actions:"
...
@@ -351,11 +351,11 @@ cmd_track() {
...
@@ -351,11 +351,11 @@ cmd_track() {
# sanity checks
# sanity checks
require_clean_working_tree
require_clean_working_tree
require_branch_absent "$BRANCH"
require_branch_absent "$BRANCH"
git fetch -q "$ORIGIN"
git
_do
fetch -q "$ORIGIN"
require_branch "$ORIGIN/$BRANCH"
require_branch "$ORIGIN/$BRANCH"
# create tracking branch
# create tracking branch
git checkout -b "$BRANCH" "$ORIGIN/$BRANCH"
git
_do
checkout -b "$BRANCH" "$ORIGIN/$BRANCH"
echo
echo
echo "Summary of actions:"
echo "Summary of actions:"
...
...
git-flow-support
View file @
15aab264
...
@@ -169,12 +169,12 @@ cmd_start() {
...
@@ -169,12 +169,12 @@ cmd_start() {
# fetch remote changes
# fetch remote changes
if flag fetch; then
if flag fetch; then
git fetch -q "$ORIGIN" "$BASE"
git
_do
fetch -q "$ORIGIN" "$BASE"
fi
fi
require_branch_absent "$BRANCH"
require_branch_absent "$BRANCH"
# create branch
# create branch
git checkout -b "$BRANCH" "$BASE"
git
_do
checkout -b "$BRANCH" "$BASE"
echo
echo
echo "Summary of actions:"
echo "Summary of actions:"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment