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
99c80527
Commit
99c80527
authored
Feb 10, 2010
by
Vincent Driessen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/quote-all-var-params' into develop
parents
fafa2b28
b673c445
Changes
6
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
119 additions
and
119 deletions
+119
-119
git-flow-feature
git-flow-feature
+38
-38
git-flow-hotfix
git-flow-hotfix
+27
-27
git-flow-init
git-flow-init
+14
-14
git-flow-release
git-flow-release
+26
-26
git-flow-support
git-flow-support
+11
-11
gitflow-common
gitflow-common
+3
-3
No files found.
git-flow-feature
View file @
99c80527
...
@@ -35,7 +35,7 @@ cmd_list() {
...
@@ -35,7 +35,7 @@ cmd_list() {
typeset feature_branches
typeset feature_branches
typeset current_branch
typeset current_branch
typeset short_names
typeset short_names
feature_branches=
"$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")"
feature_branches=
$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")
if [ -z "$feature_branches" ]; then
if [ -z "$feature_branches" ]; then
warn "No feature branches exist."
warn "No feature branches exist."
exit 0
exit 0
...
@@ -54,7 +54,7 @@ cmd_list() {
...
@@ -54,7 +54,7 @@ cmd_list() {
typeset branch
typeset branch
for branch in $short_names; do
for branch in $short_names; do
typeset fullname=
"$PREFIX$branch"
typeset fullname=
$PREFIX$branch
typeset base=$(git merge-base "$fullname" "$DEVELOP_BRANCH")
typeset base=$(git merge-base "$fullname" "$DEVELOP_BRANCH")
typeset develop_sha=$(git rev-parse "$DEVELOP_BRANCH")
typeset develop_sha=$(git rev-parse "$DEVELOP_BRANCH")
typeset branch_sha=$(git rev-parse "$fullname")
typeset branch_sha=$(git rev-parse "$fullname")
...
@@ -133,7 +133,7 @@ parse_args() {
...
@@ -133,7 +133,7 @@ parse_args() {
eval set -- "${FLAGS_ARGV}"
eval set -- "${FLAGS_ARGV}"
# read arguments into global variables
# read arguments into global variables
NAME=
"$1"
NAME=
$1
BRANCH=$PREFIX$NAME
BRANCH=$PREFIX$NAME
}
}
...
@@ -141,24 +141,24 @@ cmd_start() {
...
@@ -141,24 +141,24 @@ cmd_start() {
DEFINE_boolean fetch false 'fetch from origin before performing local operation' F
DEFINE_boolean fetch false 'fetch from origin before performing local operation' F
DEFINE_boolean force false 'force creation of feature branch (ignores dirty working tree)' f
DEFINE_boolean force false 'force creation of feature branch (ignores dirty working tree)' f
parse_args "$@"
parse_args "$@"
BASE=
"${2:-$DEVELOP_BRANCH}"
BASE=
${2:-$DEVELOP_BRANCH}
require_name_arg
require_name_arg
# sanity checks
# sanity checks
if noflag force; then
if noflag force; then
gitflow_require_clean_working_tree
gitflow_require_clean_working_tree
fi
fi
gitflow_require_branch_absent
$BRANCH
gitflow_require_branch_absent
"$BRANCH"
# 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 fetch -q
"$ORIGIN" "$DEVELOP_BRANCH"
fi
fi
gitflow_require_branches_equal
$DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH
gitflow_require_branches_equal
"$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
# create branch
# create branch
if ! git checkout -b
$BRANCH $BASE
; then
if ! git checkout -b
"$BRANCH" "$BASE"
; then
die "Could not create feature branch '$BRANCH'"
die "Could not create feature branch '$BRANCH'"
fi
fi
...
@@ -181,7 +181,7 @@ cmd_finish() {
...
@@ -181,7 +181,7 @@ cmd_finish() {
expand_nameprefix_arg
expand_nameprefix_arg
# sanity checks
# sanity checks
gitflow_require_branch
$BRANCH
gitflow_require_branch
"$BRANCH"
# detect if we're restoring from a merge conflict
# detect if we're restoring from a merge conflict
if [ -f "$GIT_DIR/.gitflow/MERGE_BASE" ]; then
if [ -f "$GIT_DIR/.gitflow/MERGE_BASE" ]; then
...
@@ -195,12 +195,12 @@ cmd_finish() {
...
@@ -195,12 +195,12 @@ cmd_finish() {
# exit code for "unmerged changes in working tree", which we should
# exit code for "unmerged changes in working tree", which we should
# actually be testing for here
# actually be testing for here
if gitflow_test_clean_working_tree; then
if gitflow_test_clean_working_tree; then
FINISH_BASE=
"$(cat "$GIT_DIR/.gitflow/MERGE_BASE")"
FINISH_BASE=
$(cat "$GIT_DIR/.gitflow/MERGE_BASE")
# Since the working tree is now clean, either the user did a
# Since the working tree is now clean, either the user did a
# succesfull merge manually, or the merge was cancelled.
# succesfull merge manually, or the merge was cancelled.
# We detect this using gitflow_is_branch_merged_into()
# We detect this using gitflow_is_branch_merged_into()
if gitflow_is_branch_merged_into
$BRANCH $FINISH_BASE
; then
if gitflow_is_branch_merged_into
"$BRANCH" "$FINISH_BASE"
; then
rm -f "$GIT_DIR/.gitflow/MERGE_BASE"
rm -f "$GIT_DIR/.gitflow/MERGE_BASE"
helper_finish_cleanup
helper_finish_cleanup
exit 0
exit 0
...
@@ -228,13 +228,13 @@ cmd_finish() {
...
@@ -228,13 +228,13 @@ cmd_finish() {
# update local repo with remote changes first, if asked
# update local repo with remote changes first, if asked
if flag fetch; then
if flag fetch; then
git fetch -q
$ORIGIN $BRANCH
git fetch -q
"$ORIGIN" "$BRANCH"
fi
fi
if has
$ORIGIN/$BRANCH $REMOTE_BRANCHES
; then
if has
"$ORIGIN/$BRANCH" "$REMOTE_BRANCHES"
; then
gitflow_require_branches_equal
$BRANCH $ORIGIN/$BRANCH
gitflow_require_branches_equal
"$BRANCH" "$ORIGIN/$BRANCH"
fi
fi
gitflow_require_branches_equal
$DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH
gitflow_require_branches_equal
"$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
# if the user wants to rebase, do that first
# if the user wants to rebase, do that first
if flag rebase; then
if flag rebase; then
...
@@ -248,11 +248,11 @@ cmd_finish() {
...
@@ -248,11 +248,11 @@ cmd_finish() {
fi
fi
# merge into BASE
# merge into BASE
git checkout
$DEVELOP_BRANCH
git 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 merge --ff
"$BRANCH"
else
else
git merge --no-ff
$BRANCH
git merge --no-ff
"$BRANCH"
fi
fi
if [ $? -ne 0 ]; then
if [ $? -ne 0 ]; then
...
@@ -277,14 +277,14 @@ cmd_finish() {
...
@@ -277,14 +277,14 @@ cmd_finish() {
helper_finish_cleanup() {
helper_finish_cleanup() {
# sanity checks
# sanity checks
gitflow_require_branch
$BRANCH
gitflow_require_branch
"$BRANCH"
gitflow_require_clean_working_tree
gitflow_require_clean_working_tree
# delete branch
# delete branch
if flag fetch; then
if flag fetch; then
git push
$ORIGIN :refs/heads/$BRANCH
git push
"$ORIGIN" ":refs/heads/$BRANCH"
fi
fi
git branch -d
$BRANCH
git branch -d
"$BRANCH"
echo
echo
echo "Summary of actions:"
echo "Summary of actions:"
...
@@ -301,18 +301,18 @@ cmd_publish() {
...
@@ -301,18 +301,18 @@ cmd_publish() {
# sanity checks
# sanity checks
gitflow_require_clean_working_tree
gitflow_require_clean_working_tree
gitflow_require_branch
$BRANCH
gitflow_require_branch
"$BRANCH"
git fetch -q
$ORIGIN
git fetch -q
"$ORIGIN"
gitflow_require_branch_absent
$ORIGIN/$BRANCH
gitflow_require_branch_absent
"$ORIGIN/$BRANCH"
# create remote branch
# create remote branch
git push
$ORIGIN $BRANCH:refs/heads/$BRANCH
git push
"$ORIGIN" "$BRANCH:refs/heads/$BRANCH"
git fetch -q
$ORIGIN
git 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 checkout
"$BRANCH"
echo
echo
echo "Summary of actions:"
echo "Summary of actions:"
...
@@ -328,12 +328,12 @@ cmd_track() {
...
@@ -328,12 +328,12 @@ cmd_track() {
# sanity checks
# sanity checks
gitflow_require_clean_working_tree
gitflow_require_clean_working_tree
gitflow_require_branch_absent
$BRANCH
gitflow_require_branch_absent
"$BRANCH"
git fetch -q
$ORIGIN
git fetch -q
"$ORIGIN"
gitflow_require_branch
$ORIGIN/$BRANCH
gitflow_require_branch
"$ORIGIN/$BRANCH"
# create tracking branch
# create tracking branch
git checkout -b
$BRANCH $ORIGIN/$BRANCH
git checkout -b
"$BRANCH" "$ORIGIN/$BRANCH"
echo
echo
echo "Summary of actions:"
echo "Summary of actions:"
...
@@ -347,15 +347,15 @@ cmd_diff() {
...
@@ -347,15 +347,15 @@ cmd_diff() {
if [ "$NAME" != "" ]; then
if [ "$NAME" != "" ]; then
expand_nameprefix_arg
expand_nameprefix_arg
BASE=$(git merge-base
$DEVELOP_BRANCH $BRANCH
)
BASE=$(git merge-base
"$DEVELOP_BRANCH" "$BRANCH"
)
git diff
$BASE..$BRANCH
git diff
"$BASE..$BRANCH"
else
else
if ! gitflow_current_branch | grep -q "^$PREFIX"; then
if ! gitflow_current_branch | grep -q "^$PREFIX"; then
die "Not on a feature branch. Name one explicitly."
die "Not on a feature branch. Name one explicitly."
fi
fi
BASE=$(git merge-base
$DEVELOP_BRANCH
HEAD)
BASE=$(git merge-base
"$DEVELOP_BRANCH"
HEAD)
git diff
$BASE
git diff
"$BASE"
fi
fi
}
}
...
...
git-flow-hotfix
View file @
99c80527
...
@@ -32,26 +32,26 @@ cmd_list() {
...
@@ -32,26 +32,26 @@ cmd_list() {
typeset hotfix_branches
typeset hotfix_branches
typeset current_branch
typeset current_branch
typeset short_names
typeset short_names
hotfix_branches=
"$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")"
hotfix_branches=
$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")
if [ -z "$hotfix_branches" ]; then
if [ -z "$hotfix_branches" ]; then
warn "No hotfix branches exist."
warn "No hotfix branches exist."
exit 0
exit 0
fi
fi
current_branch=$(git branch | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
current_branch=$(git branch | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
short_names=$(echo "$hotfix_branches" | sed "s
?^$PREFIX??
g")
short_names=$(echo "$hotfix_branches" | sed "s
^$PREFIX
g")
# determine column width first
# determine column width first
typeset -i width=0
typeset -i width=0
typeset branch
typeset branch
for branch in $short_names; do
for branch in $short_names; do
typeset -i len=$
(($(echo "$branch" | wc -c) - 1))
typeset -i len=$
{#branch}
width=$(max $width $len)
width=$(max $width $len)
done
done
width=width+3
width=width+3
typeset branch
typeset branch
for branch in $short_names; do
for branch in $short_names; do
typeset fullname=
"$PREFIX$branch"
typeset fullname=
$PREFIX$branch
typeset base=$(git merge-base "$fullname" "$MASTER_BRANCH")
typeset base=$(git merge-base "$fullname" "$MASTER_BRANCH")
typeset master_sha=$(git rev-parse "$MASTER_BRANCH")
typeset master_sha=$(git rev-parse "$MASTER_BRANCH")
typeset branch_sha=$(git rev-parse "$fullname")
typeset branch_sha=$(git rev-parse "$fullname")
...
@@ -65,12 +65,12 @@ cmd_list() {
...
@@ -65,12 +65,12 @@ cmd_list() {
if [ "$branch_sha" = "$master_sha" ]; then
if [ "$branch_sha" = "$master_sha" ]; then
printf "(no commits yet)"
printf "(no commits yet)"
else
else
typeset tagname=$(git name-rev --tags --no-undefined --name-only
$base
)
typeset tagname=$(git name-rev --tags --no-undefined --name-only
"$base"
)
typeset nicename
typeset nicename
if [ "$tagname" != "" ]; then
if [ "$tagname" != "" ]; then
nicename=
"$tagname"
nicename=
$tagname
else
else
nicename=
"$(git rev-parse --short $base)"
nicename=
$(git rev-parse --short "$base")
fi
fi
printf "(based on $nicename)"
printf "(based on $nicename)"
fi
fi
...
@@ -92,7 +92,7 @@ parse_args() {
...
@@ -92,7 +92,7 @@ parse_args() {
eval set -- "${FLAGS_ARGV}"
eval set -- "${FLAGS_ARGV}"
# read arguments into global variables
# read arguments into global variables
VERSION=
"$1"
VERSION=
$1
BRANCH=$PREFIX$VERSION
BRANCH=$PREFIX$VERSION
}
}
...
@@ -115,21 +115,21 @@ require_base_is_on_master() {
...
@@ -115,21 +115,21 @@ require_base_is_on_master() {
cmd_start() {
cmd_start() {
DEFINE_boolean fetch true "fetch from $ORIGIN before performing finish" F
DEFINE_boolean fetch true "fetch from $ORIGIN before performing finish" F
parse_args "$@"
parse_args "$@"
BASE=
"${2:-$MASTER_BRANCH}"
BASE=
${2:-$MASTER_BRANCH}
require_version_arg
require_version_arg
require_base_is_on_master
require_base_is_on_master
# sanity checks
# sanity checks
gitflow_require_clean_working_tree
gitflow_require_clean_working_tree
gitflow_require_branch_absent
$BRANCH
gitflow_require_branch_absent
"$BRANCH"
gitflow_require_tag_absent
$VERSION_PREFIX$VERSION
gitflow_require_tag_absent
"$VERSION_PREFIX$VERSION"
if flag fetch; then
if flag fetch; then
git fetch -q
$ORIGIN $MASTER_BRANCH
git fetch -q
"$ORIGIN" "$MASTER_BRANCH"
fi
fi
gitflow_require_branches_equal
$MASTER_BRANCH $ORIGIN/$MASTER_BRANCH
gitflow_require_branches_equal
"$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH"
# create branch
# create branch
git checkout -b
$BRANCH $BASE
git checkout -b
"$BRANCH" "$BASE"
echo
echo
echo "Summary of actions:"
echo "Summary of actions:"
...
@@ -159,24 +159,24 @@ cmd_finish() {
...
@@ -159,24 +159,24 @@ cmd_finish() {
fi
fi
# sanity checks
# sanity checks
gitflow_require_branch
$BRANCH
gitflow_require_branch
"$BRANCH"
gitflow_require_clean_working_tree
gitflow_require_clean_working_tree
if flag fetch; then
if flag fetch; then
git fetch -q
$ORIGIN $MASTER_BRANCH
|| \
git 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 fetch -q
"$ORIGIN" "$DEVELOP_BRANCH"
|| \
die "Could not fetch $DEVELOP_BRANCH from $ORIGIN."
die "Could not fetch $DEVELOP_BRANCH from $ORIGIN."
fi
fi
gitflow_require_branches_equal
$MASTER_BRANCH $ORIGIN/$MASTER_BRANCH
gitflow_require_branches_equal
"$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH"
gitflow_require_branches_equal
$DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH
gitflow_require_branches_equal
"$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
# try to merge into master
# try to merge into master
# 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 ! gitflow_is_branch_merged_into
$BRANCH $MASTER_BRANCH
; then
if ! gitflow_is_branch_merged_into
"$BRANCH" "$MASTER_BRANCH"
; then
git checkout
$MASTER_BRANCH
|| \
git checkout
"$MASTER_BRANCH"
|| \
die "Could not check out $MASTER_BRANCH."
die "Could not check out $MASTER_BRANCH."
git merge --no-ff
$BRANCH
|| \
git 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
...
@@ -185,7 +185,7 @@ cmd_finish() {
...
@@ -185,7 +185,7 @@ 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 tag was set successful, we skip it now
# but the tag was set successful, we skip it now
typeset tagname=$VERSION_PREFIX$VERSION
typeset tagname=$VERSION_PREFIX$VERSION
if ! gitflow_tag_exists
$tagname
; then
if ! gitflow_tag_exists
"$tagname"
; then
typeset opts="-a"
typeset opts="-a"
flag sign && opts="$opts -s"
flag sign && opts="$opts -s"
[ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
[ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
...
@@ -197,19 +197,19 @@ cmd_finish() {
...
@@ -197,19 +197,19 @@ cmd_finish() {
# try to merge into develop
# try to merge into develop
# 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 ! gitflow_is_branch_merged_into
$BRANCH $DEVELOP_BRANCH
; then
if ! gitflow_is_branch_merged_into
"$BRANCH" "$DEVELOP_BRANCH"
; then
git checkout
$DEVELOP_BRANCH
|| \
git 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 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
git branch -d
$BRANCH
git branch -d
"$BRANCH"
# TODO: Implement an optional push to master
# TODO: Implement an optional push to master
# git push origin develop; git push origin master; git push --tags origin
# git push origin develop; git push origin master; git push --tags origin
...
...
git-flow-init
View file @
99c80527
...
@@ -27,47 +27,47 @@ cmd_default() {
...
@@ -27,47 +27,47 @@ cmd_default() {
fi
fi
if ! git rev-parse --quiet --verify HEAD 2>&1 >/dev/null; then
if ! git rev-parse --quiet --verify HEAD 2>&1 >/dev/null; then
touch
$README
touch
"$README"
git add
$README
git add
"$README"
git commit --quiet -m "initial commit"
git commit --quiet -m "initial commit"
if [ "$MASTER_BRANCH" != "master" ]; then
if [ "$MASTER_BRANCH" != "master" ]; then
git branch -m master
$MASTER_BRANCH
git branch -m master
"$MASTER_BRANCH"
fi
fi
echo "- An initial commit was created at branch '$MASTER_BRANCH'"
echo "- An initial commit was created at branch '$MASTER_BRANCH'"
fi
fi
if ! git rev-parse --verify
$MASTER_BRANCH
2>&1 >/dev/null; then
if ! git rev-parse --verify
"$MASTER_BRANCH"
2>&1 >/dev/null; then
die "Cannot find your master branch. Try: git branch -m <mymaster> $MASTER_BRANCH"
die "Cannot find your master branch. Try: git branch -m <mymaster> $MASTER_BRANCH"
fi
fi
gitflow_require_clean_working_tree
gitflow_require_clean_working_tree
if git remote | grep -q
$ORIGIN
; then
if git remote | grep -q
"$ORIGIN"
; then
git fetch -q
$ORIGIN
git fetch -q
"$ORIGIN"
gitflow_require_branches_equal
$MASTER_BRANCH $ORIGIN/$MASTER_BRANCH
gitflow_require_branches_equal
"$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH"
fi
fi
if git rev-parse --verify
$DEVELOP_BRANCH
2>&1 >/dev/null; then
if git rev-parse --verify
"$DEVELOP_BRANCH"
2>&1 >/dev/null; then
gitflow_require_branches_equal
$DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH
gitflow_require_branches_equal
"$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
else
else
git checkout -q -b
$DEVELOP_BRANCH $MASTER_BRANCH
git checkout -q -b
"$DEVELOP_BRANCH" "$MASTER_BRANCH"
echo "- A new branch '$DEVELOP_BRANCH' was created"
echo "- A new branch '$DEVELOP_BRANCH' was created"
echo "- You are now on branch '$DEVELOP_BRANCH'"
echo "- You are now on branch '$DEVELOP_BRANCH'"
fi
fi
if ! git remote | grep -q
$ORIGIN
; then
if ! git remote | grep -q
"$ORIGIN"
; then
if [ "$1" = "" ]; then
if [ "$1" = "" ]; then
echo "- No remote location was added. Try: git remote add $ORIGIN <url>"
echo "- No remote location was added. Try: git remote add $ORIGIN <url>"
else
else
git remote add
$ORIGIN $1
git remote add
"$ORIGIN" "$1"
echo "- A new remote location '$1' was added"
echo "- A new remote location '$1' was added"
fi
fi
fi
fi
echo
echo
if git remote | grep -q
$ORIGIN
; then
if git remote | grep -q
"$ORIGIN"
; then
git push
$ORIGIN $MASTER_BRANCH $DEVELOP_BRANCH
git push
"$ORIGIN" "$MASTER_BRANCH" "$DEVELOP_BRANCH"
fi
fi
}
}
...
...
git-flow-release
View file @
99c80527
...
@@ -43,27 +43,27 @@ cmd_list() {
...
@@ -43,27 +43,27 @@ cmd_list() {
typeset release_branches
typeset release_branches
typeset current_branch
typeset current_branch
typeset short_names
typeset short_names
release_branches=
"$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")"
release_branches=
$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")
if [ -z "$release_branches" ]; then
if [ -z "$release_branches" ]; then
warn "No release branches exist."
warn "No release branches exist."
exit 0
exit 0
fi
fi
current_branch=$(git branch | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
current_branch=$(git branch | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
short_names=$(echo "$release_branches" | sed "s
?^$PREFIX??
g")
short_names=$(echo "$release_branches" | sed "s
^$PREFIX
g")
# determine column width first
# determine column width first
typeset -i width=0
typeset -i width=0
typeset branch
typeset branch
for branch in $short_names; do
for branch in $short_names; do
typeset -i len=$
(($(echo "$branch" | wc -c) - 1))
typeset -i len=$
{#branch}
width=$(max $width $len)
width=$(max $width $len)
done
done
width=width+3
width=width+3
typeset branch
typeset branch
for branch in $short_names; do
for branch in $short_names; do
typeset fullname=
"$PREFIX$branch"
typeset fullname=
$PREFIX$branch
typeset base=$(git merge-base "$fullname" "$DEVELOP_BRANCH")
typeset base=$(git merge-base "$fullname" "$DEVELOP_BRANCH")
typeset develop_sha=$(git rev-parse "$DEVELOP_BRANCH")
typeset develop_sha=$(git rev-parse "$DEVELOP_BRANCH")
typeset branch_sha=$(git rev-parse "$fullname")
typeset branch_sha=$(git rev-parse "$fullname")
...
@@ -77,7 +77,7 @@ cmd_list() {
...
@@ -77,7 +77,7 @@ cmd_list() {
if [ "$branch_sha" = "$develop_sha" ]; then
if [ "$branch_sha" = "$develop_sha" ]; then
printf "(no commits yet)"
printf "(no commits yet)"
else
else
typeset nicename=
"$(git rev-parse --short $base)"
typeset nicename=
$(git rev-parse --short "$base")
printf "(based on $nicename)"
printf "(based on $nicename)"
fi
fi
else
else
...
@@ -98,8 +98,8 @@ parse_args() {
...
@@ -98,8 +98,8 @@ parse_args() {
eval set -- "${FLAGS_ARGV}"
eval set -- "${FLAGS_ARGV}"
# read arguments into global variables
# read arguments into global variables
VERSION=
"$1"
VERSION=
$1
BRANCH=
"$PREFIX$VERSION"
BRANCH=
$PREFIX$VERSION
}
}
require_version_arg() {
require_version_arg() {
...
@@ -121,21 +121,21 @@ require_base_is_on_develop() {
...
@@ -121,21 +121,21 @@ require_base_is_on_develop() {
cmd_start() {
cmd_start() {
DEFINE_boolean fetch true "fetch from $ORIGIN before performing finish" F
DEFINE_boolean fetch true "fetch from $ORIGIN before performing finish" F
parse_args "$@"
parse_args "$@"
BASE=
"${2:-$DEVELOP_BRANCH}"
BASE=
${2:-$DEVELOP_BRANCH}
require_version_arg
require_version_arg
require_base_is_on_develop
require_base_is_on_develop
# sanity checks
# sanity checks
gitflow_require_clean_working_tree
gitflow_require_clean_working_tree
gitflow_require_branch_absent
$BRANCH
gitflow_require_branch_absent
"$BRANCH"
gitflow_require_tag_absent
$VERSION_PREFIX$VERSION
gitflow_require_tag_absent
"$VERSION_PREFIX$VERSION"
if flag fetch; then
if flag fetch; then
git fetch -q
$ORIGIN $DEVELOP_BRANCH
git fetch -q
"$ORIGIN" "$DEVELOP_BRANCH"
fi
fi
gitflow_require_branches_equal
$DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH
gitflow_require_branches_equal
"$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
# create branch
# create branch
git checkout -b
$BRANCH $BASE
git checkout -b
"$BRANCH" "$BASE"
echo
echo
echo "Summary of actions:"
echo "Summary of actions:"
...
@@ -165,24 +165,24 @@ cmd_finish() {
...
@@ -165,24 +165,24 @@ cmd_finish() {
fi
fi
# sanity checks
# sanity checks
gitflow_require_branch
$BRANCH
gitflow_require_branch
"$BRANCH"
gitflow_require_clean_working_tree
gitflow_require_clean_working_tree
if flag fetch; then
if flag fetch; then
git fetch -q
$ORIGIN $MASTER_BRANCH
|| \
git 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 fetch -q
"$ORIGIN" "$DEVELOP_BRANCH"
|| \
die "Could not fetch $DEVELOP_BRANCH from $ORIGIN."
die "Could not fetch $DEVELOP_BRANCH from $ORIGIN."
fi
fi
gitflow_require_branches_equal
$MASTER_BRANCH $ORIGIN/$MASTER_BRANCH
gitflow_require_branches_equal
"$MASTER_BRANCH" "$ORIGIN/$MASTER_BRANCH"
gitflow_require_branches_equal
$DEVELOP_BRANCH $ORIGIN/$DEVELOP_BRANCH
gitflow_require_branches_equal
"$DEVELOP_BRANCH" "$ORIGIN/$DEVELOP_BRANCH"
# try to merge into master
# try to merge into master
# 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 ! gitflow_is_branch_merged_into
$BRANCH $MASTER_BRANCH
; then
if ! gitflow_is_branch_merged_into
"$BRANCH" "$MASTER_BRANCH"
; then
git checkout
$MASTER_BRANCH
|| \
git checkout
"$MASTER_BRANCH"
|| \
die "Could not check out $MASTER_BRANCH."
die "Could not check out $MASTER_BRANCH."
git merge --no-ff
$BRANCH
|| \
git 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
...
@@ -191,7 +191,7 @@ cmd_finish() {
...
@@ -191,7 +191,7 @@ 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 tag was set successful, we skip it now
# but the tag was set successful, we skip it now
typeset tagname=$VERSION_PREFIX$VERSION
typeset tagname=$VERSION_PREFIX$VERSION
if ! gitflow_tag_exists
$tagname
; then
if ! gitflow_tag_exists
"$tagname"
; then
typeset opts="-a"
typeset opts="-a"
flag sign && opts="$opts -s"
flag sign && opts="$opts -s"
[ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
[ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
...
@@ -203,19 +203,19 @@ cmd_finish() {
...
@@ -203,19 +203,19 @@ cmd_finish() {
# try to merge into develop
# try to merge into develop
# 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 ! gitflow_is_branch_merged_into
$BRANCH $DEVELOP_BRANCH
; then
if ! gitflow_is_branch_merged_into
"$BRANCH" "$DEVELOP_BRANCH"
; then
git checkout
$DEVELOP_BRANCH
|| \
git 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 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
git branch -d
$BRANCH
git branch -d
"$BRANCH"
# TODO: Implement an optional push to master
# TODO: Implement an optional push to master
# git push origin develop; git push origin master; git push --tags origin
# git push origin develop; git push origin master; git push --tags origin
...
...
git-flow-support
View file @
99c80527
...
@@ -34,26 +34,26 @@ cmd_list() {
...
@@ -34,26 +34,26 @@ cmd_list() {
typeset support_branches
typeset support_branches
typeset current_branch
typeset current_branch
typeset short_names
typeset short_names
support_branches=
"$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")"
support_branches=
$(echo "$LOCAL_BRANCHES" | grep "^$PREFIX")
if [ -z "$support_branches" ]; then
if [ -z "$support_branches" ]; then
warn "No support branches exist."
warn "No support branches exist."
exit 0
exit 0
fi
fi
current_branch=$(git branch | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
current_branch=$(git branch | grep '^\* ' | grep -v 'no branch' | sed 's/^* //g')
short_names=$(echo "$support_branches" | sed "s
?^$PREFIX??
g")
short_names=$(echo "$support_branches" | sed "s
^$PREFIX
g")
# determine column width first
# determine column width first
typeset -i width=0
typeset -i width=0
typeset branch
typeset branch
for branch in $short_names; do
for branch in $short_names; do
typeset -i len=$
(($(echo "$branch" | wc -c) - 1))
typeset -i len=$
{#branch}
width=$(max $width $len)
width=$(max $width $len)
done
done
width=width+3
width=width+3
typeset branch
typeset branch
for branch in $short_names; do
for branch in $short_names; do
typeset fullname=
"$PREFIX$branch"
typeset fullname=
$PREFIX$branch
typeset base=$(git merge-base "$fullname" "$MASTER_BRANCH")
typeset base=$(git merge-base "$fullname" "$MASTER_BRANCH")
typeset master_sha=$(git rev-parse "$MASTER_BRANCH")
typeset master_sha=$(git rev-parse "$MASTER_BRANCH")
typeset branch_sha=$(git rev-parse "$fullname")
typeset branch_sha=$(git rev-parse "$fullname")
...
@@ -67,12 +67,12 @@ cmd_list() {
...
@@ -67,12 +67,12 @@ cmd_list() {
if [ "$branch_sha" = "$master_sha" ]; then
if [ "$branch_sha" = "$master_sha" ]; then
printf "(no commits yet)"
printf "(no commits yet)"
else
else
typeset tagname=$(git name-rev --tags --no-undefined --name-only
$base
)
typeset tagname=$(git name-rev --tags --no-undefined --name-only
"$base"
)
typeset nicename
typeset nicename
if [ "$tagname" != "" ]; then
if [ "$tagname" != "" ]; then
nicename=
"$tagname"
nicename=
$tagname
else
else
nicename=
"$(git rev-parse --short $base)"
nicename=
$(git rev-parse --short "$base")
fi
fi
printf "(based on $nicename)"
printf "(based on $nicename)"
fi
fi
...
@@ -94,8 +94,8 @@ parse_args() {
...
@@ -94,8 +94,8 @@ parse_args() {
eval set -- "${FLAGS_ARGV}"
eval set -- "${FLAGS_ARGV}"
# read arguments into global variables
# read arguments into global variables
VERSION=
"$1"
VERSION=
$1
BASE=
"$2"
BASE=
$2
BRANCH=$PREFIX$VERSION
BRANCH=$PREFIX$VERSION
}
}
...
@@ -135,9 +135,9 @@ cmd_start() {
...
@@ -135,9 +135,9 @@ cmd_start() {
# fetch remote changes
# fetch remote changes
if flag fetch; then
if flag fetch; then
git fetch -q
$ORIGIN $BASE
git fetch -q
"$ORIGIN" "$BASE"
fi
fi
gitflow_require_branch_absent
$BRANCH
gitflow_require_branch_absent
"$BRANCH"
# create branch
# create branch
git checkout -b "$BRANCH" "$BASE"
git checkout -b "$BRANCH" "$BASE"
...
...
gitflow-common
View file @
99c80527
...
@@ -61,8 +61,8 @@ ALL_TAGS=$(git tag)
...
@@ -61,8 +61,8 @@ ALL_TAGS=$(git tag)
# 2: Multiple matches found. These matches are written to stderr
# 2: Multiple matches found. These matches are written to stderr
#
#
resolve_nameprefix() {
resolve_nameprefix() {
typeset name=
"$1"
typeset name=
$1
typeset prefix=
"$2"
typeset prefix=
$2
typeset matches
typeset matches
typeset -i num_matches
typeset -i num_matches
...
@@ -72,7 +72,7 @@ resolve_nameprefix() {
...
@@ -72,7 +72,7 @@ resolve_nameprefix() {
return 0
return 0
fi
fi
matches=
"$(echo "$LOCAL_BRANCHES" | grep "^$prefix$name")"
matches=
$(echo "$LOCAL_BRANCHES" | grep "^$prefix$name")
num_matches=$(echo "$matches" | wc -l)
num_matches=$(echo "$matches" | wc -l)
if [ -z "$matches" ]; then
if [ -z "$matches" ]; then
# no prefix match, so take it literally
# no prefix match, so take it literally
...
...
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