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
fafa2b28
Commit
fafa2b28
authored
Feb 09, 2010
by
Vincent Driessen
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feature/annotated-signed-tags' into develop
parents
ca73caf8
d29e315f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
116 additions
and
23 deletions
+116
-23
git-flow-hotfix
git-flow-hotfix
+53
-12
git-flow-release
git-flow-release
+52
-11
gitflow-common
gitflow-common
+11
-0
No files found.
git-flow-hotfix
View file @
fafa2b28
...
@@ -113,7 +113,7 @@ require_base_is_on_master() {
...
@@ -113,7 +113,7 @@ require_base_is_on_master() {
}
}
cmd_start() {
cmd_start() {
DEFINE_boolean fetch true "fetch from $ORIGIN before
finishing hotfix
" 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
...
@@ -121,11 +121,12 @@ cmd_start() {
...
@@ -121,11 +121,12 @@ cmd_start() {
# sanity checks
# sanity checks
gitflow_require_clean_working_tree
gitflow_require_clean_working_tree
gitflow_require_branch_absent $BRANCH
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
gitflow_require_branch_absent $BRANCH
# create branch
# create branch
git checkout -b $BRANCH $BASE
git checkout -b $BRANCH $BASE
...
@@ -145,27 +146,67 @@ cmd_start() {
...
@@ -145,27 +146,67 @@ cmd_start() {
}
}
cmd_finish() {
cmd_finish() {
DEFINE_boolean fetch true "fetch from $ORIGIN before finishing hotfix" F
DEFINE_boolean fetch true "fetch from $ORIGIN before performing finish" F
DEFINE_boolean sign false "sign the release tag cryptographically" s
DEFINE_string signingkey "" "use the given GPG-key for the digital signature (implies -s)" u
DEFINE_string message "" "use the given tag message" m
parse_args "$@"
parse_args "$@"
require_version_arg
require_version_arg
# handle flags that imply other flags
if [ "$FLAGS_signingkey" != "" ]; then
FLAGS_sign=$FLAGS_TRUE
fi
# sanity checks
# sanity checks
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 || \
git fetch -q $ORIGIN $DEVELOP_BRANCH
die "Could not fetch $MASTER_BRANCH from $ORIGIN."
git fetch -q $ORIGIN $DEVELOP_BRANCH || \
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
# merge into master
# try to merge into master
git checkout $MASTER_BRANCH
# in case a previous attempt to finish this release branch has failed,
git merge --no-ff $BRANCH
# but the merge into master was successful, we skip it now
git tag $VERSION_PREFIX$VERSION
if ! gitflow_is_branch_merged_into $BRANCH $MASTER_BRANCH; then
git checkout $MASTER_BRANCH || \
die "Could not check out $MASTER_BRANCH."
git merge --no-ff $BRANCH || \
die "There were merge conflicts."
# TODO: What do we do now?
fi
# try to tag the release
# in case a previous attempt to finish this release branch has failed,
# but the tag was set successful, we skip it now
typeset tagname=$VERSION_PREFIX$VERSION
if ! gitflow_tag_exists $tagname; then
typeset opts="-a"
flag sign && opts="$opts -s"
[ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
[ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'"
git tag $opts "$VERSION_PREFIX$VERSION" || \
die "Tagging failed. Please run finish again to retry."
fi
# merge into develop if we fixed a master issue
# try to merge into develop
git checkout $DEVELOP_BRANCH
# in case a previous attempt to finish this release branch has failed,
git merge --no-ff $BRANCH
# but the merge into develop was successful, we skip it now
if ! gitflow_is_branch_merged_into $BRANCH $DEVELOP_BRANCH; then
git 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 || \
die "There were merge conflicts."
# TODO: What do we do now?
fi
# delete branch
# delete branch
git branch -d $BRANCH
git branch -d $BRANCH
...
...
git-flow-release
View file @
fafa2b28
...
@@ -127,11 +127,12 @@ cmd_start() {
...
@@ -127,11 +127,12 @@ cmd_start() {
# sanity checks
# sanity checks
gitflow_require_clean_working_tree
gitflow_require_clean_working_tree
gitflow_require_branch_absent $BRANCH
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
gitflow_require_branch_absent $BRANCH
# create branch
# create branch
git checkout -b $BRANCH $BASE
git checkout -b $BRANCH $BASE
...
@@ -152,26 +153,66 @@ cmd_start() {
...
@@ -152,26 +153,66 @@ cmd_start() {
cmd_finish() {
cmd_finish() {
DEFINE_boolean fetch true "fetch from $ORIGIN before performing finish" F
DEFINE_boolean fetch true "fetch from $ORIGIN before performing finish" F
DEFINE_boolean sign false "sign the release tag cryptographically" s
DEFINE_string signingkey "" "use the given GPG-key for the digital signature (implies -s)" u
DEFINE_string message "" "use the given tag message" m
parse_args "$@"
parse_args "$@"
require_version_arg
require_version_arg
# handle flags that imply other flags
if [ "$FLAGS_signingkey" != "" ]; then
FLAGS_sign=$FLAGS_TRUE
fi
# sanity checks
# sanity checks
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 || \
git fetch -q $ORIGIN $DEVELOP_BRANCH
die "Could not fetch $MASTER_BRANCH from $ORIGIN."
git fetch -q $ORIGIN $DEVELOP_BRANCH || \
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
# merge into master
# try to merge into master
git checkout $MASTER_BRANCH
# in case a previous attempt to finish this release branch has failed,
git merge --no-ff $BRANCH
# but the merge into master was successful, we skip it now
git tag $VERSION_PREFIX$VERSION
if ! gitflow_is_branch_merged_into $BRANCH $MASTER_BRANCH; then
git checkout $MASTER_BRANCH || \
die "Could not check out $MASTER_BRANCH."
git merge --no-ff $BRANCH || \
die "There were merge conflicts."
# TODO: What do we do now?
fi
# try to tag the release
# in case a previous attempt to finish this release branch has failed,
# but the tag was set successful, we skip it now
typeset tagname=$VERSION_PREFIX$VERSION
if ! gitflow_tag_exists $tagname; then
typeset opts="-a"
flag sign && opts="$opts -s"
[ "$FLAGS_signingkey" != "" ] && opts="$opts -u '$FLAGS_signingkey'"
[ "$FLAGS_message" != "" ] && opts="$opts -m '$FLAGS_message'"
git tag $opts "$tagname" || \
die "Tagging failed. Please run finish again to retry."
fi
# merge into develop
# try to merge into develop
git checkout $DEVELOP_BRANCH
# in case a previous attempt to finish this release branch has failed,
git merge --no-ff $BRANCH
# but the merge into develop was successful, we skip it now
if ! gitflow_is_branch_merged_into $BRANCH $DEVELOP_BRANCH; then
git 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 || \
die "There were merge conflicts."
# TODO: What do we do now?
fi
# delete branch
# delete branch
git branch -d $BRANCH
git branch -d $BRANCH
...
@@ -183,7 +224,7 @@ cmd_finish() {
...
@@ -183,7 +224,7 @@ cmd_finish() {
echo "Summary of actions:"
echo "Summary of actions:"
echo "- Latest objects have been fetched from '$ORIGIN'"
echo "- Latest objects have been fetched from '$ORIGIN'"
echo "- Release branch has been merged into '$MASTER_BRANCH'"
echo "- Release branch has been merged into '$MASTER_BRANCH'"
echo "- The release was tagged '$
VERSION_PREFIX$VERSION
'"
echo "- The release was tagged '$
tagname
'"
echo "- Release branch has been back-merged into '$DEVELOP_BRANCH'"
echo "- Release branch has been back-merged into '$DEVELOP_BRANCH'"
echo "- Release branch '$BRANCH' has been deleted"
echo "- Release branch '$BRANCH' has been deleted"
echo
echo
...
...
gitflow-common
View file @
fafa2b28
...
@@ -42,6 +42,7 @@ noflag() { typeset FLAG; eval FLAG='$FLAGS_'$1; [ $FLAG -ne $FLAGS_TRUE ]; }
...
@@ -42,6 +42,7 @@ noflag() { typeset FLAG; eval FLAG='$FLAGS_'$1; [ $FLAG -ne $FLAGS_TRUE ]; }
LOCAL_BRANCHES=$(git branch | sed 's/^[* ] //')
LOCAL_BRANCHES=$(git branch | sed 's/^[* ] //')
REMOTE_BRANCHES=$(git branch -r | sed 's/^[* ] //')
REMOTE_BRANCHES=$(git branch -r | sed 's/^[* ] //')
ALL_BRANCHES="$LOCAL_BRANCHES $REMOTE_BRANCHES"
ALL_BRANCHES="$LOCAL_BRANCHES $REMOTE_BRANCHES"
ALL_TAGS=$(git tag)
#
#
# resolve_nameprefix
# resolve_nameprefix
...
@@ -141,6 +142,16 @@ gitflow_require_branch_absent() {
...
@@ -141,6 +142,16 @@ gitflow_require_branch_absent() {
fi
fi
}
}
gitflow_require_tag_absent() {
if has $1 $ALL_TAGS; then
die "Tag '$1' already exists. Pick another name."
fi
}
gitflow_tag_exists() {
has $1 $ALL_TAGS
}
#
#
# gitflow_test_branches_equal()
# gitflow_test_branches_equal()
#
#
...
...
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