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
b25ab833
Commit
b25ab833
authored
Feb 20, 2010
by
Vincent Driessen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added tests for asserting correctly configured git-flow
environment/branches. Added test for existence of local branches.
parent
4e11dd6f
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
1 deletion
+24
-1
gitflow-common
gitflow-common
+24
-1
No files found.
gitflow-common
View file @
b25ab833
...
@@ -38,6 +38,25 @@ noflag() { local FLAG; eval FLAG='$FLAGS_'$1; [ $FLAG -ne $FLAGS_TRUE ]; }
...
@@ -38,6 +38,25 @@ noflag() { local FLAG; eval FLAG='$FLAGS_'$1; [ $FLAG -ne $FLAGS_TRUE ]; }
# Git specific common functionality
# Git specific common functionality
#
#
# check if this repo has been inited for gitflow
gitflow_has_master_configured() {
local master=$(git config --get gitflow.branch.master)
[ "$master" != "" ] && gitflow_local_branch_exists "$master"
}
gitflow_has_develop_configured() {
local develop=$(git config --get gitflow.branch.develop)
[ "$develop" != "" ] && gitflow_local_branch_exists "$develop"
}
gitflow_is_initialized() {
gitflow_has_master_configured && \
gitflow_has_develop_configured && \
# they should be different
[ "$(git config --get gitflow.branch.master)" != \
"$(git config --get gitflow.branch.develop)" ]
}
# get all available branches
# get all available branches
gitflow_local_branches() { git branch | sed 's/^[* ] //'; }
gitflow_local_branches() { git branch | sed 's/^[* ] //'; }
gitflow_remote_branches() { git branch -r | sed 's/^[* ] //'; }
gitflow_remote_branches() { git branch -r | sed 's/^[* ] //'; }
...
@@ -132,6 +151,10 @@ gitflow_require_clean_working_tree() {
...
@@ -132,6 +151,10 @@ gitflow_require_clean_working_tree() {
fi
fi
}
}
gitflow_local_branch_exists() {
has $1 $(gitflow_local_branches)
}
gitflow_branch_exists() {
gitflow_branch_exists() {
has $1 $(gitflow_all_branches)
has $1 $(gitflow_all_branches)
}
}
...
@@ -141,7 +164,7 @@ gitflow_tag_exists() {
...
@@ -141,7 +164,7 @@ gitflow_tag_exists() {
}
}
gitflow_require_local_branch() {
gitflow_require_local_branch() {
if !
has $1 $(gitflow_local_branches)
; then
if !
gitflow_local_branch_exists
; then
die "fatal: Local branch '$1' does not exist and is required."
die "fatal: Local branch '$1' does not exist and is required."
fi
fi
}
}
...
...
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