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.
This commit is contained in:
parent
49c7d029ec
commit
62345d54f3
1 changed files with 14 additions and 2 deletions
16
git-flow
16
git-flow
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue