mirror of
https://github.com/espressif/openthread.git
synced 2026-09-10 11:10:08 +00:00
[scripts] apply shfmt changes (#4966)
This commit is contained in:
@@ -27,12 +27,13 @@
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
#
|
||||
|
||||
die() {
|
||||
die()
|
||||
{
|
||||
echo " *** ERROR: " $*
|
||||
exit 1
|
||||
}
|
||||
|
||||
display_usage ()
|
||||
display_usage()
|
||||
{
|
||||
echo "Squash merge a given branch into the current branch"
|
||||
echo ""
|
||||
@@ -53,42 +54,39 @@ display_usage ()
|
||||
SHOULD_ADD_LIST=true
|
||||
SHOULD_COMMIT=true
|
||||
|
||||
while test $# != 0
|
||||
do
|
||||
while test $# != 0; do
|
||||
case "$1" in
|
||||
--help|-h|-[?])
|
||||
display_usage
|
||||
exit 0
|
||||
;;
|
||||
--help | -h | -[?])
|
||||
display_usage
|
||||
exit 0
|
||||
;;
|
||||
|
||||
--no-list)
|
||||
SHOULD_ADD_LIST=false
|
||||
;;
|
||||
--no-commit)
|
||||
SHOULD_COMMIT=false
|
||||
;;
|
||||
--debug) set -x ;;
|
||||
--*) die "Unknown argument $1" ;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-*) die "Unknown argument $1" ;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
--no-list)
|
||||
SHOULD_ADD_LIST=false
|
||||
;;
|
||||
--no-commit)
|
||||
SHOULD_COMMIT=false
|
||||
;;
|
||||
--debug) set -x ;;
|
||||
--*) die "Unknown argument $1" ;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-*) die "Unknown argument $1" ;;
|
||||
*)
|
||||
break
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
if [ "$#" -eq 0 ]
|
||||
then
|
||||
if [ "$#" -eq 0 ]; then
|
||||
display_usage
|
||||
die "No branch name"
|
||||
fi
|
||||
|
||||
if [ "$#" -gt 2 ]
|
||||
then
|
||||
if [ "$#" -gt 2 ]; then
|
||||
display_usage
|
||||
die "Extra argument"
|
||||
fi
|
||||
@@ -101,8 +99,7 @@ cur_branch=$(git rev-parse --abbrev-ref HEAD)
|
||||
# Get the list of commits (diff between current and new branch)
|
||||
# Note that the list starts with older commits
|
||||
|
||||
if ${SHOULD_ADD_LIST}
|
||||
then
|
||||
if ${SHOULD_ADD_LIST}; then
|
||||
commit_list=$(git log HEAD..$branch --oneline --decorate=no --reverse)
|
||||
else
|
||||
commit_list=""
|
||||
@@ -116,7 +113,7 @@ else
|
||||
commit_msg="${commit_msg_header}${NEWLINE}${NEWLINE}$2${NEWLINE}${NEWLINE}${commit_list}"
|
||||
fi
|
||||
|
||||
git merge --squash $branch 1> /dev/null 2> /dev/null || die "Failed to perform 'git merge -squash $branch'"
|
||||
git merge --squash $branch 1>/dev/null 2>/dev/null || die "Failed to perform 'git merge -squash $branch'"
|
||||
|
||||
# Check if there is anything staged
|
||||
git diff --cached --quiet
|
||||
@@ -125,10 +122,9 @@ if [ $? -eq 0 ]; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if ${SHOULD_COMMIT}
|
||||
then
|
||||
if ${SHOULD_COMMIT}; then
|
||||
# Commit the staged changes
|
||||
git commit -m "$commit_msg" 1> /dev/null 2> /dev/null || die "git commit failed${NEWLINE}${NEWLINE}$(cat $TMP)"
|
||||
git commit -m "$commit_msg" 1>/dev/null 2>/dev/null || die "git commit failed${NEWLINE}${NEWLINE}$(cat $TMP)"
|
||||
|
||||
git log -1
|
||||
|
||||
@@ -136,4 +132,3 @@ then
|
||||
else
|
||||
echo "Successfully prepared squash merge of branch '$branch' into '$cur_branch' - ready to commit"
|
||||
fi
|
||||
|
||||
|
||||
Reference in New Issue
Block a user