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
f6f152ff
Commit
f6f152ff
authored
Jan 29, 2010
by
Vincent Driessen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Support scenarios where the user might have cancelled a merge in the middle of a merge conflict.
parent
62345d54
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
28 additions
and
7 deletions
+28
-7
git-flow-feature
git-flow-feature
+28
-7
No files found.
git-flow-feature
View file @
f6f152ff
...
@@ -102,7 +102,6 @@ cmd_finish() {
...
@@ -102,7 +102,6 @@ cmd_finish() {
parse_args "$@"
parse_args "$@"
# sanity checks
# sanity checks
gitflow_require_clean_working_tree
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
...
@@ -112,11 +111,26 @@ cmd_finish() {
...
@@ -112,11 +111,26 @@ cmd_finish() {
# The user need not necessarily have given the same $NAME twice here
# The user need not necessarily have given the same $NAME twice here
# (although he/she should).
# (although he/she should).
#
#
FINISH_BASE="$(cat "$GIT_DIR/.gitflow/MERGE_BASE")"
if gitflow_is_branch_merged_into $BRANCH $FINISH_BASE; then
# TODO: gitflow_test_clean_working_tree() should provide an alternative
rm -f "$GIT_DIR/.gitflow/MERGE_BASE"
# exit code for "unmerged changes in working tree", which we should
helper_finish_cleanup
# actually be testing for here
exit 0
if gitflow_test_clean_working_tree; then
FINISH_BASE="$(cat "$GIT_DIR/.gitflow/MERGE_BASE")"
# Since the working tree is now clean, either the user did a
# succesfull merge manually, or the merge was cancelled.
# We detect this using gitflow_is_branch_merged_into()
if gitflow_is_branch_merged_into $BRANCH $FINISH_BASE; then
rm -f "$GIT_DIR/.gitflow/MERGE_BASE"
helper_finish_cleanup
exit 0
else
# If the user cancelled the merge and decided to wait until later,
# that's fine. But we have to acknowledge this by removing the
# MERGE_BASE file and continuing normal execution of the finish
rm -f "$GIT_DIR/.gitflow/MERGE_BASE"
fi
else
else
echo
echo
echo "Merge conflicts not resolved yet, use:"
echo "Merge conflicts not resolved yet, use:"
...
@@ -130,6 +144,9 @@ cmd_finish() {
...
@@ -130,6 +144,9 @@ cmd_finish() {
fi
fi
fi
fi
# sanity checks
gitflow_require_clean_working_tree
# update local repo with remote changes first, if asked
# update local repo with remote changes first, if asked
if [ $FLAG_FETCH -eq 1 ]; then
if [ $FLAG_FETCH -eq 1 ]; then
git fetch -q $ORIGIN $BRANCH
git fetch -q $ORIGIN $BRANCH
...
@@ -153,7 +170,7 @@ cmd_finish() {
...
@@ -153,7 +170,7 @@ cmd_finish() {
if [ $? -ne 0 ]; then
if [ $? -ne 0 ]; then
# oops.. we have a merge conflict!
# oops.. we have a merge conflict!
# write the given $BASE to a temporary file (we need it later)
# write the given $BASE to a temporary file (we need it later)
mkdir -p "$GIT_DIR/.gitflow"
mkdir -p "$GIT_DIR/.gitflow"
echo "$BASE" > "$GIT_DIR/.gitflow/MERGE_BASE"
echo "$BASE" > "$GIT_DIR/.gitflow/MERGE_BASE"
echo
echo
echo "There were merge conflicts. To resolve the merge conflict manually, use:"
echo "There were merge conflicts. To resolve the merge conflict manually, use:"
...
@@ -171,6 +188,10 @@ cmd_finish() {
...
@@ -171,6 +188,10 @@ cmd_finish() {
}
}
helper_finish_cleanup() {
helper_finish_cleanup() {
# sanity checks
gitflow_require_branch $BRANCH
gitflow_check_clean_working_tree
# delete branch
# delete branch
git push $ORIGIN :refs/heads/$BRANCH
git push $ORIGIN :refs/heads/$BRANCH
git branch -d $BRANCH
git branch -d $BRANCH
...
...
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