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
Show 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() {
# update the local repo with remote changes, if asked
if flag fetch; then
git fetch -q "$ORIGIN" "$DEVELOP_BRANCH"
git
_do
fetch -q "$ORIGIN" "$DEVELOP_BRANCH"
fi
# if the origin branch counterpart exists, assert that the local branch
...
...
@@ -214,7 +214,7 @@ cmd_start() {
fi
# create branch
if ! git checkout -b "$BRANCH" "$BASE"; then
if ! git
_do
checkout -b "$BRANCH" "$BASE"; then
die "Could not create feature branch '$BRANCH'"
fi
...
...
@@ -287,8 +287,8 @@ cmd_finish() {
# update local repo with remote changes first, if asked
if has "$ORIGIN/$BRANCH" $(git_remote_branches); then
if flag fetch; then
git fetch -q "$ORIGIN" "$BRANCH"
git fetch -q "$ORIGIN" "$DEVELOP_BRANCH"
git
_do
fetch -q "$ORIGIN" "$BRANCH"
git
_do
fetch -q "$ORIGIN" "$DEVELOP_BRANCH"
fi
fi
...
...
@@ -311,16 +311,16 @@ cmd_finish() {
fi
# 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
git merge --ff "$BRANCH"
git
_do
merge --ff "$BRANCH"
else
if noflag squash; then
git merge --no-ff "$BRANCH"
git
_do
merge --no-ff "$BRANCH"
else
git merge --squash "$BRANCH"
git commit
git merge "$BRANCH"
git
_do
merge --squash "$BRANCH"
git
_do
commit
git
_do
merge "$BRANCH"
fi
fi
...
...
@@ -351,15 +351,15 @@ helper_finish_cleanup() {
# delete branch
if flag fetch; then
git push "$ORIGIN" ":refs/heads/$BRANCH"
git
_do
push "$ORIGIN" ":refs/heads/$BRANCH"
fi
if noflag keep; then
if flag force_delete; then
git branch -D "$BRANCH"
git
_do
branch -D "$BRANCH"
else
git branch -d "$BRANCH"
git
_do
branch -d "$BRANCH"
fi
fi
...
...
@@ -383,17 +383,17 @@ cmd_publish() {
# sanity checks
require_clean_working_tree
require_branch "$BRANCH"
git fetch -q "$ORIGIN"
git
_do
fetch -q "$ORIGIN"
require_branch_absent "$ORIGIN/$BRANCH"
# create remote branch
git push "$ORIGIN" "$BRANCH:refs/heads/$BRANCH"
git fetch -q "$ORIGIN"
git
_do
push "$ORIGIN" "$BRANCH:refs/heads/$BRANCH"
git
_do
fetch -q "$ORIGIN"
# configure remote tracking
git config "branch.$BRANCH.remote" "$ORIGIN"
git config "branch.$BRANCH.merge" "refs/heads/$BRANCH"
git checkout "$BRANCH"
git
_do
config "branch.$BRANCH.remote" "$ORIGIN"
git
_do
config "branch.$BRANCH.merge" "refs/heads/$BRANCH"
git
_do
checkout "$BRANCH"
echo
echo "Summary of actions:"
...
...
@@ -410,11 +410,11 @@ cmd_track() {
# sanity checks
require_clean_working_tree
require_branch_absent "$BRANCH"
git fetch -q "$ORIGIN"
git
_do
fetch -q "$ORIGIN"
require_branch "$ORIGIN/$BRANCH"
# create tracking branch
git checkout -b "$BRANCH" "$ORIGIN/$BRANCH"
git
_do
checkout -b "$BRANCH" "$ORIGIN/$BRANCH"
echo
echo "Summary of actions:"
...
...
@@ -445,7 +445,7 @@ cmd_checkout() {
if [ "$NAME" != "" ]; then
expand_nameprefix_arg
git checkout "$BRANCH"
git
_do
checkout "$BRANCH"
else
die "Name a feature branch explicitly."
fi
...
...
@@ -464,12 +464,12 @@ cmd_rebase() {
require_clean_working_tree
require_branch "$BRANCH"
git checkout -q "$BRANCH"
git
_do
checkout -q "$BRANCH"
local OPTS=
if flag interactive; then
OPTS="$OPTS -i"
fi
git rebase $OPTS "$DEVELOP_BRANCH"
git
_do
rebase $OPTS "$DEVELOP_BRANCH"
}
avoid_accidental_cross_branch_action() {
...
...
@@ -511,20 +511,20 @@ cmd_pull() {
# we already have a local branch called like this, so simply pull the
# remote changes in
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."
exit 1
fi
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
echo "Pulled $REMOTE's changes into $BRANCH."
else
# setup the local branch clone for the first time
git fetch -q "$REMOTE" "$BRANCH" || die "Fetch failed." # stores in FETCH_HEAD
git branch --no-track "$BRANCH" FETCH_HEAD || die "Branch failed."
git checkout -q "$BRANCH" || die "Checking out new local branch failed."
git
_do
fetch -q "$REMOTE" "$BRANCH" || die "Fetch failed." # stores in FETCH_HEAD
git
_do
branch --no-track "$BRANCH" FETCH_HEAD || die "Branch failed."
git
_do
checkout -q "$BRANCH" || die "Checking out new local branch failed."
echo "Created local branch $BRANCH based on $REMOTE's $BRANCH."
fi
}
git-flow-hotfix
View file @
15aab264
...
...
@@ -169,14 +169,14 @@ cmd_start() {
require_branch_absent "$BRANCH"
require_tag_absent "$VERSION_PREFIX$VERSION"
if flag fetch; then
git fetch -q "$ORIGIN" "$MASTER_BRANCH"
git
_do
fetch -q "$ORIGIN" "$MASTER_BRANCH"
fi
if has "$ORIGIN/$MASTER_BRANCH" $(git_remote_branches); then
require_branches_equal "$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH"
fi
# create branch
git checkout -b "$BRANCH" "$BASE"
git
_do
checkout -b "$BRANCH" "$BASE"
echo
echo "Summary of actions:"
...
...
@@ -199,17 +199,17 @@ cmd_publish() {
# sanity checks
require_clean_working_tree
require_branch "$BRANCH"
git fetch -q "$ORIGIN"
git
_do
fetch -q "$ORIGIN"
require_branch_absent "$ORIGIN/$BRANCH"
# create remote branch
git push "$ORIGIN" "$BRANCH:refs/heads/$BRANCH"
git fetch -q "$ORIGIN"
git
_do
push "$ORIGIN" "$BRANCH:refs/heads/$BRANCH"
git
_do
fetch -q "$ORIGIN"
# configure remote tracking
git config "branch.$BRANCH.remote" "$ORIGIN"
git config "branch.$BRANCH.merge" "refs/heads/$BRANCH"
git checkout "$BRANCH"
git
_do
checkout "$BRANCH"
echo
echo "Summary of actions:"
...
...
@@ -226,11 +226,11 @@ cmd_track() {
# sanity checks
require_clean_working_tree
require_branch_absent "$BRANCH"
git fetch -q "$ORIGIN"
git
_do
fetch -q "$ORIGIN"
require_branch "$ORIGIN/$BRANCH"
# create tracking branch
git checkout -b "$BRANCH" "$ORIGIN/$BRANCH"
git
_do
checkout -b "$BRANCH" "$ORIGIN/$BRANCH"
echo
echo "Summary of actions:"
...
...
@@ -260,9 +260,9 @@ cmd_finish() {
require_branch "$BRANCH"
require_clean_working_tree
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."
git fetch -q "$ORIGIN" "$DEVELOP_BRANCH" || \
git
_do
fetch -q "$ORIGIN" "$DEVELOP_BRANCH" || \
die "Could not fetch $DEVELOP_BRANCH from $ORIGIN."
fi
if has "$ORIGIN/$MASTER_BRANCH" $(git_remote_branches); then
...
...
@@ -276,9 +276,9 @@ cmd_finish() {
# in case a previous attempt to finish this release branch has failed,
# but the merge into master was successful, we skip it now
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."
git merge --no-ff "$BRANCH" || \
git
_do
merge --no-ff "$BRANCH" || \
die "There were merge conflicts."
# TODO: What do we do now?
fi
...
...
@@ -294,7 +294,7 @@ cmd_finish() {
[ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
[ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'"
[ "$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."
fi
fi
...
...
@@ -303,28 +303,28 @@ cmd_finish() {
# in case a previous attempt to finish this release branch has failed,
# but the merge into develop was successful, we skip it now
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."
# TODO: Actually, accounting for 'git describe' pays, so we should
# ideally git merge --no-ff $tagname here, instead!
git merge --no-ff "$BRANCH" || \
git
_do
merge --no-ff "$BRANCH" || \
die "There were merge conflicts."
# TODO: What do we do now?
fi
# delete branch
if noflag keep; then
git branch -d "$BRANCH"
git
_do
branch -d "$BRANCH"
fi
if flag push; then
git push "$ORIGIN" "$DEVELOP_BRANCH" || \
git
_do
push "$ORIGIN" "$DEVELOP_BRANCH" || \
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."
if noflag notag; then
git push --tags "$ORIGIN" || \
git
_do
push --tags "$ORIGIN" || \
die "Could not push tags to $ORIGIN."
fi
fi
...
...
git-flow-init
View file @
15aab264
...
...
@@ -53,7 +53,7 @@ cmd_default() {
parse_args "$@"
if ! git rev-parse --git-dir >/dev/null 2>&1; then
git init
git
_do
init
else
# assure that we are not working in a repo with local changes
git_repo_is_headless || require_clean_working_tree
...
...
@@ -121,14 +121,14 @@ cmd_default() {
# name exists, checkout that branch and use it for master
if ! git_local_branch_exists "$master_branch" && \
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
die "Local branch '$master_branch' does not exist."
fi
fi
# store the name of the master branch
git config gitflow.branch.master "$master_branch"
git
_do
config gitflow.branch.master "$master_branch"
fi
# add a develop branch if no such branch exists yet
...
...
@@ -185,7 +185,7 @@ cmd_default() {
fi
# store the name of the develop branch
git config gitflow.branch.develop "$develop_branch"
git
_do
config gitflow.branch.develop "$develop_branch"
fi
# Creation of HEAD
...
...
@@ -194,8 +194,8 @@ cmd_default() {
# it to be able to create new branches.
local created_gitflow_branch=0
if ! git rev-parse --quiet --verify HEAD >/dev/null 2>&1; then
git symbolic-ref HEAD "refs/heads/$master_branch"
git commit --allow-empty --quiet -m "Initial commit"
git
_do
symbolic-ref HEAD "refs/heads/$master_branch"
git
_do
commit --allow-empty --quiet -m "Initial commit"
created_gitflow_branch=1
fi
...
...
@@ -213,9 +213,9 @@ cmd_default() {
# the develop branch now in that case (we base it on master, of course)
if ! git_local_branch_exists "$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
git branch --no-track "$develop_branch" "$master_branch"
git
_do
branch --no-track "$develop_branch" "$master_branch"
fi
created_gitflow_branch=1
fi
...
...
@@ -225,7 +225,7 @@ cmd_default() {
# switch to develop branch if its newly created
if [ $created_gitflow_branch -eq 1 ]; then
git checkout -q "$develop_branch"
git
_do
checkout -q "$develop_branch"
fi
# finally, ask the user for naming conventions (branch and tag prefixes)
...
...
@@ -251,7 +251,7 @@ cmd_default() {
printf "\n"
fi
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
git config gitflow.prefix.feature "$prefix"
git
_do
config gitflow.prefix.feature "$prefix"
fi
# Release branches
...
...
@@ -264,7 +264,7 @@ cmd_default() {
printf "\n"
fi
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
git config gitflow.prefix.release "$prefix"
git
_do
config gitflow.prefix.release "$prefix"
fi
...
...
@@ -278,7 +278,7 @@ cmd_default() {
printf "\n"
fi
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
git config gitflow.prefix.hotfix "$prefix"
git
_do
config gitflow.prefix.hotfix "$prefix"
fi
...
...
@@ -292,7 +292,7 @@ cmd_default() {
printf "\n"
fi
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
git config gitflow.prefix.support "$prefix"
git
_do
config gitflow.prefix.support "$prefix"
fi
...
...
@@ -306,7 +306,7 @@ cmd_default() {
printf "\n"
fi
[ "$answer" = "-" ] && prefix= || prefix=${answer:-$default_suggestion}
git config gitflow.prefix.versiontag "$prefix"
git
_do
config gitflow.prefix.versiontag "$prefix"
fi
...
...
git-flow-release
View file @
15aab264
...
...
@@ -136,7 +136,7 @@ require_version_arg() {
}
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' \
| grep -q "^$DEVELOP_BRANCH\$"; then
die "fatal: Given base '$BASE' is not a valid commit on '$DEVELOP_BRANCH'."
...
...
@@ -164,14 +164,14 @@ cmd_start() {
require_branch_absent "$BRANCH"
require_tag_absent "$VERSION_PREFIX$VERSION"
if flag fetch; then
git fetch -q "$ORIGIN" "$DEVELOP_BRANCH"
git
_do
fetch -q "$ORIGIN" "$DEVELOP_BRANCH"
fi
if has "$ORIGIN/$DEVELOP_BRANCH" $(git_remote_branches); then
require_branches_equal "$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
fi
# create branch
git checkout -b "$BRANCH" "$BASE"
git
_do
checkout -b "$BRANCH" "$BASE"
echo
echo "Summary of actions:"
...
...
@@ -210,9 +210,9 @@ cmd_finish() {
require_branch "$BRANCH"
require_clean_working_tree
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."
git fetch -q "$ORIGIN" "$DEVELOP_BRANCH" || \
git
_do
fetch -q "$ORIGIN" "$DEVELOP_BRANCH" || \
die "Could not fetch $DEVELOP_BRANCH from $ORIGIN."
fi
if has "$ORIGIN/$MASTER_BRANCH" $(git_remote_branches); then
...
...
@@ -226,16 +226,16 @@ cmd_finish() {
# in case a previous attempt to finish this release branch has failed,
# but the merge into master was successful, we skip it now
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."
if noflag squash; then
git merge --no-ff "$BRANCH" || \
git
_do
merge --no-ff "$BRANCH" || \
die "There were merge conflicts."
# TODO: What do we do now?
else
git merge --squash "$BRANCH" || \
git
_do
merge --squash "$BRANCH" || \
die "There were merge conflicts."
git commit
git
_do
commit
fi
fi
...
...
@@ -250,7 +250,7 @@ cmd_finish() {
[ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
[ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'"
[ "$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."
fi
fi
...
...
@@ -259,41 +259,41 @@ cmd_finish() {
# in case a previous attempt to finish this release branch has failed,
# but the merge into develop was successful, we skip it now
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."
# TODO: Actually, accounting for 'git describe' pays, so we should
# ideally git merge --no-ff $tagname here, instead!
if noflag squash; then
git merge --no-ff "$BRANCH" || \
git
_do
merge --no-ff "$BRANCH" || \
die "There were merge conflicts."
# TODO: What do we do now?
else
git merge --squash "$BRANCH" || \
git
_do
merge --squash "$BRANCH" || \
die "There were merge conflicts."
# TODO: What do we do now?
git commit
git
_do
commit
fi
fi
# delete branch
if noflag keep; then
if [ "$BRANCH" = "$(git_current_branch)" ]; then
git checkout "$MASTER_BRANCH"
git
_do
checkout "$MASTER_BRANCH"
fi
git branch -d "$BRANCH"
git
_do
branch -d "$BRANCH"
fi
if flag push; then
git push "$ORIGIN" "$DEVELOP_BRANCH" || \
git
_do
push "$ORIGIN" "$DEVELOP_BRANCH" || \
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."
if noflag notag; then
git push --tags "$ORIGIN" || \
git
_do
push --tags "$ORIGIN" || \
die "Could not push tags to $ORIGIN."
fi
git push "$ORIGIN" :"$BRANCH" || \
git
_do
push "$ORIGIN" :"$BRANCH" || \
die "Could not delete the remote $BRANCH in $ORIGIN."
fi
...
...
@@ -324,17 +324,17 @@ cmd_publish() {
# sanity checks
require_clean_working_tree
require_branch "$BRANCH"
git fetch -q "$ORIGIN"
git
_do
fetch -q "$ORIGIN"
require_branch_absent "$ORIGIN/$BRANCH"
# create remote branch
git push "$ORIGIN" "$BRANCH:refs/heads/$BRANCH"
git fetch -q "$ORIGIN"
git
_do
push "$ORIGIN" "$BRANCH:refs/heads/$BRANCH"
git
_do
fetch -q "$ORIGIN"
# configure remote tracking
git config "branch.$BRANCH.remote" "$ORIGIN"
git config "branch.$BRANCH.merge" "refs/heads/$BRANCH"
git checkout "$BRANCH"
git
_do
config "branch.$BRANCH.remote" "$ORIGIN"
git
_do
config "branch.$BRANCH.merge" "refs/heads/$BRANCH"
git
_do
checkout "$BRANCH"
echo
echo "Summary of actions:"
...
...
@@ -351,11 +351,11 @@ cmd_track() {
# sanity checks
require_clean_working_tree
require_branch_absent "$BRANCH"
git fetch -q "$ORIGIN"
git
_do
fetch -q "$ORIGIN"
require_branch "$ORIGIN/$BRANCH"
# create tracking branch
git checkout -b "$BRANCH" "$ORIGIN/$BRANCH"
git
_do
checkout -b "$BRANCH" "$ORIGIN/$BRANCH"
echo
echo "Summary of actions:"
...
...
git-flow-support
View file @
15aab264
...
...
@@ -169,12 +169,12 @@ cmd_start() {
# fetch remote changes
if flag fetch; then
git fetch -q "$ORIGIN" "$BASE"
git
_do
fetch -q "$ORIGIN" "$BASE"
fi
require_branch_absent "$BRANCH"
# create branch
git checkout -b "$BRANCH" "$BASE"
git
_do
checkout -b "$BRANCH" "$BASE"
echo
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