Commit 62345d54 authored by Vincent Driessen's avatar Vincent Driessen

Created a second function called gitflow_test_clean_working_tree() that...

Created a second function called gitflow_test_clean_working_tree() that returns error codes instead of dies.

Rewrote gitflow_require_clean_working_tree() in terms of that.
parent 49c7d029
...@@ -84,11 +84,23 @@ main() { ...@@ -84,11 +84,23 @@ main() {
cmd_$SUBACTION "$@" cmd_$SUBACTION "$@"
} }
gitflow_require_clean_working_tree() { gitflow_test_clean_working_tree() {
if ! git diff --no-ext-diff --ignore-submodules --quiet --exit-code; then if ! git diff --no-ext-diff --ignore-submodules --quiet --exit-code; then
return 1
elif ! git diff-index --cached --quiet --ignore-submodules HEAD --; then
return 2
else
return 0
fi
}
gitflow_require_clean_working_tree() {
gitflow_test_clean_working_tree
result=$?
if [ $result -eq 1 ]; then
die "Working tree contains unstaged changes. Aborting ..." die "Working tree contains unstaged changes. Aborting ..."
fi fi
if ! git diff-index --cached --quiet --ignore-submodules HEAD --; then if [ $result -eq 2 ]; then
die "Index contains uncommited changes. Aborting ..." die "Index contains uncommited changes. Aborting ..."
fi fi
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment