Ticket #44401: gitflow-debug-20140729.log.txt

File gitflow-debug-20140729.log.txt, 184.8 KB (added by gorticus (Jason Mitchell), 10 years ago)

log capture of git-flow merge commit fail that does not error out creating the .git/.gitflow/MERGE_BASE ref

Line 
1#!/bin/sh
2#
3# git-flow -- A collection of Git extensions to provide high-level
4# repository operations for Vincent Driessen's branching model.
5#
6# A blog post presenting this model is found at:
7#    http://blog.avirtualhome.com/development-workflow-using-git/
8#
9# Feel free to contribute to this project at:
10#    http://github.com/petervanderdoes/gitflow
11#
12# Authors:
13# Copyright 2012,2013 Peter van der Does. All rights reserved.
14#
15# Original Author:
16# Copyright 2010 Vincent Driessen. All rights reserved.
17#
18# Redistribution and use in source and binary forms, with or without
19# modification, are permitted provided that the following conditions are met:
20#
21# 1. Redistributions of source code must retain the above copyright notice, this
22#    list of conditions and the following disclaimer.
23# 2. Redistributions in binary form must reproduce the above copyright notice,
24#    this list of conditions and the following disclaimer in the documentation
25#    and/or other materials provided with the distribution.
26#
27# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
28# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
29# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
30# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
31# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
32# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
33# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
34# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
35# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
36# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37#
38#
39# enable debug mode
40if [ "$DEBUG" = "yes" ]; then
41        set -x
42fi
43+ '[' '' = yes ']'
44
45# Setup the GITFLOW_DIR for different operating systems.
46# This is mostly to make sure that we get the correct directory when the
47# git-flow file is a symbolic link
48case $(uname -s) in
49Linux)
50        export GITFLOW_DIR=$(dirname "$(readlink -e "$0")")
51        ;;
52FreeBSD|OpenBSD|NetBSD)
53        export FLAGS_GETOPT_CMD='/usr/local/bin/getopt'
54        export GITFLOW_DIR=$(dirname "$(realpath "$0")")
55        ;;
56Darwin)
57        PRG="$0"
58        while [ -h "$PRG" ]; do
59                link=$(readlink "$0")
60                if expr "$link" : '/.*' > /dev/null; then
61                        PRG="$link"
62                else
63                        PRG="$(dirname "$PRG")/$link"
64                fi
65        done
66        export GITFLOW_DIR=$(dirname "$PRG")
67        ;;
68*MINGW*)
69        export GITFLOW_DIR=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
70        ;;
71
72*)
73        # The sed expression here replaces all backslashes by forward slashes.
74        # This helps our Windows users, while not bothering our Unix users.)
75        export GITFLOW_DIR=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
76        ;;
77esac
78+ case $(uname -s) in
79uname -s
80++ uname -s
81+ PRG=/opt/local/bin/git-flow
82+ '[' -h /opt/local/bin/git-flow ']'
83dirname "$PRG"
84++ dirname /opt/local/bin/git-flow
85+ export GITFLOW_DIR=/opt/local/bin
86+ GITFLOW_DIR=/opt/local/bin
87
88# Extra environment settings
89if [ -f ~/.gitflow_export ]; then
90    if grep -E 'GITFLOW_FLAG_(SHOWCOMMANDS|INIT|FEATURE|HOTFIX|RELEASE|SUPPORT)' ~/.gitflow_export > /dev/null; then
91        echo "Using environment variables for \"showcommands\", \"init\", \"feature\", \"hotfix\", \"release\" and \"support\" in ~/.gitflow_export has deprecated, use git config instead."
92        echo ""
93        exit 1;
94    else
95        . ~/.gitflow_export
96    fi
97fi
98+ '[' -f /Users/USERNAME/.gitflow_export ']'
99
100usage() {
101        echo "usage: git flow <subcommand>"
102        echo
103        echo "Available subcommands are:"
104        echo "   init      Initialize a new git repo with support for the branching model."
105        echo "   feature   Manage your feature branches."
106        echo "   release   Manage your release branches."
107        echo "   hotfix    Manage your hotfix branches."
108        echo "   support   Manage your support branches."
109        echo "   version   Shows version information."
110        echo "   config    Manage your git-flow configuration."
111        echo
112        echo "Try 'git flow <subcommand> help' for details."
113}
114
115main() {
116        if [ $# -lt 1 ]; then
117                usage
118                exit 1
119        fi
120
121        # Use the shFlags project to parse the command line arguments
122        . "$GITFLOW_DIR/gitflow-shFlags"
123        FLAGS_PARENT="git flow"
124
125        # Load common functionality
126        . "$GITFLOW_DIR/gitflow-common"
127
128        # allow user to request git action logging
129        DEFINE_boolean 'showcommands' false 'Show actions taken (git commands)'
130        # but if the user prefers that the logging is always on,
131        # use the environmental variables.
132        gitflow_override_flag_boolean 'showcommands' 'showcommands'
133
134        # Sanity checks
135        SUBCOMMAND="$1"; shift
136        if [ "${SUBCOMMAND}" = "finish" ] || [ "${SUBCOMMAND}" = "delete" ] || [ "${SUBCOMMAND}" = "publish" ]; then
137                _current_branch=$(git_current_branch)
138                if gitflow_is_prefixed_branch "${_current_branch}"; then
139                        if startswith "${_current_branch}" $(git config --get gitflow.prefix.feature); then
140                                SUBACTION="${SUBCOMMAND}"
141                                SUBCOMMAND="feature"
142                                _prefix=$(git config --get gitflow.prefix.feature)
143                                _short_branch_name=$(echo ${_current_branch#*${_prefix}})
144                        else
145                                if startswith "${_current_branch}" $(git config --get gitflow.prefix.hotfix); then
146                                        SUBACTION="${SUBCOMMAND}"
147                                        SUBCOMMAND="hotfix"
148                                        _prefix=$(git config --get gitflow.prefix.hotfix)
149                                        _short_branch_name=$(echo ${_current_branch#*${_prefix}})
150                                else
151                                        if startswith "${_current_branch}" $(git config --get gitflow.prefix.release); then
152                                                SUBACTION="${SUBCOMMAND}"
153                                                SUBCOMMAND="release"
154                                                _prefix=$(git config --get gitflow.prefix.release)
155                                                _short_branch_name=$(echo ${_current_branch#*${_prefix}})
156                                        fi
157                                fi
158                        fi
159                fi
160        fi
161
162                if [ ! -e "$GITFLOW_DIR/git-flow-$SUBCOMMAND" ]; then
163                usage
164                exit 1
165        fi
166
167        # Run command
168        . "$GITFLOW_DIR/git-flow-$SUBCOMMAND"
169        FLAGS_PARENT="git flow $SUBCOMMAND"
170
171        if [ -z "${SUBACTION}" ]; then
172                # If the first argument is a flag, it starts with '-', we interpret this
173                # argument as a flag for the default command.
174                if startswith "$1" "-"; then
175                        SUBACTION="default"
176                elif [ -z "$1" ]; then
177                        SUBACTION="default"
178                else
179                        SUBACTION="$1"
180                        shift
181                        # Do not allow direct calls to subactions with an underscore.
182                        if $(contains "$SUBACTION" "_"); then
183                                warn "Unknown subcommand: '$SUBACTION'"
184                                usage
185                                exit 1
186                        fi
187                        # Replace the dash with an underscore as bash doesn't allow a dash
188                        # in the function name.
189                        SUBACTION=$(echo "$SUBACTION" |tr '-' '_')
190                fi
191        fi
192
193        if ! type "cmd_$SUBACTION" >/dev/null 2>&1; then
194                warn "Unknown subcommand: '$SUBACTION'"
195                usage
196                exit 1
197        fi
198
199        # Run the specified action
200        if [ $SUBACTION != "help" ] && [ $SUBCOMMAND != "init" ]; then
201                initialize
202        fi
203        if [ $SUBACTION != 'default' ]; then
204                FLAGS_PARENT="git flow $SUBCOMMAND $SUBACTION"
205        fi
206
207        cmd_$SUBACTION "$@" "${_short_branch_name}"
208}
209main "$@"
210+ main feature finish f3
211+ '[' 3 -lt 1 ']'
212+ . /opt/local/bin/gitflow-shFlags
213# $Id$
214# vim:et:ft=sh:sts=2:sw=2
215#
216# Copyright 2008 Kate Ward. All Rights Reserved.
217# Released under the LGPL (GNU Lesser General Public License)
218#
219# shFlags -- Advanced command-line flag library for Unix shell scripts.
220# http://code.google.com/p/shflags/
221#
222# Author: kate.ward@forestent.com (Kate Ward)
223#
224# This module implements something like the google-gflags library available
225# from http://code.google.com/p/google-gflags/.
226#
227# FLAG TYPES: This is a list of the DEFINE_*'s that you can do.  All flags take
228# a name, default value, help-string, and optional 'short' name (one-letter
229# name).  Some flags have other arguments, which are described with the flag.
230#
231# DEFINE_string: takes any input, and intreprets it as a string.
232#
233# DEFINE_boolean: does not take any arguments. Say --myflag to set
234#   FLAGS_myflag to true, or --nomyflag to set FLAGS_myflag to false. For short
235#   flags, passing the flag on the command-line negates the default value, i.e.
236#   if the default is true, passing the flag sets the value to false.
237#
238# DEFINE_float: takes an input and intreprets it as a floating point number. As
239#   shell does not support floats per-se, the input is merely validated as
240#   being a valid floating point value.
241#
242# DEFINE_integer: takes an input and intreprets it as an integer.
243#
244# SPECIAL FLAGS: There are a few flags that have special meaning:
245#   --help (or -?)  prints a list of all the flags in a human-readable fashion
246#   --flagfile=foo  read flags from foo.  (not implemented yet)
247#   --              as in getopt(), terminates flag-processing
248#
249# EXAMPLE USAGE:
250#
251#   -- begin hello.sh --
252#   #! /bin/sh
253#   . ./shflags
254#   DEFINE_string name 'world' "somebody's name" n
255#   FLAGS "$@" || exit $?
256#   eval set -- "${FLAGS_ARGV}"
257#   echo "Hello, ${FLAGS_name}."
258#   -- end hello.sh --
259#
260#   $ ./hello.sh -n Kate
261#   Hello, Kate.
262#
263# CUSTOMIZABLE BEHAVIOR:
264#
265# A script can override the default 'getopt' command by providing the path to
266# an alternate implementation by defining the FLAGS_GETOPT_CMD variable.
267#
268# NOTES:
269#
270# * Not all systems include a getopt version that supports long flags. On these
271#   systems, only short flags are recognized.
272
273#==============================================================================
274# shFlags
275#
276# Shared attributes:
277#   flags_error:  last error message
278#   flags_output: last function output (rarely valid)
279#   flags_return: last return value
280#
281#   __flags_longNames: list of long names for all flags
282#   __flags_shortNames: list of short names for all flags
283#   __flags_boolNames: list of boolean flag names
284#
285#   __flags_opts: options parsed by getopt
286#
287# Per-flag attributes:
288#   FLAGS_<flag_name>: contains value of flag named 'flag_name'
289#   __flags_<flag_name>_default: the default flag value
290#   __flags_<flag_name>_help: the flag help string
291#   __flags_<flag_name>_short: the flag short name
292#   __flags_<flag_name>_type: the flag type
293#
294# Notes:
295# - lists of strings are space separated, and a null value is the '~' char.
296
297# return if FLAGS already loaded
298[ -n "${FLAGS_VERSION:-}" ] && return 0
299++ '[' -n '' ']'
300FLAGS_VERSION='1.0.4pre'
301++ FLAGS_VERSION=1.0.4pre
302
303# return values that scripts can use
304FLAGS_TRUE=0
305++ FLAGS_TRUE=0
306FLAGS_FALSE=1
307++ FLAGS_FALSE=1
308FLAGS_ERROR=2
309++ FLAGS_ERROR=2
310
311# determine some reasonable command defaults
312__FLAGS_UNAME_S=`uname -s`
313uname -s
314+++ uname -s
315++ __FLAGS_UNAME_S=Darwin
316case "${__FLAGS_UNAME_S}" in
317  BSD) __FLAGS_EXPR_CMD='gexpr' ;;
318  *) __FLAGS_EXPR_CMD='expr' ;;
319esac
320++ case "${__FLAGS_UNAME_S}" in
321++ __FLAGS_EXPR_CMD=expr
322
323# commands a user can override if needed
324FLAGS_EXPR_CMD=${FLAGS_EXPR_CMD:-${__FLAGS_EXPR_CMD}}
325++ FLAGS_EXPR_CMD=expr
326FLAGS_GETOPT_CMD=${FLAGS_GETOPT_CMD:-getopt}
327++ FLAGS_GETOPT_CMD=getopt
328
329# specific shell checks
330if [ -n "${ZSH_VERSION:-}" ]; then
331  setopt |grep "^shwordsplit$" >/dev/null
332  if [ $? -ne ${FLAGS_TRUE} ]; then
333    _flags_fatal 'zsh shwordsplit option is required for proper zsh operation'
334  fi
335  if [ -z "${FLAGS_PARENT:-}" ]; then
336    _flags_fatal "zsh does not pass \$0 through properly. please declare' \
337\"FLAGS_PARENT=\$0\" before calling shFlags"
338  fi
339fi
340++ '[' -n '' ']'
341
342# can we use built-ins?
343( echo "${FLAGS_TRUE#0}"; ) >/dev/null 2>&1
344if [ $? -eq ${FLAGS_TRUE} ]; then
345  __FLAGS_USE_BUILTIN=${FLAGS_TRUE}
346else
347  __FLAGS_USE_BUILTIN=${FLAGS_FALSE}
348fi
349++ '[' 0 -eq 0 ']'
350++ __FLAGS_USE_BUILTIN=0
351
352#
353# constants
354#
355
356# reserved flag names
357__FLAGS_RESERVED_LIST=' ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE '
358++ __FLAGS_RESERVED_LIST=' ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE '
359__FLAGS_RESERVED_LIST="${__FLAGS_RESERVED_LIST} VERSION "
360++ __FLAGS_RESERVED_LIST=' ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE  VERSION '
361
362# getopt version
363__FLAGS_GETOPT_VERS_STD=0
364++ __FLAGS_GETOPT_VERS_STD=0
365__FLAGS_GETOPT_VERS_ENH=1
366++ __FLAGS_GETOPT_VERS_ENH=1
367__FLAGS_GETOPT_VERS_BSD=2
368++ __FLAGS_GETOPT_VERS_BSD=2
369
370${FLAGS_GETOPT_CMD} >/dev/null 2>&1
371++ getopt
372case $? in
373  0) __FLAGS_GETOPT_VERS=${__FLAGS_GETOPT_VERS_STD} ;;  # bsd getopt
374  2)
375    # TODO(kward): look into '-T' option to test the internal getopt() version
376    if [ "`${FLAGS_GETOPT_CMD} --version`" = '-- ' ]; then
377      __FLAGS_GETOPT_VERS=${__FLAGS_GETOPT_VERS_STD}
378    else
379      __FLAGS_GETOPT_VERS=${__FLAGS_GETOPT_VERS_ENH}
380    fi
381    ;;
382  *) _flags_fatal 'unable to determine getopt version' ;;
383esac
384++ case $? in
385${FLAGS_GETOPT_CMD} --version
386+++ getopt --version
387++ '[' 'getopt (enhanced) 1.1.5' = '-- ' ']'
388++ __FLAGS_GETOPT_VERS=1
389
390# getopt optstring lengths
391__FLAGS_OPTSTR_SHORT=0
392++ __FLAGS_OPTSTR_SHORT=0
393__FLAGS_OPTSTR_LONG=1
394++ __FLAGS_OPTSTR_LONG=1
395
396__FLAGS_NULL='~'
397++ __FLAGS_NULL='~'
398
399# flag info strings
400__FLAGS_INFO_DEFAULT='default'
401++ __FLAGS_INFO_DEFAULT=default
402__FLAGS_INFO_HELP='help'
403++ __FLAGS_INFO_HELP=help
404__FLAGS_INFO_SHORT='short'
405++ __FLAGS_INFO_SHORT=short
406__FLAGS_INFO_TYPE='type'
407++ __FLAGS_INFO_TYPE=type
408
409# flag lengths
410__FLAGS_LEN_SHORT=0
411++ __FLAGS_LEN_SHORT=0
412__FLAGS_LEN_LONG=1
413++ __FLAGS_LEN_LONG=1
414
415# flag types
416__FLAGS_TYPE_NONE=0
417++ __FLAGS_TYPE_NONE=0
418__FLAGS_TYPE_BOOLEAN=1
419++ __FLAGS_TYPE_BOOLEAN=1
420__FLAGS_TYPE_FLOAT=2
421++ __FLAGS_TYPE_FLOAT=2
422__FLAGS_TYPE_INTEGER=3
423++ __FLAGS_TYPE_INTEGER=3
424__FLAGS_TYPE_STRING=4
425++ __FLAGS_TYPE_STRING=4
426
427# set the constants readonly
428__flags_constants=`set |awk -F= '/^FLAGS_/ || /^__FLAGS_/ {print $1}'`
429set |awk -F= '/^FLAGS_/ || /^__FLAGS_/ {print $1}'
430+++ set
431+++ awk -F= '/^FLAGS_/ || /^__FLAGS_/ {print $1}'
432++ __flags_constants='FLAGS_ERROR
433FLAGS_EXPR_CMD
434FLAGS_FALSE
435FLAGS_GETOPT_CMD
436FLAGS_TRUE
437FLAGS_VERSION
438__FLAGS_EXPR_CMD
439__FLAGS_GETOPT_VERS
440__FLAGS_GETOPT_VERS_BSD
441__FLAGS_GETOPT_VERS_ENH
442__FLAGS_GETOPT_VERS_STD
443__FLAGS_INFO_DEFAULT
444__FLAGS_INFO_HELP
445__FLAGS_INFO_SHORT
446__FLAGS_INFO_TYPE
447__FLAGS_LEN_LONG
448__FLAGS_LEN_SHORT
449__FLAGS_NULL
450__FLAGS_OPTSTR_LONG
451__FLAGS_OPTSTR_SHORT
452__FLAGS_RESERVED_LIST
453__FLAGS_TYPE_BOOLEAN
454__FLAGS_TYPE_FLOAT
455__FLAGS_TYPE_INTEGER
456__FLAGS_TYPE_NONE
457__FLAGS_TYPE_STRING
458__FLAGS_UNAME_S
459__FLAGS_USE_BUILTIN'
460for __flags_const in ${__flags_constants}; do
461  # skip certain flags
462  case ${__flags_const} in
463    FLAGS_HELP) continue ;;
464    FLAGS_PARENT) continue ;;
465  esac
466  # set flag readonly
467  if [ -z "${ZSH_VERSION:-}" ]; then
468    readonly ${__flags_const}
469  else  # handle zsh
470    case ${ZSH_VERSION} in
471      [123].*) readonly ${__flags_const} ;;
472      *) readonly -g ${__flags_const} ;;  # declare readonly constants globally
473    esac
474  fi
475done
476++ for __flags_const in '${__flags_constants}'
477++ case ${__flags_const} in
478++ '[' -z '' ']'
479++ readonly FLAGS_ERROR
480++ for __flags_const in '${__flags_constants}'
481++ case ${__flags_const} in
482++ '[' -z '' ']'
483++ readonly FLAGS_EXPR_CMD
484++ for __flags_const in '${__flags_constants}'
485++ case ${__flags_const} in
486++ '[' -z '' ']'
487++ readonly FLAGS_FALSE
488++ for __flags_const in '${__flags_constants}'
489++ case ${__flags_const} in
490++ '[' -z '' ']'
491++ readonly FLAGS_GETOPT_CMD
492++ for __flags_const in '${__flags_constants}'
493++ case ${__flags_const} in
494++ '[' -z '' ']'
495++ readonly FLAGS_TRUE
496++ for __flags_const in '${__flags_constants}'
497++ case ${__flags_const} in
498++ '[' -z '' ']'
499++ readonly FLAGS_VERSION
500++ for __flags_const in '${__flags_constants}'
501++ case ${__flags_const} in
502++ '[' -z '' ']'
503++ readonly __FLAGS_EXPR_CMD
504++ for __flags_const in '${__flags_constants}'
505++ case ${__flags_const} in
506++ '[' -z '' ']'
507++ readonly __FLAGS_GETOPT_VERS
508++ for __flags_const in '${__flags_constants}'
509++ case ${__flags_const} in
510++ '[' -z '' ']'
511++ readonly __FLAGS_GETOPT_VERS_BSD
512++ for __flags_const in '${__flags_constants}'
513++ case ${__flags_const} in
514++ '[' -z '' ']'
515++ readonly __FLAGS_GETOPT_VERS_ENH
516++ for __flags_const in '${__flags_constants}'
517++ case ${__flags_const} in
518++ '[' -z '' ']'
519++ readonly __FLAGS_GETOPT_VERS_STD
520++ for __flags_const in '${__flags_constants}'
521++ case ${__flags_const} in
522++ '[' -z '' ']'
523++ readonly __FLAGS_INFO_DEFAULT
524++ for __flags_const in '${__flags_constants}'
525++ case ${__flags_const} in
526++ '[' -z '' ']'
527++ readonly __FLAGS_INFO_HELP
528++ for __flags_const in '${__flags_constants}'
529++ case ${__flags_const} in
530++ '[' -z '' ']'
531++ readonly __FLAGS_INFO_SHORT
532++ for __flags_const in '${__flags_constants}'
533++ case ${__flags_const} in
534++ '[' -z '' ']'
535++ readonly __FLAGS_INFO_TYPE
536++ for __flags_const in '${__flags_constants}'
537++ case ${__flags_const} in
538++ '[' -z '' ']'
539++ readonly __FLAGS_LEN_LONG
540++ for __flags_const in '${__flags_constants}'
541++ case ${__flags_const} in
542++ '[' -z '' ']'
543++ readonly __FLAGS_LEN_SHORT
544++ for __flags_const in '${__flags_constants}'
545++ case ${__flags_const} in
546++ '[' -z '' ']'
547++ readonly __FLAGS_NULL
548++ for __flags_const in '${__flags_constants}'
549++ case ${__flags_const} in
550++ '[' -z '' ']'
551++ readonly __FLAGS_OPTSTR_LONG
552++ for __flags_const in '${__flags_constants}'
553++ case ${__flags_const} in
554++ '[' -z '' ']'
555++ readonly __FLAGS_OPTSTR_SHORT
556++ for __flags_const in '${__flags_constants}'
557++ case ${__flags_const} in
558++ '[' -z '' ']'
559++ readonly __FLAGS_RESERVED_LIST
560++ for __flags_const in '${__flags_constants}'
561++ case ${__flags_const} in
562++ '[' -z '' ']'
563++ readonly __FLAGS_TYPE_BOOLEAN
564++ for __flags_const in '${__flags_constants}'
565++ case ${__flags_const} in
566++ '[' -z '' ']'
567++ readonly __FLAGS_TYPE_FLOAT
568++ for __flags_const in '${__flags_constants}'
569++ case ${__flags_const} in
570++ '[' -z '' ']'
571++ readonly __FLAGS_TYPE_INTEGER
572++ for __flags_const in '${__flags_constants}'
573++ case ${__flags_const} in
574++ '[' -z '' ']'
575++ readonly __FLAGS_TYPE_NONE
576++ for __flags_const in '${__flags_constants}'
577++ case ${__flags_const} in
578++ '[' -z '' ']'
579++ readonly __FLAGS_TYPE_STRING
580++ for __flags_const in '${__flags_constants}'
581++ case ${__flags_const} in
582++ '[' -z '' ']'
583++ readonly __FLAGS_UNAME_S
584++ for __flags_const in '${__flags_constants}'
585++ case ${__flags_const} in
586++ '[' -z '' ']'
587++ readonly __FLAGS_USE_BUILTIN
588unset __flags_const __flags_constants
589++ unset __flags_const __flags_constants
590
591#
592# internal variables
593#
594
595# space separated lists
596__flags_boolNames=' '  # boolean flag names
597++ __flags_boolNames=' '
598__flags_longNames=' '  # long flag names
599++ __flags_longNames=' '
600__flags_shortNames=' '  # short flag names
601++ __flags_shortNames=' '
602__flags_definedNames=' ' # defined flag names (used for validation)
603++ __flags_definedNames=' '
604__flags_nonegateNames=' '
605++ __flags_nonegateNames=' '
606
607__flags_columns=''  # screen width in columns
608++ __flags_columns=
609__flags_opts=''  # temporary storage for parsed getopt flags
610++ __flags_opts=
611
612#------------------------------------------------------------------------------
613# private functions
614#
615
616# logging functions
617_flags_debug() { echo "flags:DEBUG $@" >&2; }
618_flags_warn() { echo "flags:WARN $@" >&2; }
619_flags_error() { echo "flags:ERROR $@" >&2; }
620_flags_fatal() { echo "flags:FATAL $@" >&2; exit ${FLAGS_ERROR}; }
621
622# Define a flag.
623#
624# Calling this function will define the following info variables for the
625# specified flag:
626#   FLAGS_flagname - the name for this flag (based upon the long flag name)
627#   __flags_<flag_name>_default - the default value
628#   __flags_flagname_help - the help string
629#   __flags_flagname_short - the single letter alias
630#   __flags_flagname_type - the type of flag (one of __FLAGS_TYPE_*)
631#
632# Args:
633#   _flags__type: integer: internal type of flag (__FLAGS_TYPE_*)
634#   _flags__name: string: long flag name
635#   _flags__default: default flag value
636#   _flags__help: string: help string
637#   _flags__short: string: (optional) short flag name
638# Returns:
639#   integer: success of operation, or error
640_flags_define()
641{
642  if [ $# -lt 4 ]; then
643    flags_error='DEFINE error: too few arguments'
644    flags_return=${FLAGS_ERROR}
645    _flags_error "${flags_error}"
646    return ${flags_return}
647  fi
648
649  _flags_type_=$1
650  _flags_name_=$2
651  _flags_default_=$3
652  _flags_help_=$4
653  _flags_short_=${5:-${__FLAGS_NULL}}
654
655  _flags_return_=${FLAGS_TRUE}
656  _flags_usName_=`_flags_removeExclamationName ${_flags_name_}`
657  _flags_usName_=`_flags_underscoreName ${_flags_usName_}`
658
659  # check whether the flag name is reserved
660  _flags_itemInList ${_flags_usName_} "${__FLAGS_RESERVED_LIST}"
661  if [ $? -eq ${FLAGS_TRUE} ]; then
662    flags_error="flag name (${_flags_name_}) is reserved"
663    _flags_return_=${FLAGS_ERROR}
664  fi
665
666  # require short option for getopt that don't support long options
667  if [ ${_flags_return_} -eq ${FLAGS_TRUE} \
668      -a ${__FLAGS_GETOPT_VERS} -ne ${__FLAGS_GETOPT_VERS_ENH} \
669      -a "${_flags_short_}" = "${__FLAGS_NULL}" ]
670  then
671    flags_error="short flag required for (${_flags_name_}) on this platform"
672    _flags_return_=${FLAGS_ERROR}
673  fi
674
675  # check for existing long name definition
676  if [ ${_flags_return_} -eq ${FLAGS_TRUE} ]; then
677    if _flags_itemInList ${_flags_usName_} ${__flags_definedNames}; then
678      flags_error="definition for ([no]${_flags_name_}) already exists"
679      _flags_warn "${flags_error}"
680      _flags_return_=${FLAGS_FALSE}
681    fi
682  fi
683
684  # check for existing short name definition
685  if [ ${_flags_return_} -eq ${FLAGS_TRUE} \
686      -a "${_flags_short_}" != "${__FLAGS_NULL}" ]
687  then
688    if _flags_itemInList "${_flags_short_}" ${__flags_shortNames}; then
689      flags_error="flag short name (${_flags_short_}) already defined"
690      _flags_warn "${flags_error}"
691      _flags_return_=${FLAGS_FALSE}
692    fi
693  fi
694
695  # handle default value. note, on several occasions the 'if' portion of an
696  # if/then/else contains just a ':' which does nothing. a binary reversal via
697  # '!' is not done because it does not work on all shells.
698  if [ ${_flags_return_} -eq ${FLAGS_TRUE} ]; then
699    case ${_flags_type_} in
700      ${__FLAGS_TYPE_BOOLEAN})
701        if _flags_validBool "${_flags_default_}"; then
702          case ${_flags_default_} in
703            true|t|0) _flags_default_=${FLAGS_TRUE} ;;
704            false|f|1) _flags_default_=${FLAGS_FALSE} ;;
705          esac
706          _flags_isNegate ${_flags_name_}
707          _flags_isNegate_=$?
708        else
709          flags_error="invalid default flag value '${_flags_default_}'"
710          _flags_return_=${FLAGS_ERROR}
711        fi
712        ;;
713
714      ${__FLAGS_TYPE_FLOAT})
715        if _flags_validFloat "${_flags_default_}"; then
716          :
717        else
718          flags_error="invalid default flag value '${_flags_default_}'"
719          _flags_return_=${FLAGS_ERROR}
720        fi
721        ;;
722
723      ${__FLAGS_TYPE_INTEGER})
724        if _flags_validInt "${_flags_default_}"; then
725          :
726        else
727          flags_error="invalid default flag value '${_flags_default_}'"
728          _flags_return_=${FLAGS_ERROR}
729        fi
730        ;;
731
732      ${__FLAGS_TYPE_STRING}) ;;  # everything in shell is a valid string
733
734      *)
735        flags_error="unrecognized flag type '${_flags_type_}'"
736        _flags_return_=${FLAGS_ERROR}
737        ;;
738    esac
739  fi
740
741  if [ ${_flags_return_} -eq ${FLAGS_TRUE} ]; then
742    # store flag information
743    eval "FLAGS_${_flags_usName_}='${_flags_default_}'"
744    eval "__flags_${_flags_usName_}_${__FLAGS_INFO_TYPE}=${_flags_type_}"
745    eval "__flags_${_flags_usName_}_${__FLAGS_INFO_DEFAULT}=\
746\"${_flags_default_}\""
747    eval "__flags_${_flags_usName_}_${__FLAGS_INFO_HELP}=\"${_flags_help_}\""
748    eval "__flags_${_flags_usName_}_${__FLAGS_INFO_SHORT}='${_flags_short_}'"
749
750    # append flag names to name lists
751    __flags_shortNames="${__flags_shortNames}${_flags_short_} "
752    __flags_longNames="${__flags_longNames}`_flags_removeExclamationName ${_flags_name_}` "
753    if [ ${_flags_type_} -eq ${__FLAGS_TYPE_BOOLEAN} \
754      -a  ${_flags_isNegate_} -eq ${FLAGS_TRUE} ]; then
755        __flags_boolNames="${__flags_boolNames}no${_flags_name_} "
756    fi
757
758    # append flag names to defined names for later validation checks
759    __flags_definedNames="${__flags_definedNames}${_flags_usName_} "
760    if [ ${_flags_type_} -eq ${__FLAGS_TYPE_BOOLEAN} ]; then
761      if [ ${_flags_isNegate_} -eq ${FLAGS_TRUE} ]; then
762        __flags_definedNames="${__flags_definedNames}no${_flags_usName_} "
763      fi
764    fi
765
766    # append flag names to nonegateNames names for later validation checks
767    __flags_definedNames="${__flags_definedNames}${_flags_usName_} "
768    if [ ${_flags_type_} -eq ${__FLAGS_TYPE_BOOLEAN} ]; then
769      if [ ${_flags_isNegate_} -eq ${FLAGS_FALSE} ]; then
770        __flags_nonegateNames="${__flags_nonegateNames}`_flags_removeExclamationName ${_flags_name_}` "
771      fi
772    fi
773
774  fi
775
776  flags_return=${_flags_return_}
777  unset _flags_default_ _flags_help_ _flags_name_ _flags_return_ \
778      _flags_short_ _flags_type_ _flags_usName_
779  [ ${flags_return} -eq ${FLAGS_ERROR} ] && _flags_error "${flags_error}"
780  return ${flags_return}
781}
782
783# Underscore a flag name by replacing dashes with underscores.
784#
785# Args:
786#   unnamed: string: log flag name
787# Output:
788#   string: underscored name
789_flags_underscoreName()
790{
791  echo $1 |tr '-' '_'
792}
793
794# Strip potential exclamation mark
795#
796# Args:
797#   unnamed: string: log flag name
798# Output:
799#   string: exclamation stripped from name
800_flags_removeExclamationName()
801{
802  _flags_opt_=$1
803  if _flags_isNegate "${_flags_opt_}"; then
804    echo ${_flags_opt_}
805  else
806      if _flags_useBuiltin; then
807        echo ${_flags_opt_%!*}
808      else
809        echo ${_flags_opt_}|sed 's/!$//'
810      fi
811  fi
812  unset _flags_opt_
813  return ${FLAGS_TRUE}
814}
815
816# Check if a flag ends in an exclamation mark,
817#  if it does, there will not be a negate option
818# Args:
819#   unnamed: string: flag name
820# return:
821#   boolean
822_flags_isNegate()
823{
824  case $1 in
825    *!) flags_return=${FLAGS_FALSE} ;;
826    *) flags_return=${FLAGS_TRUE} ;;
827  esac
828  return ${flags_return}
829}
830
831
832# Return valid getopt options using currently defined list of long options.
833#
834# This function builds a proper getopt option string for short (and long)
835# options, using the current list of long options for reference.
836#
837# Args:
838#   _flags_optStr: integer: option string type (__FLAGS_OPTSTR_*)
839# Output:
840#   string: generated option string for getopt
841# Returns:
842#   boolean: success of operation (always returns True)
843_flags_genOptStr()
844{
845  _flags_optStrType_=$1
846
847  _flags_opts_=''
848
849  for _flags_name_ in ${__flags_longNames}; do
850    _flags_usName_=`_flags_removeExclamationName ${_flags_name_}`
851    _flags_usName_=`_flags_underscoreName ${_flags_usName_}`
852    _flags_type_=`_flags_getFlagInfo ${_flags_usName_} ${__FLAGS_INFO_TYPE}`
853    [ $? -eq ${FLAGS_TRUE} ] || _flags_fatal 'call to _flags_type_ failed'
854    case ${_flags_optStrType_} in
855      ${__FLAGS_OPTSTR_SHORT})
856        _flags_shortName_=`_flags_getFlagInfo \
857            ${_flags_usName_} ${__FLAGS_INFO_SHORT}`
858        if [ "${_flags_shortName_}" != "${__FLAGS_NULL}" ]; then
859          _flags_opts_="${_flags_opts_}${_flags_shortName_}"
860          # getopt needs a trailing ':' to indicate a required argument
861          [ ${_flags_type_} -ne ${__FLAGS_TYPE_BOOLEAN} ] && \
862              _flags_opts_="${_flags_opts_}:"
863        fi
864        ;;
865
866      ${__FLAGS_OPTSTR_LONG})
867        _flags_opts_="${_flags_opts_:+${_flags_opts_},}`_flags_removeExclamationName ${_flags_name_}`"
868        # getopt needs a trailing ':' to indicate a required argument
869        [ ${_flags_type_} -ne ${__FLAGS_TYPE_BOOLEAN} ] && \
870            _flags_opts_="${_flags_opts_}:"
871        ;;
872    esac
873  done
874
875  echo "${_flags_opts_}"
876  unset _flags_name_ _flags_opts_ _flags_optStrType_ _flags_shortName_ \
877      _flags_type_ _flags_usName_
878  return ${FLAGS_TRUE}
879}
880
881# Returns flag details based on a flag name and flag info.
882#
883# Args:
884#   string: underscored flag name
885#   string: flag info (see the _flags_define function for valid info types)
886# Output:
887#   string: value of dereferenced flag variable
888# Returns:
889#   integer: one of FLAGS_{TRUE|FALSE|ERROR}
890_flags_getFlagInfo()
891{
892  # note: adding gFI to variable names to prevent naming conflicts with calling
893  # functions
894  _flags_gFI_usName_=$1
895  _flags_gFI_info_=$2
896
897  _flags_infoVar_="__flags_${_flags_gFI_usName_}_${_flags_gFI_info_}"
898  _flags_strToEval_="_flags_infoValue_=\"\${${_flags_infoVar_}:-}\""
899  eval "${_flags_strToEval_}"
900  if [ -n "${_flags_infoValue_}" ]; then
901    flags_return=${FLAGS_TRUE}
902  else
903    # see if the _flags_gFI_usName_ variable is a string as strings can be
904    # empty...
905    # note: the DRY principle would say to have this function call itself for
906    # the next three lines, but doing so results in an infinite loop as an
907    # invalid _flags_name_ will also not have the associated _type variable.
908    # Because it doesn't (it will evaluate to an empty string) the logic will
909    # try to find the _type variable of the _type variable, and so on. Not so
910    # good ;-)
911    _flags_typeVar_="__flags_${_flags_gFI_usName_}_${__FLAGS_INFO_TYPE}"
912    _flags_strToEval_="_flags_typeValue_=\"\${${_flags_typeVar_}:-}\""
913    eval "${_flags_strToEval_}"
914    if [ "${_flags_typeValue_}" = "${__FLAGS_TYPE_STRING}" ]; then
915      flags_return=${FLAGS_TRUE}
916    else
917      flags_return=${FLAGS_ERROR}
918      flags_error="missing flag info variable (${_flags_infoVar_})"
919    fi
920  fi
921
922  echo "${_flags_infoValue_}"
923  unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ \
924      _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
925  [ ${flags_return} -eq ${FLAGS_ERROR} ] && _flags_error "${flags_error}"
926  return ${flags_return}
927}
928
929# Check for presense of item in a list.
930#
931# Passed a string (e.g. 'abc'), this function will determine if the string is
932# present in the list of strings (e.g.  ' foo bar abc ').
933#
934# Args:
935#   _flags_str_: string: string to search for in a list of strings
936#   unnamed: list: list of strings
937# Returns:
938#   boolean: true if item is in the list
939_flags_itemInList() {
940  _flags_str_=$1
941  shift
942  _flags_list_=" ${*:-} "
943
944  case ${_flags_list_} in
945      *\ ${_flags_str_}\ *)
946      flags_return=$FLAGS_TRUE
947      ;;
948    *)
949      flags_return=$FLAGS_FALSE
950      ;;
951  esac
952
953  unset _flags_str_ _flags_list_
954  return ${flags_return}
955}
956
957# Returns the width of the current screen.
958#
959# Output:
960#   integer: width in columns of the current screen.
961_flags_columns()
962{
963  if [ -z "${__flags_columns}" ]; then
964    # determine the value and store it
965    if eval stty size >/dev/null 2>&1; then
966      # stty size worked :-)
967      set -- `stty size`
968      __flags_columns=$2
969    elif eval tput cols >/dev/null 2>&1; then
970      set -- `tput cols`
971      __flags_columns=$1
972    else
973      __flags_columns=80  # default terminal width
974    fi
975  fi
976  echo ${__flags_columns}
977}
978
979# Validate a boolean.
980#
981# Args:
982#   _flags__bool: boolean: value to validate
983# Returns:
984#   bool: true if the value is a valid boolean
985_flags_validBool()
986{
987  _flags_bool_=$1
988
989  flags_return=${FLAGS_TRUE}
990  case "${_flags_bool_}" in
991    true|t|0) ;;
992    false|f|1) ;;
993    *) flags_return=${FLAGS_FALSE} ;;
994  esac
995
996  unset _flags_bool_
997  return ${flags_return}
998}
999
1000# Validate a float.
1001#
1002# Args:
1003#   _flags_float_: float: value to validate
1004# Returns:
1005#   bool: true if the value is a valid integer
1006_flags_validFloat()
1007{
1008  flags_return=${FLAGS_FALSE}
1009  [ -n "$1" ] || return ${flags_return}
1010  _flags_float_=$1
1011
1012  if _flags_validInt ${_flags_float_}; then
1013    flags_return=${FLAGS_TRUE}
1014  elif _flags_useBuiltin; then
1015    _flags_float_whole_=${_flags_float_%.*}
1016    _flags_float_fraction_=${_flags_float_#*.}
1017    if _flags_validInt ${_flags_float_whole_:-0} -a \
1018      _flags_validInt ${_flags_float_fraction_}; then
1019      flags_return=${FLAGS_TRUE}
1020    fi
1021    unset _flags_float_whole_ _flags_float_fraction_
1022  else
1023    flags_return=${FLAGS_TRUE}
1024    case ${_flags_float_} in
1025      -*)  # negative floats
1026        _flags_test_=`${FLAGS_EXPR_CMD} -- "${_flags_float_}" :\
1027            '\(-[0-9]*\.[0-9]*\)'`
1028        ;;
1029      *)  # positive floats
1030        _flags_test_=`${FLAGS_EXPR_CMD} -- "${_flags_float_}" :\
1031            '\([0-9]*\.[0-9]*\)'`
1032        ;;
1033    esac
1034    [ "${_flags_test_}" != "${_flags_float_}" ] && flags_return=${FLAGS_FALSE}
1035    unset _flags_test_
1036  fi
1037
1038  unset _flags_float_ _flags_float_whole_ _flags_float_fraction_
1039  return ${flags_return}
1040}
1041
1042# Validate an integer.
1043#
1044# Args:
1045#   _flags_int_: integer: value to validate
1046# Returns:
1047#   bool: true if the value is a valid integer
1048_flags_validInt()
1049{
1050  flags_return=${FLAGS_FALSE}
1051  [ -n "$1" ] || return ${flags_return}
1052  _flags_int_=$1
1053
1054  case ${_flags_int_} in
1055    -*.*) ;;  # ignore negative floats (we'll invalidate them later)
1056    -*)  # strip possible leading negative sign
1057      if _flags_useBuiltin; then
1058        _flags_int_=${_flags_int_#-}
1059      else
1060        _flags_int_=`${FLAGS_EXPR_CMD} -- "${_flags_int_}" : '-\([0-9][0-9]*\)'`
1061      fi
1062      ;;
1063  esac
1064
1065  case ${_flags_int_} in
1066    *[!0-9]*) flags_return=${FLAGS_FALSE} ;;
1067    *) flags_return=${FLAGS_TRUE} ;;
1068  esac
1069
1070  unset _flags_int_
1071  return ${flags_return}
1072}
1073
1074# Parse command-line options using the standard getopt.
1075#
1076# Note: the flag options are passed around in the global __flags_opts so that
1077# the formatting is not lost due to shell parsing and such.
1078#
1079# Args:
1080#   @: varies: command-line options to parse
1081# Returns:
1082#   integer: a FLAGS success condition
1083_flags_getoptStandard()
1084{
1085  flags_return=${FLAGS_TRUE}
1086  _flags_shortOpts_=`_flags_genOptStr ${__FLAGS_OPTSTR_SHORT}`
1087
1088  # check for spaces in passed options
1089  for _flags_opt_ in "$@"; do
1090    # note: the silliness with the x's is purely for ksh93 on Ubuntu 6.06
1091    _flags_match_=`echo "x${_flags_opt_}x" |sed 's/ //g'`
1092    if [ "${_flags_match_}" != "x${_flags_opt_}x" ]; then
1093      flags_error='the available getopt does not support spaces in options'
1094      flags_return=${FLAGS_ERROR}
1095      break
1096    fi
1097  done
1098
1099  if [ ${flags_return} -eq ${FLAGS_TRUE} ]; then
1100    __flags_opts=`getopt ${_flags_shortOpts_} $@ 2>&1`
1101    _flags_rtrn_=$?
1102    if [ ${_flags_rtrn_} -ne ${FLAGS_TRUE} ]; then
1103      _flags_warn "${__flags_opts}"
1104      flags_error='unable to parse provided options with getopt.'
1105      flags_return=${FLAGS_ERROR}
1106    fi
1107  fi
1108
1109  unset _flags_match_ _flags_opt_ _flags_rtrn_ _flags_shortOpts_
1110  return ${flags_return}
1111}
1112
1113# Parse command-line options using the enhanced getopt.
1114#
1115# Note: the flag options are passed around in the global __flags_opts so that
1116# the formatting is not lost due to shell parsing and such.
1117#
1118# Args:
1119#   @: varies: command-line options to parse
1120# Returns:
1121#   integer: a FLAGS success condition
1122_flags_getoptEnhanced()
1123{
1124  flags_return=${FLAGS_TRUE}
1125  _flags_shortOpts_=`_flags_genOptStr ${__FLAGS_OPTSTR_SHORT}`
1126  _flags_boolOpts_=`echo "${__flags_boolNames}" \
1127      |sed 's/^ *//;s/ *$//;s/ /,/g'`
1128  _flags_longOpts_=`_flags_genOptStr ${__FLAGS_OPTSTR_LONG}`
1129
1130  __flags_opts=`${FLAGS_GETOPT_CMD} \
1131      -o ${_flags_shortOpts_} \
1132      -l "${_flags_longOpts_},${_flags_boolOpts_}" \
1133      -- "$@" 2>&1`
1134  _flags_rtrn_=$?
1135  if [ ${_flags_rtrn_} -ne ${FLAGS_TRUE} ]; then
1136    _flags_warn "${__flags_opts}"
1137    flags_error='unable to parse provided options with getopt.'
1138    flags_return=${FLAGS_ERROR}
1139  fi
1140
1141  unset _flags_boolOpts_ _flags_longOpts_ _flags_rtrn_ _flags_shortOpts_
1142  return ${flags_return}
1143}
1144
1145# Dynamically parse a getopt result and set appropriate variables.
1146#
1147# This function does the actual conversion of getopt output and runs it through
1148# the standard case structure for parsing. The case structure is actually quite
1149# dynamic to support any number of flags.
1150#
1151# Args:
1152#   argc: int: original command-line argument count
1153#   @: varies: output from getopt parsing
1154# Returns:
1155#   integer: a FLAGS success condition
1156_flags_parseGetopt()
1157{
1158  _flags_argc_=$1
1159  shift
1160
1161  flags_return=${FLAGS_TRUE}
1162
1163  if [ ${__FLAGS_GETOPT_VERS} -ne ${__FLAGS_GETOPT_VERS_ENH} ]; then
1164    set -- $@
1165  else
1166    # note the quotes around the `$@' -- they are essential!
1167    eval set -- "$@"
1168  fi
1169
1170  # Provide user with the number of arguments to shift by later.
1171  # NOTE: the FLAGS_ARGC variable is obsolete as of 1.0.3 because it does not
1172  # properly give user access to non-flag arguments mixed in between flag
1173  # arguments. Its usage was replaced by FLAGS_ARGV, and it is being kept only
1174  # for backwards compatibility reasons.
1175  FLAGS_ARGC=`_flags_math "$# - 1 - ${_flags_argc_}"`
1176
1177  # handle options. note options with values must do an additional shift
1178  while true; do
1179    _flags_opt_=$1
1180    _flags_arg_=${2:-}
1181    _flags_type_=${__FLAGS_TYPE_NONE}
1182    _flags_name_=''
1183
1184    # determine long flag name
1185    case "${_flags_opt_}" in
1186      --) shift; break ;;  # discontinue option parsing
1187
1188      --*)  # long option
1189        if _flags_useBuiltin; then
1190          _flags_opt_=${_flags_opt_#*--}
1191        else
1192          _flags_opt_=`${FLAGS_EXPR_CMD} -- "${_flags_opt_}" : '--\(.*\)'`
1193        fi
1194        _flags_len_=${__FLAGS_LEN_LONG}
1195        if _flags_itemInList "${_flags_opt_}" ${__flags_longNames}; then
1196          _flags_name_=${_flags_opt_}
1197        else
1198          # check for negated long boolean version
1199          if _flags_itemInList "${_flags_opt_}" ${__flags_boolNames}; then
1200            if _flags_useBuiltin; then
1201              _flags_name_=${_flags_opt_#*no}
1202            else
1203              _flags_name_=`${FLAGS_EXPR_CMD} -- "${_flags_opt_}" : 'no\(.*\)'`
1204            fi
1205            _flags_type_=${__FLAGS_TYPE_BOOLEAN}
1206            _flags_arg_=${__FLAGS_NULL}
1207          fi
1208        fi
1209        ;;
1210
1211      -*)  # short option
1212        if _flags_useBuiltin; then
1213          _flags_opt_=${_flags_opt_#*-}
1214        else
1215          _flags_opt_=`${FLAGS_EXPR_CMD} -- "${_flags_opt_}" : '-\(.*\)'`
1216        fi
1217        _flags_len_=${__FLAGS_LEN_SHORT}
1218        if _flags_itemInList "${_flags_opt_}" ${__flags_shortNames}; then
1219          # yes. match short name to long name. note purposeful off-by-one
1220          # (too high) with awk calculations.
1221          _flags_pos_=`echo "${__flags_shortNames}" \
1222              |awk 'BEGIN{RS=" ";rn=0}$0==e{rn=NR}END{print rn}' \
1223                  e=${_flags_opt_}`
1224          _flags_name_=`echo "${__flags_longNames}" \
1225              |awk 'BEGIN{RS=" "}rn==NR{print $0}' rn="${_flags_pos_}"`
1226        fi
1227        ;;
1228    esac
1229
1230    # die if the flag was unrecognized
1231    if [ -z "${_flags_name_}" ]; then
1232      flags_error="unrecognized option (${_flags_opt_})"
1233      flags_return=${FLAGS_ERROR}
1234      break
1235    fi
1236
1237    # set new flag value
1238    _flags_usName_=`_flags_removeExclamationName ${_flags_name_}`
1239    _flags_usName_=`_flags_underscoreName ${_flags_usName_}`
1240    [ ${_flags_type_} -eq ${__FLAGS_TYPE_NONE} ] && \
1241        _flags_type_=`_flags_getFlagInfo \
1242            "${_flags_usName_}" ${__FLAGS_INFO_TYPE}`
1243    case ${_flags_type_} in
1244      ${__FLAGS_TYPE_BOOLEAN})
1245        if [ ${_flags_len_} -eq ${__FLAGS_LEN_LONG} ]; then
1246          if [ "${_flags_arg_}" != "${__FLAGS_NULL}" ]; then
1247            eval "FLAGS_${_flags_usName_}=${FLAGS_TRUE}"
1248          else
1249            eval "FLAGS_${_flags_usName_}=${FLAGS_FALSE}"
1250          fi
1251        else
1252          _flags_strToEval_="_flags_val_=\
1253\${__flags_${_flags_usName_}_${__FLAGS_INFO_DEFAULT}}"
1254          eval "${_flags_strToEval_}"
1255          if [ ${_flags_val_} -eq ${FLAGS_FALSE} ]; then
1256            eval "FLAGS_${_flags_usName_}=${FLAGS_TRUE}"
1257          else
1258            eval "FLAGS_${_flags_usName_}=${FLAGS_FALSE}"
1259          fi
1260        fi
1261        ;;
1262
1263      ${__FLAGS_TYPE_FLOAT})
1264        if _flags_validFloat "${_flags_arg_}"; then
1265          eval "FLAGS_${_flags_usName_}='${_flags_arg_}'"
1266        else
1267          flags_error="invalid float value (${_flags_arg_})"
1268          flags_return=${FLAGS_ERROR}
1269          break
1270        fi
1271        ;;
1272
1273      ${__FLAGS_TYPE_INTEGER})
1274        if _flags_validInt "${_flags_arg_}"; then
1275          eval "FLAGS_${_flags_usName_}='${_flags_arg_}'"
1276        else
1277          flags_error="invalid integer value (${_flags_arg_})"
1278          flags_return=${FLAGS_ERROR}
1279          break
1280        fi
1281        ;;
1282
1283      ${__FLAGS_TYPE_STRING})
1284        eval "FLAGS_${_flags_usName_}='${_flags_arg_}'"
1285        ;;
1286    esac
1287
1288    # handle special case help flag
1289    if [ "${_flags_usName_}" = 'help' ]; then
1290      if [ ${FLAGS_help} -eq ${FLAGS_TRUE} ]; then
1291        flags_help
1292        flags_error='help requested'
1293        flags_return=${FLAGS_TRUE}
1294        break
1295      fi
1296    fi
1297
1298    # shift the option and non-boolean arguements out.
1299    shift
1300    [ ${_flags_type_} != ${__FLAGS_TYPE_BOOLEAN} ] && shift
1301  done
1302
1303  # give user back non-flag arguments
1304  FLAGS_ARGV=''
1305  while [ $# -gt 0 ]; do
1306    FLAGS_ARGV="${FLAGS_ARGV:+${FLAGS_ARGV} }'$1'"
1307    shift
1308  done
1309
1310  unset _flags_arg_ _flags_len_ _flags_name_ _flags_opt_ _flags_pos_ \
1311      _flags_strToEval_ _flags_type_ _flags_usName_ _flags_val_
1312  return ${flags_return}
1313}
1314
1315# Perform some path using built-ins.
1316#
1317# Args:
1318#   $@: string: math expression to evaluate
1319# Output:
1320#   integer: the result
1321# Returns:
1322#   bool: success of math evaluation
1323_flags_math()
1324{
1325  if [ $# -eq 0 ]; then
1326    flags_return=${FLAGS_FALSE}
1327  elif _flags_useBuiltin; then
1328    # Variable assignment is needed as workaround for Solaris Bourne shell,
1329    # which cannot parse a bare $((expression)).
1330    _flags_expr_='$(($@))'
1331    eval echo ${_flags_expr_}
1332    flags_return=$?
1333    unset _flags_expr_
1334  else
1335    eval expr $@
1336    flags_return=$?
1337  fi
1338
1339  return ${flags_return}
1340}
1341
1342# Cross-platform strlen() implementation.
1343#
1344# Args:
1345#   _flags_str: string: to determine length of
1346# Output:
1347#   integer: length of string
1348# Returns:
1349#   bool: success of strlen evaluation
1350_flags_strlen()
1351{
1352  _flags_str_=${1:-}
1353
1354  if [ -z "${_flags_str_}" ]; then
1355    flags_output=0
1356  elif _flags_useBuiltin; then
1357    flags_output=${#_flags_str_}
1358  else
1359    flags_output=`${FLAGS_EXPR_CMD} -- "${_flags_str_}" : '.*'`
1360  fi
1361  flags_return=$?
1362
1363  unset _flags_str_
1364  echo ${flags_output}
1365  return ${flags_return}
1366}
1367
1368# Use built-in helper function to enable unit testing.
1369#
1370# Args:
1371#   None
1372# Returns:
1373#   bool: true if built-ins should be used
1374_flags_useBuiltin()
1375{
1376  return ${__FLAGS_USE_BUILTIN}
1377}
1378
1379#------------------------------------------------------------------------------
1380# public functions
1381#
1382# A basic boolean flag. Boolean flags do not take any arguments, and their
1383# value is either 1 (false) or 0 (true). For long flags, the false value is
1384# specified on the command line by prepending the word 'no'. With short flags,
1385# the presense of the flag toggles the current value between true and false.
1386# Specifying a short boolean flag twice on the command results in returning the
1387# value back to the default value.
1388#
1389# A default value is required for boolean flags.
1390#
1391# For example, lets say a Boolean flag was created whose long name was 'update'
1392# and whose short name was 'x', and the default value was 'false'. This flag
1393# could be explicitly set to 'true' with '--update' or by '-x', and it could be
1394# explicitly set to 'false' with '--noupdate'.
1395DEFINE_boolean() { _flags_define ${__FLAGS_TYPE_BOOLEAN} "$@"; }
1396
1397# Other basic flags.
1398DEFINE_float()   { _flags_define ${__FLAGS_TYPE_FLOAT} "$@"; }
1399DEFINE_integer() { _flags_define ${__FLAGS_TYPE_INTEGER} "$@"; }
1400DEFINE_string()  { _flags_define ${__FLAGS_TYPE_STRING} "$@"; }
1401
1402# Parse the flags.
1403#
1404# Args:
1405#   unnamed: list: command-line flags to parse
1406# Returns:
1407#   integer: success of operation, or error
1408FLAGS()
1409{
1410  # define a standard 'help' flag if one isn't already defined
1411  [ -z "${__flags_help_type:-}" ] && \
1412      DEFINE_boolean 'help!' false 'show this help' 'h'
1413
1414  # parse options
1415  if [ $# -gt 0 ]; then
1416    if [ ${__FLAGS_GETOPT_VERS} -ne ${__FLAGS_GETOPT_VERS_ENH} ]; then
1417      _flags_getoptStandard "$@"
1418    else
1419      _flags_getoptEnhanced "$@"
1420    fi
1421    flags_return=$?
1422  else
1423    # nothing passed; won't bother running getopt
1424    __flags_opts='--'
1425    flags_return=${FLAGS_TRUE}
1426  fi
1427
1428  if [ ${flags_return} -eq ${FLAGS_TRUE} ]; then
1429    _flags_parseGetopt $# "${__flags_opts}"
1430    flags_return=$?
1431  fi
1432
1433  [ ${flags_return} -eq ${FLAGS_ERROR} ] && _flags_fatal "${flags_error}"
1434  return ${flags_return}
1435}
1436
1437# This is a helper function for determining the 'getopt' version for platforms
1438# where the detection isn't working. It simply outputs debug information that
1439# can be included in a bug report.
1440#
1441# Args:
1442#   none
1443# Output:
1444#   debug info that can be included in a bug report
1445# Returns:
1446#   nothing
1447flags_getoptInfo()
1448{
1449  # platform info
1450  _flags_debug "uname -a: `uname -a`"
1451  _flags_debug "PATH: ${PATH}"
1452
1453  # shell info
1454  if [ -n "${BASH_VERSION:-}" ]; then
1455    _flags_debug 'shell: bash'
1456    _flags_debug "BASH_VERSION: ${BASH_VERSION}"
1457  elif [ -n "${ZSH_VERSION:-}" ]; then
1458    _flags_debug 'shell: zsh'
1459    _flags_debug "ZSH_VERSION: ${ZSH_VERSION}"
1460  fi
1461
1462  # getopt info
1463  ${FLAGS_GETOPT_CMD} >/dev/null
1464  _flags_getoptReturn=$?
1465  _flags_debug "getopt return: ${_flags_getoptReturn}"
1466  _flags_debug "getopt --version: `${FLAGS_GETOPT_CMD} --version 2>&1`"
1467
1468  unset _flags_getoptReturn
1469}
1470
1471# Returns whether the detected getopt version is the enhanced version.
1472#
1473# Args:
1474#   none
1475# Output:
1476#   none
1477# Returns:
1478#   bool: true if getopt is the enhanced version
1479flags_getoptIsEnh()
1480{
1481  test ${__FLAGS_GETOPT_VERS} -eq ${__FLAGS_GETOPT_VERS_ENH}
1482}
1483
1484# Returns whether the detected getopt version is the standard version.
1485#
1486# Args:
1487#   none
1488# Returns:
1489#   bool: true if getopt is the standard version
1490flags_getoptIsStd()
1491{
1492  test ${__FLAGS_GETOPT_VERS} -eq ${__FLAGS_GETOPT_VERS_STD}
1493}
1494
1495# This is effectively a 'usage()' function. It prints usage information and
1496# exits the program with ${FLAGS_FALSE} if it is ever found in the command line
1497# arguments. Note this function can be overridden so other apps can define
1498# their own --help flag, replacing this one, if they want.
1499#
1500# Args:
1501#   none
1502# Returns:
1503#   integer: success of operation (always returns true)
1504flags_help()
1505{
1506  if [ -n "${FLAGS_HELP:-}" ]; then
1507    echo "${FLAGS_HELP}" >&2
1508  else
1509    echo "USAGE: ${FLAGS_PARENT:-$0} [flags] args" >&2
1510  fi
1511  if [ -n "${__flags_longNames}" ]; then
1512    echo 'flags:' >&2
1513    for flags_name_ in ${__flags_longNames}; do
1514      flags_flagStr_=''
1515      flags_boolStr_=''
1516      flags_usName_=`_flags_underscoreName ${flags_name_}`
1517
1518      flags_default_=`_flags_getFlagInfo \
1519          "${flags_usName_}" ${__FLAGS_INFO_DEFAULT}`
1520      flags_help_=`_flags_getFlagInfo \
1521          "${flags_usName_}" ${__FLAGS_INFO_HELP}`
1522      flags_short_=`_flags_getFlagInfo \
1523          "${flags_usName_}" ${__FLAGS_INFO_SHORT}`
1524      flags_type_=`_flags_getFlagInfo \
1525          "${flags_usName_}" ${__FLAGS_INFO_TYPE}`
1526
1527      [ "${flags_short_}" != "${__FLAGS_NULL}" ] && \
1528          flags_flagStr_="-${flags_short_}"
1529
1530      if [ ${__FLAGS_GETOPT_VERS} -eq ${__FLAGS_GETOPT_VERS_ENH} ]; then
1531        [ "${flags_short_}" != "${__FLAGS_NULL}" ] && \
1532            flags_flagStr_="${flags_flagStr_},"
1533        # add [no] to long boolean flag names, except the 'help' flag
1534        if [ ${flags_type_} -eq ${__FLAGS_TYPE_BOOLEAN} ]; then
1535          _flags_itemInList "${flags_name_}" ${__flags_nonegateNames}
1536           if [ $? -eq ${FLAGS_FALSE} ]; then
1537              flags_boolStr_='[no]'
1538           fi
1539        fi
1540        flags_flagStr_="${flags_flagStr_}--${flags_boolStr_}${flags_name_}:"
1541      fi
1542
1543      case ${flags_type_} in
1544        ${__FLAGS_TYPE_BOOLEAN})
1545          if [ ${flags_default_} -eq ${FLAGS_TRUE} ]; then
1546            flags_defaultStr_='true'
1547          else
1548            flags_defaultStr_='false'
1549          fi
1550          ;;
1551        ${__FLAGS_TYPE_FLOAT}|${__FLAGS_TYPE_INTEGER})
1552          flags_defaultStr_=${flags_default_} ;;
1553        ${__FLAGS_TYPE_STRING}) flags_defaultStr_="'${flags_default_}'" ;;
1554      esac
1555      flags_defaultStr_="(default: ${flags_defaultStr_})"
1556
1557      flags_helpStr_="  ${flags_flagStr_}  ${flags_help_} ${flags_defaultStr_}"
1558      _flags_strlen "${flags_helpStr_}" >/dev/null
1559      flags_helpStrLen_=${flags_output}
1560      flags_columns_=`_flags_columns`
1561
1562      if [ ${flags_helpStrLen_} -lt ${flags_columns_} ]; then
1563        echo "${flags_helpStr_}" >&2
1564      else
1565        echo "  ${flags_flagStr_}  ${flags_help_}" >&2
1566        # note: the silliness with the x's is purely for ksh93 on Ubuntu 6.06
1567        # because it doesn't like empty strings when used in this manner.
1568        flags_emptyStr_="`echo \"x${flags_flagStr_}x\" \
1569            |awk '{printf "%"length($0)-2"s", ""}'`"
1570        flags_helpStr_="  ${flags_emptyStr_}  ${flags_defaultStr_}"
1571        _flags_strlen "${flags_helpStr_}" >/dev/null
1572        flags_helpStrLen_=${flags_output}
1573
1574        if [ ${__FLAGS_GETOPT_VERS} -eq ${__FLAGS_GETOPT_VERS_STD} \
1575            -o ${flags_helpStrLen_} -lt ${flags_columns_} ]; then
1576          # indented to match help string
1577          echo "${flags_helpStr_}" >&2
1578        else
1579          # indented four from left to allow for longer defaults as long flag
1580          # names might be used too, making things too long
1581          echo "    ${flags_defaultStr_}" >&2
1582        fi
1583      fi
1584    done
1585  fi
1586
1587  unset flags_boolStr_ flags_default_ flags_defaultStr_ flags_emptyStr_ \
1588      flags_flagStr_ flags_help_ flags_helpStr flags_helpStrLen flags_name_ \
1589      flags_columns_ flags_short_ flags_type_ flags_usName_
1590  return ${FLAGS_TRUE}
1591}
1592
1593# Reset shflags back to an uninitialized state.
1594#
1595# Args:
1596#   none
1597# Returns:
1598#   nothing
1599flags_reset()
1600{
1601  for flags_name_ in ${__flags_longNames}; do
1602    flags_usName_=`_flags_removeExclamationName ${flags_name_}`
1603    flags_usName_=`_flags_underscoreName ${flags_usName_}`
1604    flags_strToEval_="unset FLAGS_${flags_usName_}"
1605    for flags_type_ in \
1606        ${__FLAGS_INFO_DEFAULT} \
1607        ${__FLAGS_INFO_HELP} \
1608        ${__FLAGS_INFO_SHORT} \
1609        ${__FLAGS_INFO_TYPE}
1610    do
1611      flags_strToEval_=\
1612"${flags_strToEval_} __flags_${flags_usName_}_${flags_type_}"
1613    done
1614    eval ${flags_strToEval_}
1615  done
1616
1617  # reset internal variables
1618  __flags_boolNames=' '
1619  __flags_longNames=' '
1620  __flags_shortNames=' '
1621  __flags_definedNames=' '
1622
1623  unset flags_name_ flags_type_ flags_strToEval_ flags_usName_
1624}
1625+ FLAGS_PARENT='git flow'
1626+ . /opt/local/bin/gitflow-common
1627#
1628# git-flow -- A collection of Git extensions to provide high-level
1629# repository operations for Vincent Driessen's branching model.
1630#
1631# A blog post presenting this model is found at:
1632#    http://blog.avirtualhome.com/development-workflow-using-git/
1633#
1634# Feel free to contribute to this project at:
1635#    http://github.com/petervanderdoes/gitflow
1636#
1637# Authors:
1638# Copyright 2012,2013 Peter van der Does. All rights reserved.
1639#
1640# Original Author:
1641# Copyright 2010 Vincent Driessen. All rights reserved.
1642#
1643# Redistribution and use in source and binary forms, with or without
1644# modification, are permitted provided that the following conditions are met:
1645#
1646# 1. Redistributions of source code must retain the above copyright notice, this
1647#    list of conditions and the following disclaimer.
1648# 2. Redistributions in binary form must reproduce the above copyright notice,
1649#    this list of conditions and the following disclaimer in the documentation
1650#    and/or other materials provided with the distribution.
1651#
1652# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
1653# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
1654# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
1655# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
1656# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
1657# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
1658# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
1659# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
1660# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
1661# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1662#
1663
1664#
1665# Common functionality
1666#
1667
1668# Shell output
1669warn() { echo "$@" >&2; }
1670die() { warn "Fatal: $@"; exit 1; }
1671die_help() { warn $@; flags_help; exit 1; }
1672
1673escape() {
1674        echo "$1" | sed 's/\([\.\$\*]\)/\\\1/g'
1675}
1676
1677#
1678# String contains function
1679# $1 haystack
1680# $2 Needle
1681#
1682contains() {
1683        local return
1684
1685        case $1 in
1686                *$2*)
1687                        return=$FLAGS_TRUE
1688                        ;;
1689                *)
1690                        return=$FLAGS_FALSE
1691                        ;;
1692        esac
1693        return $return
1694}
1695
1696# Basic math
1697min() { [ "$1" -le "$2" ] && echo "$1" || echo "$2"; }
1698max() { [ "$1" -ge "$2" ] && echo "$1" || echo "$2"; }
1699
1700# Basic string matching
1701startswith() { [ "$1" != "${1#$2}" ]; }
1702endswith() { [ "$1" != "${1%$2}" ]; }
1703
1704# Convenience functions for checking shFlags flags
1705flag() { local FLAG; eval FLAG='$FLAGS_'$1; [ $FLAG -eq $FLAGS_TRUE ]; }
1706noflag() { local FLAG; eval FLAG='$FLAGS_'$1; [ $FLAG -ne $FLAGS_TRUE ]; }
1707
1708# check_boolean
1709# Check if given value can be interpreted as a boolean
1710#
1711# This function determines if the passed parameter is a valid boolean value.
1712#
1713# Param $1: string Value to check if it's a valid boolean
1714#
1715# Return: string FLAGS_TRUE|FLAGS_FALSE|FLAGS_ERROR
1716#       FLAGS_TRUE if the parameter is a boolean TRUE
1717#       FLAGS_FALSE if the parameter is a boolean FALSE
1718#       FLAGS_ERROR if the parameter is not a boolean
1719#
1720check_boolean() {
1721        local _return _value
1722        _value="${1}"
1723        case "${_value}" in
1724        ${FLAGS_TRUE} | [yY] | [yY][eE][sS] | [tT] | [tT][rR][uU][eE])
1725                _return=${FLAGS_TRUE}
1726                ;;
1727        ${FLAGS_FALSE} | [nN] | [nN][oO] | [fF] | [fF][aA][lL][sS][eE])
1728                _return=${FLAGS_FALSE}
1729                ;;
1730
1731        *)
1732                _return=${FLAGS_ERROR}
1733                ;;
1734        esac
1735        unset _value
1736        return ${_return}
1737}
1738
1739#
1740# Git specific common functionality
1741#
1742
1743git_local_branches() { git for-each-ref --format='%(refname:short)' refs/heads; }
1744git_remote_branches() { git for-each-ref --format='%(refname:short)' refs/remotes; }
1745git_all_branches() { git for-each-ref --format='%(refname:short)' refs/remotes refs/heads; }
1746git_all_tags() { git for-each-ref --format='%(refname:short)' refs/tags; }
1747
1748git_local_branches_prefixed() {
1749        [ -z $1 ] && die "Prefix parameter missing." # This should never happen.
1750        git for-each-ref --format='%(refname:short)' refs/heads/$1 ;
1751}
1752
1753git_current_branch() {
1754        local branch_name
1755
1756        branch_name="$(git symbolic-ref --quiet HEAD)"
1757        [ -z $branch_name ] && branch_name="(unnamed branch)" || branch_name="$(git for-each-ref --format='%(refname:short)' $branch_name)"
1758        echo "$branch_name"
1759}
1760
1761git_is_clean_working_tree() {
1762        git rev-parse --verify HEAD >/dev/null || exit 1
1763        git update-index -q --ignore-submodules --refresh
1764
1765        # Check for unstaged changes
1766        git diff-files --quiet --ignore-submodules || return 1
1767
1768        # Check for Uncommited changes
1769        git diff-index --cached --quiet --ignore-submodules HEAD -- || return 2
1770
1771        return 0
1772}
1773
1774git_repo_is_headless() {
1775        ! git rev-parse --quiet --verify HEAD >/dev/null 2>&1
1776}
1777
1778git_local_branch_exists() {
1779        [ -n "$1" ] || die "Missing branch name"
1780        [ -n "$(git for-each-ref --format='%(refname:short)' refs/heads/$1)" ]
1781}
1782
1783git_remote_branch_exists() {
1784        [ -n "$1" ] || die "Missing branch name"
1785        [ -n "$(git for-each-ref --format='%(refname:short)' refs/remotes/$1)" ]
1786}
1787
1788git_remote_branch_delete() {
1789        [ -n "$1" ] || die "Missing branch name"
1790        if git_remote_branch_exists "$ORIGIN/$1"; then
1791                git_do push "$ORIGIN" :"$1" || die "Could not delete the remote $1 in $ORIGIN."
1792        else
1793                warn "Trying to delete the remote branch $1, but it does not exists in $ORIGIN"
1794        fi
1795}
1796
1797git_branch_exists() {
1798        [ -n "$1" ] || die "Missing branch name"
1799        git_local_branch_exists "$1" || git_remote_branch_exists "$ORIGIN/$1"
1800}
1801
1802git_tag_exists() {
1803        [ -n "$1" ] || die "Missing tag name"
1804        [ -n "$(git for-each-ref --format='%(refname:short)' refs/tags/$1)" ]
1805}
1806
1807#
1808# git_compare_refs()
1809#
1810# Tests whether two references have diverged and need merging
1811# first. It returns error codes to provide more detail, like so:
1812#
1813# 0    References point to the same commit
1814# 1    First given reference needs fast-forwarding
1815# 2    Second given reference needs fast-forwarding
1816# 3    References need a real merge
1817# 4    There is no merge base, i.e. the references have no common ancestors
1818#
1819git_compare_refs() {
1820        local commit1 commit2 base
1821
1822        commit1=$(git rev-parse "$1"^{})
1823        commit2=$(git rev-parse "$2"^{})
1824        if [ "$commit1" != "$commit2" ]; then
1825                base=$(git merge-base "$commit1" "$commit2")
1826                if [ $? -ne 0 ]; then
1827                        return 4
1828                elif [ "$commit1" = "$base" ]; then
1829                        return 1
1830                elif [ "$commit2" = "$base" ]; then
1831                        return 2
1832                else
1833                        return 3
1834                fi
1835        else
1836                return 0
1837        fi
1838}
1839
1840#
1841# git_is_branch_merged_into()
1842#
1843# Checks whether branch $1 is successfully merged into $2
1844#
1845git_is_branch_merged_into() {
1846        local merge_hash base_hash
1847
1848        merge_hash=$(git merge-base "$1"^{} "$2"^{})
1849        base_hash=$(git rev-parse "$1"^{})
1850
1851        # If the hashes are equal, the branches are merged.
1852        [ "$merge_hash" = "$base_hash" ]
1853}
1854
1855#
1856# git_is_ancestor()
1857#
1858# This is the same function as git_is_branch_merged_into but
1859# for readability given a different name.
1860#
1861git_is_ancestor() {
1862        git_is_branch_merged_into "$1" "$2"
1863}
1864
1865#
1866# git_fetch_branch()
1867#
1868# $1 Origin - Where to fetch from
1869# $2 Branch - Which branch to fetch
1870#
1871# This fetches the given branch from the given origin.
1872# Instead of storing it in FETCH_HEAD it will be stored in
1873# refs/remotes/<origin>/<branch>
1874#
1875git_fetch_branch() {
1876        local origin branch
1877
1878        [ -n "$1" ] || die "Missing origin"
1879        [ -n "$2" ] || die "Missing branch name"
1880        origin="$1"
1881        branch="$2"
1882        git_do fetch -q "$origin" "$branch":refs/remotes/"$origin"/"$branch" || die "Could not fetch $branch from $origin."
1883}
1884
1885#
1886# gitflow specific common functionality
1887#
1888
1889# Function used to check if the repository is git-flow enabled.
1890gitflow_has_master_configured() {
1891        local master
1892
1893        master=$(git config --get gitflow.branch.master)
1894        [ "$master" != "" ] && git_local_branch_exists "$master"
1895}
1896
1897gitflow_has_develop_configured() {
1898        local develop
1899
1900        develop=$(git config --get gitflow.branch.develop)
1901        [ "$develop" != "" ] && git_local_branch_exists "$develop"
1902}
1903
1904gitflow_has_prefixes_configured() {
1905        git config --get gitflow.prefix.feature >/dev/null 2>&1     && \
1906        git config --get gitflow.prefix.release >/dev/null 2>&1     && \
1907        git config --get gitflow.prefix.hotfix >/dev/null 2>&1      && \
1908        git config --get gitflow.prefix.support >/dev/null 2>&1     && \
1909        git config --get gitflow.prefix.versiontag >/dev/null 2>&1
1910}
1911
1912gitflow_is_initialized() {
1913        gitflow_has_master_configured                    && \
1914        gitflow_has_develop_configured                   && \
1915        [ "$(git config --get gitflow.branch.master)" != "$(git config --get gitflow.branch.develop)" ] && \
1916        gitflow_has_prefixes_configured
1917}
1918
1919# Loading settings that can be overridden using git config
1920gitflow_load_settings() {
1921        export GIT_CURRENT_REPO_DIR=$(git rev-parse --show-toplevel 2>/dev/null)
1922        export DOT_GIT_DIR=$(git rev-parse --git-dir 2>/dev/null)
1923        export HOOKS_DIR=$(git config --get gitflow.path.hooks || echo "$DOT_GIT_DIR"/hooks) # the second option is used to support previous versions of git-flow
1924        export MASTER_BRANCH=$(git config --get gitflow.branch.master)
1925        export DEVELOP_BRANCH=$(git config --get gitflow.branch.develop)
1926        export ORIGIN=$(git config --get gitflow.origin || echo origin)
1927
1928        GITFLOW_CONFIG=$DOT_GIT_DIR/gitflow_config
1929        if [ -f "$GITFLOW_CONFIG" ]; then # move all settings from old .git/gitflow_config to the local conf.
1930                warn "Migrating old \"$GITFLOW_CONFIG\" to the \"--local\" repo config."
1931                _config_lines=`git config --list --file="$GITFLOW_CONFIG"`;
1932                for _config_line in ${_config_lines}; do
1933                        _key=${_config_line%=*}
1934                        _value=${_config_line#=*}
1935                        git_do config --local gitflow.${_key} ${_value}
1936                done;
1937                mv "$GITFLOW_CONFIG" "$GITFLOW_CONFIG".backup 2>/dev/null
1938        fi
1939}
1940
1941#
1942# gitflow_resolve_nameprefix
1943#
1944# Inputs:
1945# $1 = name prefix to resolve
1946# $2 = branch prefix to use
1947#
1948# Searches branch names from git_local_branches() to look for a unique
1949# branch name whose name starts with the given name prefix.
1950#
1951# There are multiple exit codes possible:
1952# 0: The unambiguous full name of the branch is written to stdout
1953#    (success)
1954# 1: No match is found.
1955# 2: Multiple matches found. These matches are written to stderr
1956#
1957gitflow_resolve_nameprefix() {
1958        local name prefix
1959        local match matches num_matches
1960
1961        name=$1
1962        prefix=$2
1963
1964        # first, check if there is a perfect match
1965        if git_local_branch_exists "$prefix$name"; then
1966                echo "$name"
1967                return 0
1968        fi
1969
1970        matches=$(echo "$(git_local_branches)" | grep "^$(escape "$prefix$name")")
1971        num_matches=$(echo "$matches" | wc -l)
1972        if [ -z "$matches" ]; then
1973                # no prefix match, so take it literally
1974                warn "No branch matches prefix '$name'"
1975                return 1
1976        else
1977                if [ $num_matches -eq 1 ]; then
1978                        echo "${matches#$prefix}"
1979                        return 0
1980                else
1981                        # multiple matches, cannot decide
1982                        warn "Multiple branches match prefix '$name':"
1983                        for match in $matches; do
1984                                warn "- $match"
1985                        done
1986                        return 2
1987                fi
1988        fi
1989}
1990
1991#
1992# Check if the given branch is a git-flow branch
1993#
1994gitflow_is_prefixed_branch() {
1995        local branch return
1996
1997        branch=$1
1998        case $branch in
1999        $(git config --get gitflow.prefix.feature)* | \
2000        $(git config --get gitflow.prefix.release)* | \
2001        $(git config --get gitflow.prefix.hotfix)*  | \
2002        $(git config --get gitflow.prefix.support)* )
2003                return=0
2004                ;;
2005        *)
2006                return=1
2007                ;;
2008        esac
2009        return $return
2010}
2011#
2012# Update the config with the base of a new git-flow branch.
2013#
2014# @param $1 Base of the new branch
2015# @param $2 Name of the branch
2016#
2017gitflow_config_set_base_branch() {
2018        local base branch
2019
2020        base=$1
2021        branch=$2
2022        $(git_do config --local "gitflow.branch.$branch.base" $base)
2023}
2024
2025#
2026# Get the base of a branch as set by gitflow_set_branch
2027#
2028# @param $1 Name of the branch
2029# @return string|empty String when a base is found otherwise empty
2030#
2031gitflow_config_get_base_branch() {
2032        local branch
2033
2034        branch=$1
2035        echo $(git config --local --get "gitflow.branch.$branch.base")
2036}
2037
2038#
2039# Remove the section that contains the base of a branch as set by gitflow_set_branch
2040#
2041# @param $1 Name of the branch
2042#
2043gitflow_config_remove_base_section() {
2044        local branch
2045
2046        branch=$1
2047        $(git_do config --local --remove-section "gitflow.branch.$branch" 2>/dev/null)
2048}
2049
2050#
2051# Remove the base of the git-flow branch from the.
2052# @param $1 Name of the branch
2053#
2054gitflow_config_remove_base_branch() {
2055        local base
2056
2057        base=$1
2058        $(git_do config --local --unset "gitflow.branch.$branch.base" 2>/dev/null)
2059}
2060
2061# gitflow_override_flag_boolean()
2062#
2063# Override a boolean flag
2064#
2065# Param $1: string The name of the config variable e.g. "feature.start.fetch"
2066# Param $2: string The flag name
2067#
2068gitflow_override_flag_boolean() {
2069        local _variable
2070
2071        _variable=$(git config --bool --get gitflow.$1 2>&1)
2072        case $? in
2073        0)
2074                [ "${_variable}" = "true" ] && eval "FLAGS_${2}=${FLAGS_TRUE}" || eval "FLAGS_${2}=${FLAGS_FALSE}"
2075                ;;
2076        128)
2077                die "${_variable}"
2078                ;;
2079        esac
2080        unset _variable
2081        return ${FLAGS_TRUE}
2082}
2083
2084# gitflow_override_flag_string()
2085#
2086# Override a string flag
2087#
2088# Param $1: string The name of the config variable e.g. "feature.start.fetch"
2089# Param $2: string The flag name
2090#
2091gitflow_override_flag_string() {
2092        local _variable
2093
2094        _variable=$(git config --get gitflow.$1 2>&1)
2095        case $? in
2096        0)
2097                eval "FLAGS_${2}=\"${_variable}\""
2098                ;;
2099        esac
2100        unset _variable
2101        return ${FLAGS_TRUE}
2102}
2103
2104# gitflow_create_squash_message()
2105#
2106# Create the squash message, overriding the one generated by git itself
2107#
2108# Param $1: string The line to be added
2109# Param $2: string The base of the branch that will me merged
2110# Param $3: string The branch that will be merged.
2111#
2112gitflow_create_squash_message() {
2113        echo Squashed commit of the following:
2114        echo
2115        echo $1
2116        echo
2117        git log --no-merges --pretty=medium ^"$2" $3
2118}
2119
2120#
2121# Parameter functions
2122#
2123gitflow_expand_nameprefix_arg_or_current() {
2124        if [ "$NAME" != "" ]; then
2125                gitflow_expand_nameprefix_arg
2126                require_branch "$PREFIX$NAME"
2127        else
2128                gitflow_use_current_branch_name
2129        fi
2130}
2131
2132gitflow_expand_nameprefix_arg() {
2133        local expanded_name exitcode
2134
2135        gitflow_require_name_arg
2136
2137        expanded_name=$(gitflow_resolve_nameprefix "$NAME" "$PREFIX")
2138        exitcode=$?
2139        case $exitcode in
2140        0)
2141                NAME=$expanded_name
2142                BRANCH=$PREFIX$NAME
2143                ;;
2144        *)
2145                exit 1
2146                ;;
2147        esac
2148}
2149
2150gitflow_require_version_arg() {
2151        if [ "$VERSION" = "" ]; then
2152                die_help "Missing argument <version>"
2153        fi
2154}
2155
2156gitflow_require_name_arg() {
2157        if [ "$NAME" = "" ]; then
2158                die_help "Missing argument <name>"
2159        fi
2160}
2161
2162gitflow_require_base_arg() {
2163        if [ "$BASE" = "" ]; then
2164                die_help "Missing argument <base>"
2165        fi
2166}
2167
2168gitflow_use_current_branch_name() {
2169        local current_branch
2170
2171        current_branch=$(git_current_branch)
2172
2173        if startswith "$current_branch" "$PREFIX"; then
2174                BRANCH=$current_branch
2175                NAME=${BRANCH#$PREFIX}
2176        else
2177                warn "The current HEAD is no feature branch."
2178                warn "Please specify a <name> argument."
2179                exit 1
2180        fi
2181}
2182#
2183# Assertions for use in git-flow subcommands
2184#
2185
2186require_git_repo() {
2187        git rev-parse 2>/dev/null || die "Not a git repository"
2188}
2189
2190require_gitflow_initialized() {
2191        gitflow_is_initialized || die "Not a gitflow-enabled repo yet. Please run 'git flow init' first."
2192}
2193
2194require_clean_working_tree() {
2195        local result
2196
2197        git_is_clean_working_tree
2198        result=$?
2199        if [ $result -eq 1 ]; then
2200                die "Working tree contains unstaged changes. Aborting."
2201        fi
2202        if [ $result -eq 2 ]; then
2203                die "Index contains uncommited changes. Aborting."
2204        fi
2205}
2206
2207require_base_is_local_branch() {
2208        git_local_branch_exists "$1" || die "Base '$1' needs to be a branch. It does not exist and is required."
2209}
2210
2211require_local_branch() {
2212        git_local_branch_exists "$1" || die "Local branch '$1' does not exist and is required."
2213}
2214
2215require_remote_branch() {
2216        git_remote_branch_exists "$1" || die "Remote branch '$1' does not exist and is required."
2217}
2218
2219require_branch() {
2220        git_branch_exists "$1" || die "Branch '$1' does not exist and is required."
2221}
2222
2223require_branch_absent() {
2224        git_branch_exists "$1" && die "Branch '$1' already exists. Pick another name."
2225}
2226
2227require_local_branch_absent() {
2228        git_local_branch_exists "$1" && die "Branch '$1' already exists. Pick another name."
2229}
2230
2231require_tag_absent() {
2232        git_tag_exists "$1" && die "Tag '$1' already exists. Pick another name."
2233}
2234
2235require_branches_equal() {
2236        local compare_refs_result
2237
2238        require_local_branch "$1"
2239        require_remote_branch "$2"
2240        git_compare_refs "$1" "$2"
2241        compare_refs_result=$?
2242
2243        if [ $compare_refs_result -gt 0 ]; then
2244                warn "Branches '$1' and '$2' have diverged."
2245                if [ $compare_refs_result -eq 1 ]; then
2246                        die "And branch '$1' may be fast-forwarded."
2247                elif [ $compare_refs_result -eq 2 ]; then
2248                        # Warn here, since there is no harm in being ahead
2249                        warn "And local branch '$1' is ahead of '$2'."
2250                else
2251                        die "Branches need merging first."
2252                fi
2253        fi
2254}
2255
2256#
2257# Show commands if flag is set.
2258#
2259git_do() {
2260        if flag showcommands; then
2261                echo "git $@" >&2
2262        fi
2263
2264        git "$@"
2265}
2266
2267#
2268# run_filter_hook
2269#
2270# Looks for a Git hook script called as defined by the first variable
2271#
2272#     filter-flow-command
2273#
2274# If such a hook script exists and is executable, it is called with the given
2275# positional arguments.
2276#
2277run_filter_hook() {
2278        local command scriptfile return
2279
2280        command=$1
2281        shift
2282        scriptfile="${HOOKS_DIR}/filter-flow-${command}"
2283        if [ -x $scriptfile ]; then
2284                return=`$scriptfile "$@"`
2285                if [ $? -eq 127 ]; then
2286                        echo "$return"
2287                        exit 127
2288                fi
2289                        echo $return
2290        else
2291                echo "$@"
2292        fi
2293}
2294
2295#
2296# run_pre_hook
2297#
2298# Looks for a Git hook script called
2299#
2300#     pre-flow-<subcmd>-<subaction>
2301#
2302# If such a hook script exists and is executable, it is called with the given
2303# positional arguments.  If its return code non-zero, the git-flow action is
2304# aborted.
2305#
2306run_pre_hook() {
2307        local scriptfile exitcode
2308
2309        scriptfile="${HOOKS_DIR}/pre-flow-${SUBCOMMAND}-${SUBACTION}"
2310        exitcode=0
2311        if [ -x $scriptfile ]; then
2312                $scriptfile "$@"
2313                exitcode=$?
2314
2315                if [ $exitcode -gt 0 ]; then
2316                        die "Hook command $scriptfile ended with exit code $exitcode."
2317                fi
2318        fi
2319}
2320
2321#
2322# run_post_hook
2323#
2324# Looks for a Git hook script called
2325#
2326#     post-flow-<subcmd>-<subaction>
2327#
2328# If such a hook script exists and is executable, it is called with the given
2329# positional arguments.  Its return code is ignored.
2330#
2331run_post_hook() {
2332        local scriptfile
2333
2334        scriptfile="${HOOKS_DIR}/post-flow-${SUBCOMMAND}-${SUBACTION}"
2335        if [ -x $scriptfile ]; then
2336                $scriptfile "$@"
2337        fi
2338}
2339
2340flags_help() {
2341        eval "$( echo "$OPTIONS_SPEC" | git rev-parse --parseopt -- "-h" || echo exit $? )"
2342}
2343+ DEFINE_boolean showcommands false 'Show actions taken (git commands)'
2344+ _flags_define 1 showcommands false 'Show actions taken (git commands)'
2345+ '[' 4 -lt 4 ']'
2346+ _flags_type_=1
2347+ _flags_name_=showcommands
2348+ _flags_default_=false
2349+ _flags_help_='Show actions taken (git commands)'
2350+ _flags_short_='~'
2351+ _flags_return_=0
2352_flags_removeExclamationName ${_flags_name_}
2353++ _flags_removeExclamationName showcommands
2354++ _flags_opt_=showcommands
2355++ _flags_isNegate showcommands
2356++ case $1 in
2357++ flags_return=0
2358++ return 0
2359++ echo showcommands
2360++ unset _flags_opt_
2361++ return 0
2362+ _flags_usName_=showcommands
2363_flags_underscoreName ${_flags_usName_}
2364++ _flags_underscoreName showcommands
2365++ echo showcommands
2366++ tr - _
2367+ _flags_usName_=showcommands
2368+ _flags_itemInList showcommands ' ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE  VERSION '
2369+ _flags_str_=showcommands
2370+ shift
2371+ _flags_list_='  ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE  VERSION  '
2372+ case ${_flags_list_} in
2373+ flags_return=1
2374+ unset _flags_str_ _flags_list_
2375+ return 1
2376+ '[' 1 -eq 0 ']'
2377+ '[' 0 -eq 0 -a 1 -ne 1 -a '~' = '~' ']'
2378+ '[' 0 -eq 0 ']'
2379+ _flags_itemInList showcommands
2380+ _flags_str_=showcommands
2381+ shift
2382+ _flags_list_='  '
2383+ case ${_flags_list_} in
2384+ flags_return=1
2385+ unset _flags_str_ _flags_list_
2386+ return 1
2387+ '[' 0 -eq 0 -a '~' '!=' '~' ']'
2388+ '[' 0 -eq 0 ']'
2389+ case ${_flags_type_} in
2390+ _flags_validBool false
2391+ _flags_bool_=false
2392+ flags_return=0
2393+ case "${_flags_bool_}" in
2394+ unset _flags_bool_
2395+ return 0
2396+ case ${_flags_default_} in
2397+ _flags_default_=1
2398+ _flags_isNegate showcommands
2399+ case $1 in
2400+ flags_return=0
2401+ return 0
2402+ _flags_isNegate_=0
2403+ '[' 0 -eq 0 ']'
2404+ eval 'FLAGS_showcommands='\''1'\'''
2405FLAGS_showcommands='1'
2406++ FLAGS_showcommands=1
2407+ eval __flags_showcommands_type=1
2408__flags_showcommands_type=1
2409++ __flags_showcommands_type=1
2410+ eval '__flags_showcommands_default="1"'
2411__flags_showcommands_default="1"
2412++ __flags_showcommands_default=1
2413+ eval '__flags_showcommands_help="Show actions taken (git commands)"'
2414__flags_showcommands_help="Show actions taken (git commands)"
2415++ __flags_showcommands_help='Show actions taken (git commands)'
2416+ eval '__flags_showcommands_short='\''~'\'''
2417__flags_showcommands_short='~'
2418++ __flags_showcommands_short='~'
2419+ __flags_shortNames=' ~ '
2420_flags_removeExclamationName ${_flags_name_}
2421++ _flags_removeExclamationName showcommands
2422++ _flags_opt_=showcommands
2423++ _flags_isNegate showcommands
2424++ case $1 in
2425++ flags_return=0
2426++ return 0
2427++ echo showcommands
2428++ unset _flags_opt_
2429++ return 0
2430+ __flags_longNames=' showcommands '
2431+ '[' 1 -eq 1 -a 0 -eq 0 ']'
2432+ __flags_boolNames=' noshowcommands '
2433+ __flags_definedNames=' showcommands '
2434+ '[' 1 -eq 1 ']'
2435+ '[' 0 -eq 0 ']'
2436+ __flags_definedNames=' showcommands noshowcommands '
2437+ __flags_definedNames=' showcommands noshowcommands showcommands '
2438+ '[' 1 -eq 1 ']'
2439+ '[' 0 -eq 1 ']'
2440+ flags_return=0
2441+ unset _flags_default_ _flags_help_ _flags_name_ _flags_return_ _flags_short_ _flags_type_ _flags_usName_
2442+ '[' 0 -eq 2 ']'
2443+ return 0
2444+ gitflow_override_flag_boolean showcommands showcommands
2445+ local _variable
2446git config --bool --get gitflow.$1 2>&1
2447++ git config --bool --get gitflow.showcommands
2448+ _variable=
2449+ case $? in
2450+ unset _variable
2451+ return 0
2452+ SUBCOMMAND=feature
2453+ shift
2454+ '[' feature = finish ']'
2455+ '[' feature = delete ']'
2456+ '[' feature = publish ']'
2457+ '[' '!' -e /opt/local/bin/git-flow-feature ']'
2458+ . /opt/local/bin/git-flow-feature
2459#
2460# git-flow -- A collection of Git extensions to provide high-level
2461# repository operations for Vincent Driessen's branching model.
2462#
2463# A blog post presenting this model is found at:
2464#    http://blog.avirtualhome.com/development-workflow-using-git/
2465#
2466# Feel free to contribute to this project at:
2467#    http://github.com/petervanderdoes/gitflow
2468#
2469# Authors:
2470# Copyright 2012,2013 Peter van der Does. All rights reserved.
2471#
2472# Original Author:
2473# Copyright 2010 Vincent Driessen. All rights reserved.
2474#
2475# Redistribution and use in source and binary forms, with or without
2476# modification, are permitted provided that the following conditions are met:
2477#
2478# 1. Redistributions of source code must retain the above copyright notice, this
2479#    list of conditions and the following disclaimer.
2480# 2. Redistributions in binary form must reproduce the above copyright notice,
2481#    this list of conditions and the following disclaimer in the documentation
2482#    and/or other materials provided with the distribution.
2483#
2484# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
2485# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
2486# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
2487# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
2488# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
2489# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
2490# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
2491# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
2492# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
2493# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2494#
2495
2496initialize() {
2497        require_git_repo
2498        require_gitflow_initialized
2499        gitflow_load_settings
2500        PREFIX=$(git config --get gitflow.prefix.feature)
2501
2502}
2503
2504usage() {
2505        OPTIONS_SPEC="\
2506git flow feature [list]
2507git flow feature start
2508git flow feature finish
2509git flow feature publish
2510git flow feature track
2511git flow feature diff
2512git flow feature rebase
2513git flow feature checkout
2514git flow feature pull
2515git flow feature delete
2516
2517Manage your feature branches.
2518
2519For more specific help type the command followed by --help
2520--
2521"
2522        flags_help
2523}
2524
2525cmd_default() {
2526        cmd_list "$@"
2527}
2528
2529cmd_list() {
2530        OPTIONS_SPEC="\
2531git flow feature [list] [-h] [-v]
2532
2533Lists all the existing feature branches in the local repository.
2534--
2535h,help!     Show this help
2536v,verbose   Verbose (more) output
2537"
2538        local feature_branches current_branch width branch len
2539        local base develop_sha branch_sha
2540
2541        # Define flags
2542        DEFINE_boolean 'verbose' false 'verbose (more) output' v
2543
2544        # Parse argun=ments
2545        parse_args "$@"
2546
2547        feature_branches=$(git_local_branches_prefixed "$PREFIX")
2548        if [ -z "$feature_branches" ]; then
2549                warn "No feature branches exist."
2550                warn ""
2551                warn "You can start a new feature branch:"
2552                warn ""
2553                warn "    git flow feature start <name> [<base>]"
2554                warn ""
2555                exit 0
2556        fi
2557        current_branch=$(git_current_branch)
2558
2559        # Determine column width first
2560        width=0
2561        for branch in $feature_branches; do
2562                len=${#branch}
2563                width=$(max $width $len)
2564        done
2565        width=$(($width+3-${#PREFIX}))
2566
2567        for branch in $feature_branches; do
2568                base=$(git merge-base "$branch" "$DEVELOP_BRANCH")
2569                develop_sha=$(git rev-parse "$DEVELOP_BRANCH")
2570                branch_sha=$(git rev-parse "$branch")
2571                if [ "$branch" = "$current_branch" ]; then
2572                        printf "* "
2573                else
2574                        printf "  "
2575                fi
2576                if flag verbose; then
2577                        printf "%-${width}s" "${branch#$PREFIX}"
2578                        if [ "$branch_sha" = "$develop_sha" ]; then
2579                                printf "(no commits yet)"
2580                        elif [ "$base" = "$branch_sha" ]; then
2581                                printf "(is behind develop, may ff)"
2582                        elif [ "$base" = "$develop_sha" ]; then
2583                                printf "(based on latest develop)"
2584                        else
2585                                printf "(may be rebased)"
2586                        fi
2587                else
2588                        printf "%s" "${branch#$PREFIX}"
2589                fi
2590                echo
2591        done
2592}
2593
2594cmd_help() {
2595        usage
2596        exit 0
2597}
2598
2599name_or_current() {
2600        if [ -z "$NAME" ]; then
2601                use_current_feature_branch_name
2602        fi
2603}
2604
2605# Parse arguments and set common variables
2606parse_args() {
2607        FLAGS "$@" || exit $?
2608        eval set -- "${FLAGS_ARGV}"
2609
2610        # read arguments into global variables
2611        NAME=$1
2612        BRANCH=$PREFIX$NAME
2613}
2614
2615parse_remote_name() {
2616        # Parse arguments
2617        FLAGS "$@" || exit $?
2618        eval set -- "${FLAGS_ARGV}"
2619
2620        # read arguments into global variables
2621        REMOTE=$1
2622        NAME=$2
2623        BRANCH=$PREFIX$NAME
2624}
2625
2626cmd_start() {
2627        OPTIONS_SPEC="\
2628git flow feature start [-h] [-F] <name> [<base>]
2629
2630Start new feature <name>, optionally basing it on <base> instead of <develop>
2631--
2632h,help!          Show this help
2633showcommands!    Show git commands while executing them
2634F,[no]fetch      Fetch from origin before performing local operation
2635"
2636        local base
2637
2638        # Define flags
2639        DEFINE_boolean 'fetch' false 'fetch from origin before performing local operation' F
2640
2641        # Override defaults with values from config
2642        gitflow_override_flag_boolean   "feature.start.fetch"   "fetch"
2643
2644        # Parse arguments
2645        parse_args "$@"
2646        eval set -- "${FLAGS_ARGV}"
2647        base=${2:-$DEVELOP_BRANCH}
2648
2649        require_base_is_local_branch "$base"
2650        gitflow_require_name_arg
2651        gitflow_config_set_base_branch $base $BRANCH
2652
2653        # Update the local repo with remote changes, if asked
2654        if flag fetch; then
2655                git_fetch_branch "$ORIGIN" "$base"
2656        fi
2657
2658        # Sanity checks
2659        require_branch_absent "$BRANCH"
2660
2661        # If the origin branch counterpart exists, assert that the local branch
2662        # isn't behind it (to avoid unnecessary rebasing)
2663        if git_remote_branch_exists "$ORIGIN/$base"; then
2664                require_branches_equal "$base" "$ORIGIN/$base"
2665        fi
2666
2667        run_pre_hook "$NAME" "$ORIGIN" "$BRANCH" "$base"
2668
2669
2670        # create branch
2671        git_do checkout -b "$BRANCH" "$base" || die "Could not create feature branch '$BRANCH'."
2672
2673        run_post_hook "$NAME" "$ORIGIN" "$BRANCH" "$base"
2674
2675        echo
2676        echo "Summary of actions:"
2677        echo "- A new branch '$BRANCH' was created, based on '$base'"
2678        echo "- You are now on branch '$(git_current_branch)'"
2679        echo ""
2680        echo "Now, start committing on your feature. When done, use:"
2681        echo ""
2682        echo "     git flow feature finish $NAME"
2683        echo
2684}
2685
2686cmd_finish() {
2687        OPTIONS_SPEC="\
2688git flow feature finish [-h] [-F] [-r] [-p] [-k] [-D] [-S] [--no-ff] <name|nameprefix>
2689
2690Finish feature <name>
2691--
2692h,help!                Show this help
2693showcommands!          Show git commands while executing them
2694F,[no]fetch            Fetch from origin before performing finish
2695r,[no]rebase           Rebase before merging
2696p,[no]preserve-merges  Preserve merges while rebasing
2697k,[no]keep             Keep branch after performing finish
2698keepremote!                Keep the remote branch
2699keeplocal!             Keep the local branch
2700D,[no]force_delete     Force delete feature branch after finish
2701S,[no]squash           Squash feature during merge
2702no-ff!                 Never fast-forward during the merge
2703"
2704        local finish_base
2705
2706        # Define flags
2707        DEFINE_boolean 'fetch' false "fetch from $ORIGIN before performing finish" F
2708        DEFINE_boolean 'rebase' false "rebase before merging" r
2709        DEFINE_boolean 'preserve-merges' false 'try to recreate merges while rebasing' p
2710        DEFINE_boolean 'keep' false "keep branch after performing finish" k
2711        DEFINE_boolean 'keepremote' false "keep the remote branch"
2712        DEFINE_boolean 'keeplocal' false "keep the local branch"
2713        DEFINE_boolean 'force_delete' false "force delete feature branch after finish" D
2714        DEFINE_boolean 'squash' false "squash feature during merge" S
2715        DEFINE_boolean 'squash-info' false "add branch info during squash"
2716        DEFINE_boolean 'no-ff!' false "Don't fast-forward ever during merge "
2717
2718        # Override defaults with values from config
2719        gitflow_override_flag_boolean   "feature.finish.fetch"             "fetch"
2720        gitflow_override_flag_boolean   "feature.finish.rebase"            "rebase"
2721        gitflow_override_flag_boolean   "feature.finish.preserve-merges"   "preserve_merges"
2722        gitflow_override_flag_boolean   "feature.finish.keep"              "keep"
2723        gitflow_override_flag_boolean   "feature.finish.keepremote"        "keepremote"
2724        gitflow_override_flag_boolean   "feature.finish.keeplocal"         "keeplocal"
2725        gitflow_override_flag_boolean   "feature.finish.force-delete"      "force_delete"
2726        gitflow_override_flag_boolean   "feature.finish.squash"            "squash"
2727        gitflow_override_flag_boolean   "feature.finish.squash-info"       "squash_info"
2728        gitflow_override_flag_boolean   "feature.finish.no-ff"             "no_ff"
2729
2730        # Parse arguments
2731        parse_args "$@"
2732
2733        gitflow_expand_nameprefix_arg_or_current
2734
2735        # Keeping both branches implies the --keep flag to be true.
2736        if flag keepremote && flag keeplocal; then
2737                FLAGS_keep=$FLAGS_TRUE
2738        fi
2739
2740        # Sanity checks
2741        require_branch "$BRANCH"
2742
2743        BASE_BRANCH=$(gitflow_config_get_base_branch $BRANCH)
2744        BASE_BRANCH=${BASE_BRANCH:-$DEVELOP_BRANCH}
2745        git_local_branch_exists "$BASE_BRANCH" || die "The base '$BASE_BRANCH' doesn't exists locally or is not a branch. Can't finish the feature branch '$BRANCH'."
2746
2747        # Detect if we're restoring from a merge conflict
2748        if [ -f "$DOT_GIT_DIR/.gitflow/MERGE_BASE" ]; then
2749                #
2750                # TODO: detect that we're working on the correct branch here!
2751                # The user need not necessarily have given the same $NAME twice here
2752                # (although he/she should).
2753                #
2754
2755                # TODO: git_is_clean_working_tree() should provide an alternative
2756                # exit code for "unmerged changes in working tree", which we should
2757                # actually be testing for here
2758                if git_is_clean_working_tree; then
2759                        finish_base=$(cat "$DOT_GIT_DIR/.gitflow/MERGE_BASE")
2760
2761                        # Since the working tree is now clean, either the user did a
2762                        # successful merge manually, or the merge was cancelled.
2763                        # We detect this using git_is_branch_merged_into()
2764                        if git_is_branch_merged_into "$BRANCH" "$finish_base"; then
2765                                rm -f "$DOT_GIT_DIR/.gitflow/MERGE_BASE"
2766                                helper_finish_cleanup
2767                                exit 0
2768                        else
2769                                # If the user cancelled the merge and decided to wait until
2770                                # later,that's fine. But we have to acknowledge this by
2771                                # removing the MERGE_BASE file and continuing normal execution
2772                                # of the finish
2773                                rm -f "$DOT_GIT_DIR/.gitflow/MERGE_BASE"
2774                        fi
2775                else
2776                        echo
2777                        echo "Merge conflicts not resolved yet, use:"
2778                        echo "    git mergetool"
2779                        echo "    git commit"
2780                        echo
2781                        echo "You can then complete the finish by running it again:"
2782                        echo "    git flow feature finish $NAME"
2783                        echo
2784                        exit 1
2785                fi
2786        fi
2787
2788        # Sanity checks
2789        require_clean_working_tree
2790
2791        # We always fetch the Branch from Origin
2792        # This is done to avoid possible commits on the remote that are not
2793        # merged into the local branch
2794        if git_remote_branch_exists "$ORIGIN/$BRANCH"; then
2795                git_fetch_branch "$ORIGIN" "$BRANCH"
2796        fi
2797
2798        # Update local branches with remote branches
2799        if flag fetch; then
2800                git_fetch_branch "$ORIGIN" "$BASE_BRANCH"
2801        fi
2802
2803        # Check if the local branches have all the commits from the remote branches
2804        if git_remote_branch_exists "$ORIGIN/$BRANCH"; then
2805                        require_branches_equal "$BRANCH" "$ORIGIN/$BRANCH"
2806        fi
2807        if git_remote_branch_exists "$ORIGIN/$BASE_BRANCH"; then
2808                require_branches_equal "$BASE_BRANCH" "$ORIGIN/$BASE_BRANCH"
2809        fi
2810
2811        run_pre_hook "$NAME" "$ORIGIN" "$BRANCH"
2812
2813        # If the user wants to rebase, do that first
2814        if flag rebase; then
2815        local _rebase_opts=""
2816        if flag preserve_merges; then
2817            _rebase_opts="$_rebase_opts -p"
2818        fi
2819        if flag showcommands; then
2820            _rebase_opts="$_rebase_opts --showcommands"
2821        fi
2822                if ! git flow feature rebase $_rebase_opts "$NAME"; then
2823                        warn "Finish was aborted due to conflicts during rebase."
2824                        warn "Please finish the rebase manually now."
2825                        warn "When finished, re-run:"
2826                        warn "    git flow feature finish '$NAME' '$BASE_BRANCH'"
2827                        exit 1
2828                fi
2829        fi
2830
2831        # Merge into BASE
2832        git_do checkout "$BASE_BRANCH" || die "Could not check out branch '$BASE_BRANCH'."
2833
2834        if noflag squash; then
2835                if flag no_ff; then
2836                        git_do merge --no-ff "$BRANCH"
2837                else
2838                        if [ "$(git rev-list -n2 "$BASE_BRANCH..$BRANCH" | wc -l)" -eq 1 ]; then
2839                                git_do merge --ff "$BRANCH"
2840                        else
2841                                git_do merge --no-ff "$BRANCH"
2842                        fi
2843                fi
2844        else
2845                git_do merge --squash "$BRANCH"
2846                flag squash_info && gitflow_create_squash_message "Merged feature branch '$BRANCH'" "$BASE_BRANCH" "$BRANCH" > "$DOT_GIT_DIR/SQUASH_MSG"
2847                git_do commit
2848        fi
2849
2850        if [ $? -ne 0 ]; then
2851                # Oops.. we have a merge conflict!
2852                # Write the given $BASE_BRANCH to a temporary file as we will
2853                # be needing it later.
2854                mkdir -p "$DOT_GIT_DIR/.gitflow"
2855                echo "$BASE_BRANCH" > "$DOT_GIT_DIR/.gitflow/MERGE_BASE"
2856                echo
2857                echo "There were merge conflicts. To resolve the merge conflict manually, use:"
2858                echo "    git mergetool"
2859                echo "    git commit"
2860                echo
2861                echo "You can then complete the finish by running it again:"
2862                echo "    git flow feature finish $NAME"
2863                echo
2864                exit 1
2865        fi
2866
2867        run_post_hook "$NAME" "$ORIGIN" "$BRANCH"
2868
2869        # When no merge conflict is detected, just clean up the feature branch
2870        gitflow_config_remove_base_branch "$BRANCH"
2871        helper_finish_cleanup
2872}
2873
2874helper_finish_cleanup() {
2875        local keepmsg remotebranchdeleted localbranchdeleted
2876
2877        # Sanity checks
2878        require_branch "$BRANCH"
2879        require_clean_working_tree
2880
2881        remotebranchdeleted=$FLAGS_FALSE
2882        localbranchdeleted=$FLAGS_FALSE
2883
2884        if noflag keep; then
2885
2886                # Always delete remote first
2887                if noflag keepremote;then
2888                        if git_remote_branch_exists "$ORIGIN/$BRANCH"; then
2889                                git_remote_branch_delete "$BRANCH" && remotebranchdeleted=$FLAGS_TRUE
2890                        fi
2891                fi
2892
2893                # Delete local after remote to avoid warnings
2894                if noflag keeplocal; then
2895                        if [ "$BRANCH" = "$(git_current_branch)" ]; then
2896                                git_do checkout "$BASE_BRANCH" || die "Could not check out branch '$BASE_BRANCH'."
2897                        fi
2898                        if flag force_delete; then
2899                                git_do branch -D "$BRANCH" && localbranchdeleted=$FLAGS_TRUE
2900                        else
2901                                if noflag squash; then
2902                                        git_do branch -d "$BRANCH" && localbranchdeleted=$FLAGS_TRUE
2903                                else
2904                                        git_do branch -D "$BRANCH" && localbranchdeleted=$FLAGS_TRUE
2905                                fi
2906                        fi
2907                fi
2908
2909                # no more branches: we can safely remove config section
2910                if ! git_remote_branch_exists "$ORIGIN/$BRANCH" -a ! git_local_branch_exists "$BRANCH"; then
2911                        gitflow_config_remove_base_section "$BRANCH"
2912                fi
2913        fi
2914
2915        echo
2916        echo "Summary of actions:"
2917        echo "- The feature branch '$BRANCH' was merged into '$BASE_BRANCH'"
2918        #echo "- Merge conflicts were resolved"         # TODO: Add this line when it's supported
2919        if noflag keep; then
2920                if [ $localbranchdeleted -eq $FLAGS_TRUE ]; then
2921                        keepmsg="has been locally deleted"
2922                else
2923                        keepmsg="is still locally available"
2924                fi
2925                if [ $remotebranchdeleted -eq $FLAGS_TRUE ]; then
2926                        keepmsg=$keepmsg"; it has been remotely deleted from '$ORIGIN'"
2927                elif git_remote_branch_exists "$ORIGIN/$BRANCH"; then
2928                        keepmsg=$keepmsg"; it is still remotely available on '$ORIGIN'"
2929                fi
2930        else
2931                keepmsg="is still locally available"
2932                if git_remote_branch_exists "$ORIGIN/$BRANCH"; then
2933                        keepmsg=$keepmsg"; it is still remotely available on '$ORIGIN'"
2934                fi
2935        fi
2936        echo "- Feature branch '$BRANCH' "$keepmsg
2937        echo "- You are now on branch '$(git_current_branch)'"
2938        echo
2939}
2940
2941cmd_publish() {
2942        OPTIONS_SPEC="\
2943git flow feature publish [-h] [<name>]
2944
2945Publish feature branch <name> on $ORIGIN.
2946When <name> is omitted the current branch is used, but only if it's a feature branch.
2947--
2948h,help!          Show this help
2949showcommands!    Show git commands while executing them
2950"
2951        # Parse arguments
2952        parse_args "$@"
2953
2954        gitflow_expand_nameprefix_arg_or_current
2955
2956        # Sanity checks
2957        require_clean_working_tree
2958        require_branch "$BRANCH"
2959        git_do fetch -q "$ORIGIN" || die "Could not fetch branch '$BRANCH' from remote '$ORIGIN'."
2960        require_branch_absent "$ORIGIN/$BRANCH"
2961
2962        run_pre_hook "$NAME" "$ORIGIN" "$BRANCH"
2963
2964        # Create remote branch
2965        git_do push "$ORIGIN" "$BRANCH:refs/heads/$BRANCH"
2966        git_do fetch -q "$ORIGIN" || die "Could not fetch branch '$BRANCH' from remote '$ORIGIN'."
2967
2968        # Configure remote tracking
2969        git_do config "branch.$BRANCH.remote" "$ORIGIN"
2970        git_do config "branch.$BRANCH.merge" "refs/heads/$BRANCH"
2971        git_do checkout "$BRANCH" || die "Could not check out branch '$BRANCH'."
2972
2973        run_post_hook "$NAME" "$ORIGIN" "$BRANCH"
2974
2975        echo
2976        echo "Summary of actions:"
2977        echo "- A new remote branch '$BRANCH' was created"
2978        echo "- The local branch '$BRANCH' was configured to track the remote branch"
2979        echo "- You are now on branch '$(git_current_branch)'"
2980        echo
2981}
2982
2983cmd_track() {
2984        OPTIONS_SPEC="\
2985git flow feature track [-h] <name>
2986
2987Start tracking feature <name> that is shared on $ORIGIN
2988--
2989h,help!          Show this help
2990showcommands!    Show git commands while executing them
2991"
2992        # Parse arguments
2993        parse_args "$@"
2994
2995        gitflow_require_name_arg
2996
2997        # Sanity checks
2998        require_clean_working_tree
2999        require_local_branch_absent "$BRANCH"
3000
3001        run_pre_hook "$NAME" "$ORIGIN" "$BRANCH"
3002
3003        git_do fetch -q "$ORIGIN" || die "Could not fetch branch '$BRANCH' from remote '$ORIGIN'."
3004        git_remote_branch_exists "$ORIGIN/$BRANCH"
3005
3006        # Create tracking branch
3007        git_do checkout -b "$BRANCH" "$ORIGIN/$BRANCH" || die "Could not create '$BRANCH'."
3008
3009        run_post_hook "$NAME" "$ORIGIN" "$BRANCH"
3010
3011        echo
3012        echo "Summary of actions:"
3013        echo "- A new remote tracking branch '$BRANCH' was created"
3014        echo "- You are now on branch '$(git_current_branch)'"
3015        echo
3016}
3017
3018cmd_diff() {
3019        OPTIONS_SPEC="\
3020git flow feature diff [-h] [<name|nameprefix>]
3021
3022Show all changes in <name> that are not in <develop>
3023--
3024h,help!          Show this help
3025showcommands!    Show git commands while executing them
3026"
3027        local base
3028
3029        # Parse arguments
3030        parse_args "$@"
3031
3032        if [ "$NAME" != "" ]; then
3033                gitflow_expand_nameprefix_arg
3034                base=$(git merge-base "$DEVELOP_BRANCH" "$BRANCH")
3035                git_do diff "$base..$BRANCH"
3036        else
3037                if ! git_current_branch | grep -q "^$PREFIX"; then
3038                        die "Not on a feature branch. Name one explicitly."
3039                fi
3040
3041                base=$(git merge-base "$DEVELOP_BRANCH" HEAD)
3042                git_do diff "$base"
3043        fi
3044}
3045
3046cmd_checkout() {
3047        OPTIONS_SPEC="\
3048git flow feature checkout [-h] [<name|nameprefix>]
3049
3050Switch to feature branch <name>
3051--
3052h,help!          Show this help
3053showcommands!    Show git commands while executing them
3054"
3055        # Parse arguments
3056        parse_args "$@"
3057
3058        if [ "$NAME" != "" ]; then
3059                gitflow_expand_nameprefix_arg
3060                git_do checkout "$BRANCH"  || die "Could not check out branch '$BRANCH'."
3061        else
3062                die "Name a feature branch explicitly."
3063        fi
3064}
3065
3066cmd_co() {
3067        # Alias for checkout
3068        cmd_checkout "$@"
3069}
3070
3071cmd_rebase() {
3072        OPTIONS_SPEC="\
3073git flow feature rebase [-h] [-i] [-p] [<name|nameprefix>]
3074
3075Rebase <name> on <base_branch>
3076--
3077h,help!                Show this help
3078showcommands!          Show git commands while executing them
3079i,[no]interactive      Do an interactive rebase
3080p,[no]preserve-merges  Preserve merges
3081"
3082        local opts
3083
3084        # Define flags
3085        DEFINE_boolean 'interactive' false 'do an interactive rebase' i
3086        DEFINE_boolean 'preserve-merges' false 'try to recreate merges' p
3087
3088        # Override defaults with values from config
3089        gitflow_override_flag_boolean   "feature.rebase.interactive"       "interactive"
3090        gitflow_override_flag_boolean   "feature.rebase.preserve-merges"   "preserve_merges"
3091
3092        # Parse arguments
3093        parse_args "$@"
3094
3095        gitflow_expand_nameprefix_arg_or_current 'feature'
3096
3097        BASE_BRANCH=$(gitflow_config_get_base_branch $BRANCH)
3098        BASE_BRANCH=${BASE_BRANCH:-$DEVELOP_BRANCH}
3099
3100        warn "Will try to rebase '$NAME' which is based on '$BASE_BRANCH'..."
3101        require_clean_working_tree
3102        require_branch "$BRANCH"
3103
3104    git_local_branch_exists "$BASE_BRANCH" || die "The base '$BASE_BRANCH' doesn't exists locally or is not a branch. Can't finish the feature branch '$BRANCH'."
3105
3106        git_do checkout -q "$BRANCH"  || die "Could not check out branch '$BRANCH'."
3107        if flag interactive; then
3108                opts="$opts -i"
3109        fi
3110        if flag preserve_merges; then
3111                opts="$opts -p"
3112        fi
3113        git_do rebase $opts "$BASE_BRANCH"
3114}
3115
3116avoid_accidental_cross_branch_action() {
3117        local current_branch
3118
3119        current_branch=$(git_current_branch)
3120        if [ "$BRANCH" != "$current_branch" ]; then
3121                warn "Trying to pull from '$BRANCH' while currently on branch '$current_branch'."
3122                warn "To avoid unintended merges, git-flow aborted."
3123                return 1
3124        fi
3125        return 0
3126}
3127
3128cmd_pull() {
3129        OPTIONS_SPEC="\
3130git flow feature pull [-h] <remote> [<name>]
3131
3132Pull feature <name> from <remote>
3133--
3134h,help!          Show this help
3135showcommands!    Show git commands while executing them
3136"
3137        local current_branch
3138
3139        # Define flags
3140        DEFINE_boolean 'rebase' false "pull with rebase" r
3141
3142        # Parse arguments
3143        parse_remote_name "$@"
3144
3145        if [ -z "$REMOTE" ]; then
3146                die "Name a remote explicitly."
3147        fi
3148        name_or_current
3149
3150        # To avoid accidentally merging different feature branches into each other,
3151        # die if the current feature branch differs from the requested $NAME
3152        # argument.
3153        current_branch=$(git_current_branch)
3154        if startswith "$current_branch" "$PREFIX"; then
3155                # We are on a local feature branch already, so $BRANCH must be equal to
3156                # the current branch
3157                avoid_accidental_cross_branch_action || die
3158        fi
3159
3160        require_clean_working_tree
3161
3162        run_pre_hook "$NAME" "$REMOTE" "$BRANCH"
3163
3164        if git_local_branch_exists "$BRANCH"; then
3165                # Again, avoid accidental merges
3166                avoid_accidental_cross_branch_action || die
3167
3168                # We already have a local branch called like this, so simply pull the
3169                # remote changes in
3170                if flag rebase; then
3171                        if ! git_do pull --rebase -q "$REMOTE" "$BRANCH"; then
3172                                warn "Pull was aborted. There might be conflicts during rebase or '$REMOTE' might be inaccessible."
3173                                exit 1
3174                        fi
3175                else
3176                        git_do pull -q "$REMOTE" "$BRANCH" || die "Failed to pull from remote '$REMOTE'."
3177                fi
3178
3179                echo "Pulled $REMOTE's changes into $BRANCH."
3180        else
3181                # Setup the local branch clone for the first time
3182                git_do fetch -q "$REMOTE" "$BRANCH" ||  die "Could not fetch branch '$BRANCH' from remote '$REMOTE'."     # Stores in FETCH_HEAD
3183                git_do branch --no-track "$BRANCH" FETCH_HEAD || die "Branch failed."
3184                git_do checkout -q "$BRANCH" || die "Could not check out branch '$BRANCH'."
3185                echo "Created local branch $BRANCH based on $REMOTE's $BRANCH."
3186        fi
3187
3188        run_post_hook "$NAME" "$REMOTE" "$BRANCH"
3189}
3190
3191cmd_delete() {
3192        OPTIONS_SPEC="\
3193git flow feature delete [-h] [-f] [-r] <name>
3194
3195Delete a given feature branch
3196--
3197h,help!          Show this help
3198showcommands!    Show git commands while executing them
3199f,[no]force      Force deletion
3200r,[no]remote     Delete remote branch
3201"
3202        local current_branch
3203
3204        # Define flags
3205        DEFINE_boolean 'force' false "force deletion" f
3206        DEFINE_boolean 'remote' false "delete remote branch" r
3207
3208        # Override defaults with values from config
3209        gitflow_override_flag_boolean   "feature.delete.force"    "force"
3210        gitflow_override_flag_boolean   "feature.delete.remote"   "remote"
3211
3212        # Parse arguments
3213        parse_args "$@"
3214
3215        gitflow_expand_nameprefix_arg
3216
3217        # Sanity checks
3218        require_branch "$BRANCH"
3219
3220        run_pre_hook "$NAME" "$ORIGIN" "$BRANCH"
3221
3222        current_branch=$(git_current_branch)
3223        # We can't delete a branch we are on, switch to the develop branch.
3224        if [ "$BRANCH" = "$current_branch" ]; then
3225                require_clean_working_tree
3226                git_do checkout "$DEVELOP_BRANCH" || die "Could not check out branch '$DEVELOP_BRANCH'."
3227        fi
3228
3229        if git_is_branch_merged_into "$BRANCH" "$DEVELOP_BRANCH"; then
3230                git_do branch -d "$BRANCH" || die "Could not delete the $BRANCH."
3231                if flag remote; then
3232                        git_do push "$ORIGIN" :"$BRANCH" || die "Could not delete the remote $BRANCH in $ORIGIN."
3233                fi
3234        else
3235                if flag force; then
3236                        git_do branch -D "$BRANCH" || die "Could not delete the $BRANCH."
3237                        if flag remote; then
3238                                git_do push "$ORIGIN" :"$BRANCH" || die "Could not delete the remote $BRANCH in $ORIGIN."
3239                        fi
3240                else
3241                        die "Feature branch '$BRANCH' has been not been merged yet. Use -f to force the deletion."
3242                fi
3243        fi
3244
3245        gitflow_config_remove_base_section "$BRANCH"
3246        run_post_hook "$NAME" "$ORIGIN" "$BRANCH"
3247
3248        echo
3249        echo "Summary of actions:"
3250        echo "- Feature branch '$BRANCH' has been deleted."
3251        flag remote && echo "- Feature branch '$BRANCH' in '$ORIGIN' has been deleted."
3252        echo "- You are now on branch '$(git_current_branch)'"
3253        echo
3254}
3255+ FLAGS_PARENT='git flow feature'
3256+ '[' -z '' ']'
3257+ startswith finish -
3258+ '[' finish '!=' finish ']'
3259+ '[' -z finish ']'
3260+ SUBACTION=finish
3261+ shift
3262contains "$SUBACTION" "_"
3263++ contains finish _
3264++ local return
3265++ case $1 in
3266++ return=1
3267++ return 1
3268echo "$SUBACTION" |tr '-' '_'
3269++ echo finish
3270++ tr - _
3271+ SUBACTION=finish
3272+ type cmd_finish
3273+ '[' finish '!=' help ']'
3274+ '[' feature '!=' init ']'
3275+ initialize
3276+ require_git_repo
3277+ git rev-parse
3278+ require_gitflow_initialized
3279+ gitflow_is_initialized
3280+ gitflow_has_master_configured
3281+ local master
3282git config --get gitflow.branch.master
3283++ git config --get gitflow.branch.master
3284+ master=master
3285+ '[' master '!=' '' ']'
3286+ git_local_branch_exists master
3287+ '[' -n master ']'
3288git for-each-ref --format='%(refname:short)' refs/heads/$1
3289++ git for-each-ref '--format=%(refname:short)' refs/heads/master
3290+ '[' -n master ']'
3291+ gitflow_has_develop_configured
3292+ local develop
3293git config --get gitflow.branch.develop
3294++ git config --get gitflow.branch.develop
3295+ develop=develop
3296+ '[' develop '!=' '' ']'
3297+ git_local_branch_exists develop
3298+ '[' -n develop ']'
3299git for-each-ref --format='%(refname:short)' refs/heads/$1
3300++ git for-each-ref '--format=%(refname:short)' refs/heads/develop
3301+ '[' -n develop ']'
3302git config --get gitflow.branch.master
3303++ git config --get gitflow.branch.master
3304git config --get gitflow.branch.develop
3305++ git config --get gitflow.branch.develop
3306+ '[' master '!=' develop ']'
3307+ gitflow_has_prefixes_configured
3308+ git config --get gitflow.prefix.feature
3309+ git config --get gitflow.prefix.release
3310+ git config --get gitflow.prefix.hotfix
3311+ git config --get gitflow.prefix.support
3312+ git config --get gitflow.prefix.versiontag
3313+ gitflow_load_settings
3314git rev-parse --show-toplevel 2>/dev/null
3315++ git rev-parse --show-toplevel
3316+ export GIT_CURRENT_REPO_DIR=/Users/USERNAME/tmp/gitflow
3317+ GIT_CURRENT_REPO_DIR=/Users/USERNAME/tmp/gitflow
3318git rev-parse --git-dir 2>/dev/null
3319++ git rev-parse --git-dir
3320+ export DOT_GIT_DIR=.git
3321+ DOT_GIT_DIR=.git
3322git config --get gitflow.path.hooks || echo "$DOT_GIT_DIR"/hooks
3323++ git config --get gitflow.path.hooks
3324+ export HOOKS_DIR=.git/hooks
3325+ HOOKS_DIR=.git/hooks
3326git config --get gitflow.branch.master
3327++ git config --get gitflow.branch.master
3328+ export MASTER_BRANCH=master
3329+ MASTER_BRANCH=master
3330git config --get gitflow.branch.develop
3331++ git config --get gitflow.branch.develop
3332+ export DEVELOP_BRANCH=develop
3333+ DEVELOP_BRANCH=develop
3334git config --get gitflow.origin || echo origin
3335++ git config --get gitflow.origin
3336++ echo origin
3337+ export ORIGIN=origin
3338+ ORIGIN=origin
3339+ GITFLOW_CONFIG=.git/gitflow_config
3340+ '[' -f .git/gitflow_config ']'
3341git config --get gitflow.prefix.feature
3342++ git config --get gitflow.prefix.feature
3343+ PREFIX=feature/
3344+ '[' finish '!=' default ']'
3345+ FLAGS_PARENT='git flow feature finish'
3346+ cmd_finish f3 ''
3347+ OPTIONS_SPEC='git flow feature finish [-h] [-F] [-r] [-p] [-k] [-D] [-S] [--no-ff] <name|nameprefix>
3348
3349Finish feature <name>
3350--
3351h,help!                Show this help
3352showcommands!          Show git commands while executing them
3353F,[no]fetch            Fetch from origin before performing finish
3354r,[no]rebase           Rebase before merging
3355p,[no]preserve-merges  Preserve merges while rebasing
3356k,[no]keep             Keep branch after performing finish
3357keepremote!                Keep the remote branch
3358keeplocal!             Keep the local branch
3359D,[no]force_delete     Force delete feature branch after finish
3360S,[no]squash           Squash feature during merge
3361no-ff!                 Never fast-forward during the merge
3362'
3363+ local finish_base
3364+ DEFINE_boolean fetch false 'fetch from origin before performing finish' F
3365+ _flags_define 1 fetch false 'fetch from origin before performing finish' F
3366+ '[' 5 -lt 4 ']'
3367+ _flags_type_=1
3368+ _flags_name_=fetch
3369+ _flags_default_=false
3370+ _flags_help_='fetch from origin before performing finish'
3371+ _flags_short_=F
3372+ _flags_return_=0
3373_flags_removeExclamationName ${_flags_name_}
3374++ _flags_removeExclamationName fetch
3375++ _flags_opt_=fetch
3376++ _flags_isNegate fetch
3377++ case $1 in
3378++ flags_return=0
3379++ return 0
3380++ echo fetch
3381++ unset _flags_opt_
3382++ return 0
3383+ _flags_usName_=fetch
3384_flags_underscoreName ${_flags_usName_}
3385++ _flags_underscoreName fetch
3386++ echo fetch
3387++ tr - _
3388+ _flags_usName_=fetch
3389+ _flags_itemInList fetch ' ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE  VERSION '
3390+ _flags_str_=fetch
3391+ shift
3392+ _flags_list_='  ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE  VERSION  '
3393+ case ${_flags_list_} in
3394+ flags_return=1
3395+ unset _flags_str_ _flags_list_
3396+ return 1
3397+ '[' 1 -eq 0 ']'
3398+ '[' 0 -eq 0 -a 1 -ne 1 -a F = '~' ']'
3399+ '[' 0 -eq 0 ']'
3400+ _flags_itemInList fetch showcommands noshowcommands showcommands
3401+ _flags_str_=fetch
3402+ shift
3403+ _flags_list_=' showcommands noshowcommands showcommands '
3404+ case ${_flags_list_} in
3405+ flags_return=1
3406+ unset _flags_str_ _flags_list_
3407+ return 1
3408+ '[' 0 -eq 0 -a F '!=' '~' ']'
3409+ _flags_itemInList F '~'
3410+ _flags_str_=F
3411+ shift
3412+ _flags_list_=' ~ '
3413+ case ${_flags_list_} in
3414+ flags_return=1
3415+ unset _flags_str_ _flags_list_
3416+ return 1
3417+ '[' 0 -eq 0 ']'
3418+ case ${_flags_type_} in
3419+ _flags_validBool false
3420+ _flags_bool_=false
3421+ flags_return=0
3422+ case "${_flags_bool_}" in
3423+ unset _flags_bool_
3424+ return 0
3425+ case ${_flags_default_} in
3426+ _flags_default_=1
3427+ _flags_isNegate fetch
3428+ case $1 in
3429+ flags_return=0
3430+ return 0
3431+ _flags_isNegate_=0
3432+ '[' 0 -eq 0 ']'
3433+ eval 'FLAGS_fetch='\''1'\'''
3434FLAGS_fetch='1'
3435++ FLAGS_fetch=1
3436+ eval __flags_fetch_type=1
3437__flags_fetch_type=1
3438++ __flags_fetch_type=1
3439+ eval '__flags_fetch_default="1"'
3440__flags_fetch_default="1"
3441++ __flags_fetch_default=1
3442+ eval '__flags_fetch_help="fetch from origin before performing finish"'
3443__flags_fetch_help="fetch from origin before performing finish"
3444++ __flags_fetch_help='fetch from origin before performing finish'
3445+ eval '__flags_fetch_short='\''F'\'''
3446__flags_fetch_short='F'
3447++ __flags_fetch_short=F
3448+ __flags_shortNames=' ~ F '
3449_flags_removeExclamationName ${_flags_name_}
3450++ _flags_removeExclamationName fetch
3451++ _flags_opt_=fetch
3452++ _flags_isNegate fetch
3453++ case $1 in
3454++ flags_return=0
3455++ return 0
3456++ echo fetch
3457++ unset _flags_opt_
3458++ return 0
3459+ __flags_longNames=' showcommands fetch '
3460+ '[' 1 -eq 1 -a 0 -eq 0 ']'
3461+ __flags_boolNames=' noshowcommands nofetch '
3462+ __flags_definedNames=' showcommands noshowcommands showcommands fetch '
3463+ '[' 1 -eq 1 ']'
3464+ '[' 0 -eq 0 ']'
3465+ __flags_definedNames=' showcommands noshowcommands showcommands fetch nofetch '
3466+ __flags_definedNames=' showcommands noshowcommands showcommands fetch nofetch fetch '
3467+ '[' 1 -eq 1 ']'
3468+ '[' 0 -eq 1 ']'
3469+ flags_return=0
3470+ unset _flags_default_ _flags_help_ _flags_name_ _flags_return_ _flags_short_ _flags_type_ _flags_usName_
3471+ '[' 0 -eq 2 ']'
3472+ return 0
3473+ DEFINE_boolean rebase false 'rebase before merging' r
3474+ _flags_define 1 rebase false 'rebase before merging' r
3475+ '[' 5 -lt 4 ']'
3476+ _flags_type_=1
3477+ _flags_name_=rebase
3478+ _flags_default_=false
3479+ _flags_help_='rebase before merging'
3480+ _flags_short_=r
3481+ _flags_return_=0
3482_flags_removeExclamationName ${_flags_name_}
3483++ _flags_removeExclamationName rebase
3484++ _flags_opt_=rebase
3485++ _flags_isNegate rebase
3486++ case $1 in
3487++ flags_return=0
3488++ return 0
3489++ echo rebase
3490++ unset _flags_opt_
3491++ return 0
3492+ _flags_usName_=rebase
3493_flags_underscoreName ${_flags_usName_}
3494++ _flags_underscoreName rebase
3495++ echo rebase
3496++ tr - _
3497+ _flags_usName_=rebase
3498+ _flags_itemInList rebase ' ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE  VERSION '
3499+ _flags_str_=rebase
3500+ shift
3501+ _flags_list_='  ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE  VERSION  '
3502+ case ${_flags_list_} in
3503+ flags_return=1
3504+ unset _flags_str_ _flags_list_
3505+ return 1
3506+ '[' 1 -eq 0 ']'
3507+ '[' 0 -eq 0 -a 1 -ne 1 -a r = '~' ']'
3508+ '[' 0 -eq 0 ']'
3509+ _flags_itemInList rebase showcommands noshowcommands showcommands fetch nofetch fetch
3510+ _flags_str_=rebase
3511+ shift
3512+ _flags_list_=' showcommands noshowcommands showcommands fetch nofetch fetch '
3513+ case ${_flags_list_} in
3514+ flags_return=1
3515+ unset _flags_str_ _flags_list_
3516+ return 1
3517+ '[' 0 -eq 0 -a r '!=' '~' ']'
3518+ _flags_itemInList r '~' F
3519+ _flags_str_=r
3520+ shift
3521+ _flags_list_=' ~ F '
3522+ case ${_flags_list_} in
3523+ flags_return=1
3524+ unset _flags_str_ _flags_list_
3525+ return 1
3526+ '[' 0 -eq 0 ']'
3527+ case ${_flags_type_} in
3528+ _flags_validBool false
3529+ _flags_bool_=false
3530+ flags_return=0
3531+ case "${_flags_bool_}" in
3532+ unset _flags_bool_
3533+ return 0
3534+ case ${_flags_default_} in
3535+ _flags_default_=1
3536+ _flags_isNegate rebase
3537+ case $1 in
3538+ flags_return=0
3539+ return 0
3540+ _flags_isNegate_=0
3541+ '[' 0 -eq 0 ']'
3542+ eval 'FLAGS_rebase='\''1'\'''
3543FLAGS_rebase='1'
3544++ FLAGS_rebase=1
3545+ eval __flags_rebase_type=1
3546__flags_rebase_type=1
3547++ __flags_rebase_type=1
3548+ eval '__flags_rebase_default="1"'
3549__flags_rebase_default="1"
3550++ __flags_rebase_default=1
3551+ eval '__flags_rebase_help="rebase before merging"'
3552__flags_rebase_help="rebase before merging"
3553++ __flags_rebase_help='rebase before merging'
3554+ eval '__flags_rebase_short='\''r'\'''
3555__flags_rebase_short='r'
3556++ __flags_rebase_short=r
3557+ __flags_shortNames=' ~ F r '
3558_flags_removeExclamationName ${_flags_name_}
3559++ _flags_removeExclamationName rebase
3560++ _flags_opt_=rebase
3561++ _flags_isNegate rebase
3562++ case $1 in
3563++ flags_return=0
3564++ return 0
3565++ echo rebase
3566++ unset _flags_opt_
3567++ return 0
3568+ __flags_longNames=' showcommands fetch rebase '
3569+ '[' 1 -eq 1 -a 0 -eq 0 ']'
3570+ __flags_boolNames=' noshowcommands nofetch norebase '
3571+ __flags_definedNames=' showcommands noshowcommands showcommands fetch nofetch fetch rebase '
3572+ '[' 1 -eq 1 ']'
3573+ '[' 0 -eq 0 ']'
3574+ __flags_definedNames=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase '
3575+ __flags_definedNames=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase '
3576+ '[' 1 -eq 1 ']'
3577+ '[' 0 -eq 1 ']'
3578+ flags_return=0
3579+ unset _flags_default_ _flags_help_ _flags_name_ _flags_return_ _flags_short_ _flags_type_ _flags_usName_
3580+ '[' 0 -eq 2 ']'
3581+ return 0
3582+ DEFINE_boolean preserve-merges false 'try to recreate merges while rebasing' p
3583+ _flags_define 1 preserve-merges false 'try to recreate merges while rebasing' p
3584+ '[' 5 -lt 4 ']'
3585+ _flags_type_=1
3586+ _flags_name_=preserve-merges
3587+ _flags_default_=false
3588+ _flags_help_='try to recreate merges while rebasing'
3589+ _flags_short_=p
3590+ _flags_return_=0
3591_flags_removeExclamationName ${_flags_name_}
3592++ _flags_removeExclamationName preserve-merges
3593++ _flags_opt_=preserve-merges
3594++ _flags_isNegate preserve-merges
3595++ case $1 in
3596++ flags_return=0
3597++ return 0
3598++ echo preserve-merges
3599++ unset _flags_opt_
3600++ return 0
3601+ _flags_usName_=preserve-merges
3602_flags_underscoreName ${_flags_usName_}
3603++ _flags_underscoreName preserve-merges
3604++ echo preserve-merges
3605++ tr - _
3606+ _flags_usName_=preserve_merges
3607+ _flags_itemInList preserve_merges ' ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE  VERSION '
3608+ _flags_str_=preserve_merges
3609+ shift
3610+ _flags_list_='  ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE  VERSION  '
3611+ case ${_flags_list_} in
3612+ flags_return=1
3613+ unset _flags_str_ _flags_list_
3614+ return 1
3615+ '[' 1 -eq 0 ']'
3616+ '[' 0 -eq 0 -a 1 -ne 1 -a p = '~' ']'
3617+ '[' 0 -eq 0 ']'
3618+ _flags_itemInList preserve_merges showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase
3619+ _flags_str_=preserve_merges
3620+ shift
3621+ _flags_list_=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase '
3622+ case ${_flags_list_} in
3623+ flags_return=1
3624+ unset _flags_str_ _flags_list_
3625+ return 1
3626+ '[' 0 -eq 0 -a p '!=' '~' ']'
3627+ _flags_itemInList p '~' F r
3628+ _flags_str_=p
3629+ shift
3630+ _flags_list_=' ~ F r '
3631+ case ${_flags_list_} in
3632+ flags_return=1
3633+ unset _flags_str_ _flags_list_
3634+ return 1
3635+ '[' 0 -eq 0 ']'
3636+ case ${_flags_type_} in
3637+ _flags_validBool false
3638+ _flags_bool_=false
3639+ flags_return=0
3640+ case "${_flags_bool_}" in
3641+ unset _flags_bool_
3642+ return 0
3643+ case ${_flags_default_} in
3644+ _flags_default_=1
3645+ _flags_isNegate preserve-merges
3646+ case $1 in
3647+ flags_return=0
3648+ return 0
3649+ _flags_isNegate_=0
3650+ '[' 0 -eq 0 ']'
3651+ eval 'FLAGS_preserve_merges='\''1'\'''
3652FLAGS_preserve_merges='1'
3653++ FLAGS_preserve_merges=1
3654+ eval __flags_preserve_merges_type=1
3655__flags_preserve_merges_type=1
3656++ __flags_preserve_merges_type=1
3657+ eval '__flags_preserve_merges_default="1"'
3658__flags_preserve_merges_default="1"
3659++ __flags_preserve_merges_default=1
3660+ eval '__flags_preserve_merges_help="try to recreate merges while rebasing"'
3661__flags_preserve_merges_help="try to recreate merges while rebasing"
3662++ __flags_preserve_merges_help='try to recreate merges while rebasing'
3663+ eval '__flags_preserve_merges_short='\''p'\'''
3664__flags_preserve_merges_short='p'
3665++ __flags_preserve_merges_short=p
3666+ __flags_shortNames=' ~ F r p '
3667_flags_removeExclamationName ${_flags_name_}
3668++ _flags_removeExclamationName preserve-merges
3669++ _flags_opt_=preserve-merges
3670++ _flags_isNegate preserve-merges
3671++ case $1 in
3672++ flags_return=0
3673++ return 0
3674++ echo preserve-merges
3675++ unset _flags_opt_
3676++ return 0
3677+ __flags_longNames=' showcommands fetch rebase preserve-merges '
3678+ '[' 1 -eq 1 -a 0 -eq 0 ']'
3679+ __flags_boolNames=' noshowcommands nofetch norebase nopreserve-merges '
3680+ __flags_definedNames=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges '
3681+ '[' 1 -eq 1 ']'
3682+ '[' 0 -eq 0 ']'
3683+ __flags_definedNames=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges '
3684+ __flags_definedNames=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges '
3685+ '[' 1 -eq 1 ']'
3686+ '[' 0 -eq 1 ']'
3687+ flags_return=0
3688+ unset _flags_default_ _flags_help_ _flags_name_ _flags_return_ _flags_short_ _flags_type_ _flags_usName_
3689+ '[' 0 -eq 2 ']'
3690+ return 0
3691+ DEFINE_boolean keep false 'keep branch after performing finish' k
3692+ _flags_define 1 keep false 'keep branch after performing finish' k
3693+ '[' 5 -lt 4 ']'
3694+ _flags_type_=1
3695+ _flags_name_=keep
3696+ _flags_default_=false
3697+ _flags_help_='keep branch after performing finish'
3698+ _flags_short_=k
3699+ _flags_return_=0
3700_flags_removeExclamationName ${_flags_name_}
3701++ _flags_removeExclamationName keep
3702++ _flags_opt_=keep
3703++ _flags_isNegate keep
3704++ case $1 in
3705++ flags_return=0
3706++ return 0
3707++ echo keep
3708++ unset _flags_opt_
3709++ return 0
3710+ _flags_usName_=keep
3711_flags_underscoreName ${_flags_usName_}
3712++ _flags_underscoreName keep
3713++ echo keep
3714++ tr - _
3715+ _flags_usName_=keep
3716+ _flags_itemInList keep ' ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE  VERSION '
3717+ _flags_str_=keep
3718+ shift
3719+ _flags_list_='  ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE  VERSION  '
3720+ case ${_flags_list_} in
3721+ flags_return=1
3722+ unset _flags_str_ _flags_list_
3723+ return 1
3724+ '[' 1 -eq 0 ']'
3725+ '[' 0 -eq 0 -a 1 -ne 1 -a k = '~' ']'
3726+ '[' 0 -eq 0 ']'
3727+ _flags_itemInList keep showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges
3728+ _flags_str_=keep
3729+ shift
3730+ _flags_list_=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges '
3731+ case ${_flags_list_} in
3732+ flags_return=1
3733+ unset _flags_str_ _flags_list_
3734+ return 1
3735+ '[' 0 -eq 0 -a k '!=' '~' ']'
3736+ _flags_itemInList k '~' F r p
3737+ _flags_str_=k
3738+ shift
3739+ _flags_list_=' ~ F r p '
3740+ case ${_flags_list_} in
3741+ flags_return=1
3742+ unset _flags_str_ _flags_list_
3743+ return 1
3744+ '[' 0 -eq 0 ']'
3745+ case ${_flags_type_} in
3746+ _flags_validBool false
3747+ _flags_bool_=false
3748+ flags_return=0
3749+ case "${_flags_bool_}" in
3750+ unset _flags_bool_
3751+ return 0
3752+ case ${_flags_default_} in
3753+ _flags_default_=1
3754+ _flags_isNegate keep
3755+ case $1 in
3756+ flags_return=0
3757+ return 0
3758+ _flags_isNegate_=0
3759+ '[' 0 -eq 0 ']'
3760+ eval 'FLAGS_keep='\''1'\'''
3761FLAGS_keep='1'
3762++ FLAGS_keep=1
3763+ eval __flags_keep_type=1
3764__flags_keep_type=1
3765++ __flags_keep_type=1
3766+ eval '__flags_keep_default="1"'
3767__flags_keep_default="1"
3768++ __flags_keep_default=1
3769+ eval '__flags_keep_help="keep branch after performing finish"'
3770__flags_keep_help="keep branch after performing finish"
3771++ __flags_keep_help='keep branch after performing finish'
3772+ eval '__flags_keep_short='\''k'\'''
3773__flags_keep_short='k'
3774++ __flags_keep_short=k
3775+ __flags_shortNames=' ~ F r p k '
3776_flags_removeExclamationName ${_flags_name_}
3777++ _flags_removeExclamationName keep
3778++ _flags_opt_=keep
3779++ _flags_isNegate keep
3780++ case $1 in
3781++ flags_return=0
3782++ return 0
3783++ echo keep
3784++ unset _flags_opt_
3785++ return 0
3786+ __flags_longNames=' showcommands fetch rebase preserve-merges keep '
3787+ '[' 1 -eq 1 -a 0 -eq 0 ']'
3788+ __flags_boolNames=' noshowcommands nofetch norebase nopreserve-merges nokeep '
3789+ __flags_definedNames=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep '
3790+ '[' 1 -eq 1 ']'
3791+ '[' 0 -eq 0 ']'
3792+ __flags_definedNames=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep '
3793+ __flags_definedNames=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep '
3794+ '[' 1 -eq 1 ']'
3795+ '[' 0 -eq 1 ']'
3796+ flags_return=0
3797+ unset _flags_default_ _flags_help_ _flags_name_ _flags_return_ _flags_short_ _flags_type_ _flags_usName_
3798+ '[' 0 -eq 2 ']'
3799+ return 0
3800+ DEFINE_boolean keepremote false 'keep the remote branch'
3801+ _flags_define 1 keepremote false 'keep the remote branch'
3802+ '[' 4 -lt 4 ']'
3803+ _flags_type_=1
3804+ _flags_name_=keepremote
3805+ _flags_default_=false
3806+ _flags_help_='keep the remote branch'
3807+ _flags_short_='~'
3808+ _flags_return_=0
3809_flags_removeExclamationName ${_flags_name_}
3810++ _flags_removeExclamationName keepremote
3811++ _flags_opt_=keepremote
3812++ _flags_isNegate keepremote
3813++ case $1 in
3814++ flags_return=0
3815++ return 0
3816++ echo keepremote
3817++ unset _flags_opt_
3818++ return 0
3819+ _flags_usName_=keepremote
3820_flags_underscoreName ${_flags_usName_}
3821++ _flags_underscoreName keepremote
3822++ echo keepremote
3823++ tr - _
3824+ _flags_usName_=keepremote
3825+ _flags_itemInList keepremote ' ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE  VERSION '
3826+ _flags_str_=keepremote
3827+ shift
3828+ _flags_list_='  ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE  VERSION  '
3829+ case ${_flags_list_} in
3830+ flags_return=1
3831+ unset _flags_str_ _flags_list_
3832+ return 1
3833+ '[' 1 -eq 0 ']'
3834+ '[' 0 -eq 0 -a 1 -ne 1 -a '~' = '~' ']'
3835+ '[' 0 -eq 0 ']'
3836+ _flags_itemInList keepremote showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep
3837+ _flags_str_=keepremote
3838+ shift
3839+ _flags_list_=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep '
3840+ case ${_flags_list_} in
3841+ flags_return=1
3842+ unset _flags_str_ _flags_list_
3843+ return 1
3844+ '[' 0 -eq 0 -a '~' '!=' '~' ']'
3845+ '[' 0 -eq 0 ']'
3846+ case ${_flags_type_} in
3847+ _flags_validBool false
3848+ _flags_bool_=false
3849+ flags_return=0
3850+ case "${_flags_bool_}" in
3851+ unset _flags_bool_
3852+ return 0
3853+ case ${_flags_default_} in
3854+ _flags_default_=1
3855+ _flags_isNegate keepremote
3856+ case $1 in
3857+ flags_return=0
3858+ return 0
3859+ _flags_isNegate_=0
3860+ '[' 0 -eq 0 ']'
3861+ eval 'FLAGS_keepremote='\''1'\'''
3862FLAGS_keepremote='1'
3863++ FLAGS_keepremote=1
3864+ eval __flags_keepremote_type=1
3865__flags_keepremote_type=1
3866++ __flags_keepremote_type=1
3867+ eval '__flags_keepremote_default="1"'
3868__flags_keepremote_default="1"
3869++ __flags_keepremote_default=1
3870+ eval '__flags_keepremote_help="keep the remote branch"'
3871__flags_keepremote_help="keep the remote branch"
3872++ __flags_keepremote_help='keep the remote branch'
3873+ eval '__flags_keepremote_short='\''~'\'''
3874__flags_keepremote_short='~'
3875++ __flags_keepremote_short='~'
3876+ __flags_shortNames=' ~ F r p k ~ '
3877_flags_removeExclamationName ${_flags_name_}
3878++ _flags_removeExclamationName keepremote
3879++ _flags_opt_=keepremote
3880++ _flags_isNegate keepremote
3881++ case $1 in
3882++ flags_return=0
3883++ return 0
3884++ echo keepremote
3885++ unset _flags_opt_
3886++ return 0
3887+ __flags_longNames=' showcommands fetch rebase preserve-merges keep keepremote '
3888+ '[' 1 -eq 1 -a 0 -eq 0 ']'
3889+ __flags_boolNames=' noshowcommands nofetch norebase nopreserve-merges nokeep nokeepremote '
3890+ __flags_definedNames=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote '
3891+ '[' 1 -eq 1 ']'
3892+ '[' 0 -eq 0 ']'
3893+ __flags_definedNames=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote nokeepremote '
3894+ __flags_definedNames=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote nokeepremote keepremote '
3895+ '[' 1 -eq 1 ']'
3896+ '[' 0 -eq 1 ']'
3897+ flags_return=0
3898+ unset _flags_default_ _flags_help_ _flags_name_ _flags_return_ _flags_short_ _flags_type_ _flags_usName_
3899+ '[' 0 -eq 2 ']'
3900+ return 0
3901+ DEFINE_boolean keeplocal false 'keep the local branch'
3902+ _flags_define 1 keeplocal false 'keep the local branch'
3903+ '[' 4 -lt 4 ']'
3904+ _flags_type_=1
3905+ _flags_name_=keeplocal
3906+ _flags_default_=false
3907+ _flags_help_='keep the local branch'
3908+ _flags_short_='~'
3909+ _flags_return_=0
3910_flags_removeExclamationName ${_flags_name_}
3911++ _flags_removeExclamationName keeplocal
3912++ _flags_opt_=keeplocal
3913++ _flags_isNegate keeplocal
3914++ case $1 in
3915++ flags_return=0
3916++ return 0
3917++ echo keeplocal
3918++ unset _flags_opt_
3919++ return 0
3920+ _flags_usName_=keeplocal
3921_flags_underscoreName ${_flags_usName_}
3922++ _flags_underscoreName keeplocal
3923++ echo keeplocal
3924++ tr - _
3925+ _flags_usName_=keeplocal
3926+ _flags_itemInList keeplocal ' ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE  VERSION '
3927+ _flags_str_=keeplocal
3928+ shift
3929+ _flags_list_='  ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE  VERSION  '
3930+ case ${_flags_list_} in
3931+ flags_return=1
3932+ unset _flags_str_ _flags_list_
3933+ return 1
3934+ '[' 1 -eq 0 ']'
3935+ '[' 0 -eq 0 -a 1 -ne 1 -a '~' = '~' ']'
3936+ '[' 0 -eq 0 ']'
3937+ _flags_itemInList keeplocal showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote nokeepremote keepremote
3938+ _flags_str_=keeplocal
3939+ shift
3940+ _flags_list_=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote nokeepremote keepremote '
3941+ case ${_flags_list_} in
3942+ flags_return=1
3943+ unset _flags_str_ _flags_list_
3944+ return 1
3945+ '[' 0 -eq 0 -a '~' '!=' '~' ']'
3946+ '[' 0 -eq 0 ']'
3947+ case ${_flags_type_} in
3948+ _flags_validBool false
3949+ _flags_bool_=false
3950+ flags_return=0
3951+ case "${_flags_bool_}" in
3952+ unset _flags_bool_
3953+ return 0
3954+ case ${_flags_default_} in
3955+ _flags_default_=1
3956+ _flags_isNegate keeplocal
3957+ case $1 in
3958+ flags_return=0
3959+ return 0
3960+ _flags_isNegate_=0
3961+ '[' 0 -eq 0 ']'
3962+ eval 'FLAGS_keeplocal='\''1'\'''
3963FLAGS_keeplocal='1'
3964++ FLAGS_keeplocal=1
3965+ eval __flags_keeplocal_type=1
3966__flags_keeplocal_type=1
3967++ __flags_keeplocal_type=1
3968+ eval '__flags_keeplocal_default="1"'
3969__flags_keeplocal_default="1"
3970++ __flags_keeplocal_default=1
3971+ eval '__flags_keeplocal_help="keep the local branch"'
3972__flags_keeplocal_help="keep the local branch"
3973++ __flags_keeplocal_help='keep the local branch'
3974+ eval '__flags_keeplocal_short='\''~'\'''
3975__flags_keeplocal_short='~'
3976++ __flags_keeplocal_short='~'
3977+ __flags_shortNames=' ~ F r p k ~ ~ '
3978_flags_removeExclamationName ${_flags_name_}
3979++ _flags_removeExclamationName keeplocal
3980++ _flags_opt_=keeplocal
3981++ _flags_isNegate keeplocal
3982++ case $1 in
3983++ flags_return=0
3984++ return 0
3985++ echo keeplocal
3986++ unset _flags_opt_
3987++ return 0
3988+ __flags_longNames=' showcommands fetch rebase preserve-merges keep keepremote keeplocal '
3989+ '[' 1 -eq 1 -a 0 -eq 0 ']'
3990+ __flags_boolNames=' noshowcommands nofetch norebase nopreserve-merges nokeep nokeepremote nokeeplocal '
3991+ __flags_definedNames=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote nokeepremote keepremote keeplocal '
3992+ '[' 1 -eq 1 ']'
3993+ '[' 0 -eq 0 ']'
3994+ __flags_definedNames=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote nokeepremote keepremote keeplocal nokeeplocal '
3995+ __flags_definedNames=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote nokeepremote keepremote keeplocal nokeeplocal keeplocal '
3996+ '[' 1 -eq 1 ']'
3997+ '[' 0 -eq 1 ']'
3998+ flags_return=0
3999+ unset _flags_default_ _flags_help_ _flags_name_ _flags_return_ _flags_short_ _flags_type_ _flags_usName_
4000+ '[' 0 -eq 2 ']'
4001+ return 0
4002+ DEFINE_boolean force_delete false 'force delete feature branch after finish' D
4003+ _flags_define 1 force_delete false 'force delete feature branch after finish' D
4004+ '[' 5 -lt 4 ']'
4005+ _flags_type_=1
4006+ _flags_name_=force_delete
4007+ _flags_default_=false
4008+ _flags_help_='force delete feature branch after finish'
4009+ _flags_short_=D
4010+ _flags_return_=0
4011_flags_removeExclamationName ${_flags_name_}
4012++ _flags_removeExclamationName force_delete
4013++ _flags_opt_=force_delete
4014++ _flags_isNegate force_delete
4015++ case $1 in
4016++ flags_return=0
4017++ return 0
4018++ echo force_delete
4019++ unset _flags_opt_
4020++ return 0
4021+ _flags_usName_=force_delete
4022_flags_underscoreName ${_flags_usName_}
4023++ _flags_underscoreName force_delete
4024++ echo force_delete
4025++ tr - _
4026+ _flags_usName_=force_delete
4027+ _flags_itemInList force_delete ' ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE  VERSION '
4028+ _flags_str_=force_delete
4029+ shift
4030+ _flags_list_='  ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE  VERSION  '
4031+ case ${_flags_list_} in
4032+ flags_return=1
4033+ unset _flags_str_ _flags_list_
4034+ return 1
4035+ '[' 1 -eq 0 ']'
4036+ '[' 0 -eq 0 -a 1 -ne 1 -a D = '~' ']'
4037+ '[' 0 -eq 0 ']'
4038+ _flags_itemInList force_delete showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote nokeepremote keepremote keeplocal nokeeplocal keeplocal
4039+ _flags_str_=force_delete
4040+ shift
4041+ _flags_list_=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote nokeepremote keepremote keeplocal nokeeplocal keeplocal '
4042+ case ${_flags_list_} in
4043+ flags_return=1
4044+ unset _flags_str_ _flags_list_
4045+ return 1
4046+ '[' 0 -eq 0 -a D '!=' '~' ']'
4047+ _flags_itemInList D '~' F r p k '~' '~'
4048+ _flags_str_=D
4049+ shift
4050+ _flags_list_=' ~ F r p k ~ ~ '
4051+ case ${_flags_list_} in
4052+ flags_return=1
4053+ unset _flags_str_ _flags_list_
4054+ return 1
4055+ '[' 0 -eq 0 ']'
4056+ case ${_flags_type_} in
4057+ _flags_validBool false
4058+ _flags_bool_=false
4059+ flags_return=0
4060+ case "${_flags_bool_}" in
4061+ unset _flags_bool_
4062+ return 0
4063+ case ${_flags_default_} in
4064+ _flags_default_=1
4065+ _flags_isNegate force_delete
4066+ case $1 in
4067+ flags_return=0
4068+ return 0
4069+ _flags_isNegate_=0
4070+ '[' 0 -eq 0 ']'
4071+ eval 'FLAGS_force_delete='\''1'\'''
4072FLAGS_force_delete='1'
4073++ FLAGS_force_delete=1
4074+ eval __flags_force_delete_type=1
4075__flags_force_delete_type=1
4076++ __flags_force_delete_type=1
4077+ eval '__flags_force_delete_default="1"'
4078__flags_force_delete_default="1"
4079++ __flags_force_delete_default=1
4080+ eval '__flags_force_delete_help="force delete feature branch after finish"'
4081__flags_force_delete_help="force delete feature branch after finish"
4082++ __flags_force_delete_help='force delete feature branch after finish'
4083+ eval '__flags_force_delete_short='\''D'\'''
4084__flags_force_delete_short='D'
4085++ __flags_force_delete_short=D
4086+ __flags_shortNames=' ~ F r p k ~ ~ D '
4087_flags_removeExclamationName ${_flags_name_}
4088++ _flags_removeExclamationName force_delete
4089++ _flags_opt_=force_delete
4090++ _flags_isNegate force_delete
4091++ case $1 in
4092++ flags_return=0
4093++ return 0
4094++ echo force_delete
4095++ unset _flags_opt_
4096++ return 0
4097+ __flags_longNames=' showcommands fetch rebase preserve-merges keep keepremote keeplocal force_delete '
4098+ '[' 1 -eq 1 -a 0 -eq 0 ']'
4099+ __flags_boolNames=' noshowcommands nofetch norebase nopreserve-merges nokeep nokeepremote nokeeplocal noforce_delete '
4100+ __flags_definedNames=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote nokeepremote keepremote keeplocal nokeeplocal keeplocal force_delete '
4101+ '[' 1 -eq 1 ']'
4102+ '[' 0 -eq 0 ']'
4103+ __flags_definedNames=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote nokeepremote keepremote keeplocal nokeeplocal keeplocal force_delete noforce_delete '
4104+ __flags_definedNames=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote nokeepremote keepremote keeplocal nokeeplocal keeplocal force_delete noforce_delete force_delete '
4105+ '[' 1 -eq 1 ']'
4106+ '[' 0 -eq 1 ']'
4107+ flags_return=0
4108+ unset _flags_default_ _flags_help_ _flags_name_ _flags_return_ _flags_short_ _flags_type_ _flags_usName_
4109+ '[' 0 -eq 2 ']'
4110+ return 0
4111+ DEFINE_boolean squash false 'squash feature during merge' S
4112+ _flags_define 1 squash false 'squash feature during merge' S
4113+ '[' 5 -lt 4 ']'
4114+ _flags_type_=1
4115+ _flags_name_=squash
4116+ _flags_default_=false
4117+ _flags_help_='squash feature during merge'
4118+ _flags_short_=S
4119+ _flags_return_=0
4120_flags_removeExclamationName ${_flags_name_}
4121++ _flags_removeExclamationName squash
4122++ _flags_opt_=squash
4123++ _flags_isNegate squash
4124++ case $1 in
4125++ flags_return=0
4126++ return 0
4127++ echo squash
4128++ unset _flags_opt_
4129++ return 0
4130+ _flags_usName_=squash
4131_flags_underscoreName ${_flags_usName_}
4132++ _flags_underscoreName squash
4133++ tr - _
4134++ echo squash
4135+ _flags_usName_=squash
4136+ _flags_itemInList squash ' ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE  VERSION '
4137+ _flags_str_=squash
4138+ shift
4139+ _flags_list_='  ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE  VERSION  '
4140+ case ${_flags_list_} in
4141+ flags_return=1
4142+ unset _flags_str_ _flags_list_
4143+ return 1
4144+ '[' 1 -eq 0 ']'
4145+ '[' 0 -eq 0 -a 1 -ne 1 -a S = '~' ']'
4146+ '[' 0 -eq 0 ']'
4147+ _flags_itemInList squash showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote nokeepremote keepremote keeplocal nokeeplocal keeplocal force_delete noforce_delete force_delete
4148+ _flags_str_=squash
4149+ shift
4150+ _flags_list_=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote nokeepremote keepremote keeplocal nokeeplocal keeplocal force_delete noforce_delete force_delete '
4151+ case ${_flags_list_} in
4152+ flags_return=1
4153+ unset _flags_str_ _flags_list_
4154+ return 1
4155+ '[' 0 -eq 0 -a S '!=' '~' ']'
4156+ _flags_itemInList S '~' F r p k '~' '~' D
4157+ _flags_str_=S
4158+ shift
4159+ _flags_list_=' ~ F r p k ~ ~ D '
4160+ case ${_flags_list_} in
4161+ flags_return=1
4162+ unset _flags_str_ _flags_list_
4163+ return 1
4164+ '[' 0 -eq 0 ']'
4165+ case ${_flags_type_} in
4166+ _flags_validBool false
4167+ _flags_bool_=false
4168+ flags_return=0
4169+ case "${_flags_bool_}" in
4170+ unset _flags_bool_
4171+ return 0
4172+ case ${_flags_default_} in
4173+ _flags_default_=1
4174+ _flags_isNegate squash
4175+ case $1 in
4176+ flags_return=0
4177+ return 0
4178+ _flags_isNegate_=0
4179+ '[' 0 -eq 0 ']'
4180+ eval 'FLAGS_squash='\''1'\'''
4181FLAGS_squash='1'
4182++ FLAGS_squash=1
4183+ eval __flags_squash_type=1
4184__flags_squash_type=1
4185++ __flags_squash_type=1
4186+ eval '__flags_squash_default="1"'
4187__flags_squash_default="1"
4188++ __flags_squash_default=1
4189+ eval '__flags_squash_help="squash feature during merge"'
4190__flags_squash_help="squash feature during merge"
4191++ __flags_squash_help='squash feature during merge'
4192+ eval '__flags_squash_short='\''S'\'''
4193__flags_squash_short='S'
4194++ __flags_squash_short=S
4195+ __flags_shortNames=' ~ F r p k ~ ~ D S '
4196_flags_removeExclamationName ${_flags_name_}
4197++ _flags_removeExclamationName squash
4198++ _flags_opt_=squash
4199++ _flags_isNegate squash
4200++ case $1 in
4201++ flags_return=0
4202++ return 0
4203++ echo squash
4204++ unset _flags_opt_
4205++ return 0
4206+ __flags_longNames=' showcommands fetch rebase preserve-merges keep keepremote keeplocal force_delete squash '
4207+ '[' 1 -eq 1 -a 0 -eq 0 ']'
4208+ __flags_boolNames=' noshowcommands nofetch norebase nopreserve-merges nokeep nokeepremote nokeeplocal noforce_delete nosquash '
4209+ __flags_definedNames=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote nokeepremote keepremote keeplocal nokeeplocal keeplocal force_delete noforce_delete force_delete squash '
4210+ '[' 1 -eq 1 ']'
4211+ '[' 0 -eq 0 ']'
4212+ __flags_definedNames=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote nokeepremote keepremote keeplocal nokeeplocal keeplocal force_delete noforce_delete force_delete squash nosquash '
4213+ __flags_definedNames=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote nokeepremote keepremote keeplocal nokeeplocal keeplocal force_delete noforce_delete force_delete squash nosquash squash '
4214+ '[' 1 -eq 1 ']'
4215+ '[' 0 -eq 1 ']'
4216+ flags_return=0
4217+ unset _flags_default_ _flags_help_ _flags_name_ _flags_return_ _flags_short_ _flags_type_ _flags_usName_
4218+ '[' 0 -eq 2 ']'
4219+ return 0
4220+ DEFINE_boolean squash-info false 'add branch info during squash'
4221+ _flags_define 1 squash-info false 'add branch info during squash'
4222+ '[' 4 -lt 4 ']'
4223+ _flags_type_=1
4224+ _flags_name_=squash-info
4225+ _flags_default_=false
4226+ _flags_help_='add branch info during squash'
4227+ _flags_short_='~'
4228+ _flags_return_=0
4229_flags_removeExclamationName ${_flags_name_}
4230++ _flags_removeExclamationName squash-info
4231++ _flags_opt_=squash-info
4232++ _flags_isNegate squash-info
4233++ case $1 in
4234++ flags_return=0
4235++ return 0
4236++ echo squash-info
4237++ unset _flags_opt_
4238++ return 0
4239+ _flags_usName_=squash-info
4240_flags_underscoreName ${_flags_usName_}
4241++ _flags_underscoreName squash-info
4242++ echo squash-info
4243++ tr - _
4244+ _flags_usName_=squash_info
4245+ _flags_itemInList squash_info ' ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE  VERSION '
4246+ _flags_str_=squash_info
4247+ shift
4248+ _flags_list_='  ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE  VERSION  '
4249+ case ${_flags_list_} in
4250+ flags_return=1
4251+ unset _flags_str_ _flags_list_
4252+ return 1
4253+ '[' 1 -eq 0 ']'
4254+ '[' 0 -eq 0 -a 1 -ne 1 -a '~' = '~' ']'
4255+ '[' 0 -eq 0 ']'
4256+ _flags_itemInList squash_info showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote nokeepremote keepremote keeplocal nokeeplocal keeplocal force_delete noforce_delete force_delete squash nosquash squash
4257+ _flags_str_=squash_info
4258+ shift
4259+ _flags_list_=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote nokeepremote keepremote keeplocal nokeeplocal keeplocal force_delete noforce_delete force_delete squash nosquash squash '
4260+ case ${_flags_list_} in
4261+ flags_return=1
4262+ unset _flags_str_ _flags_list_
4263+ return 1
4264+ '[' 0 -eq 0 -a '~' '!=' '~' ']'
4265+ '[' 0 -eq 0 ']'
4266+ case ${_flags_type_} in
4267+ _flags_validBool false
4268+ _flags_bool_=false
4269+ flags_return=0
4270+ case "${_flags_bool_}" in
4271+ unset _flags_bool_
4272+ return 0
4273+ case ${_flags_default_} in
4274+ _flags_default_=1
4275+ _flags_isNegate squash-info
4276+ case $1 in
4277+ flags_return=0
4278+ return 0
4279+ _flags_isNegate_=0
4280+ '[' 0 -eq 0 ']'
4281+ eval 'FLAGS_squash_info='\''1'\'''
4282FLAGS_squash_info='1'
4283++ FLAGS_squash_info=1
4284+ eval __flags_squash_info_type=1
4285__flags_squash_info_type=1
4286++ __flags_squash_info_type=1
4287+ eval '__flags_squash_info_default="1"'
4288__flags_squash_info_default="1"
4289++ __flags_squash_info_default=1
4290+ eval '__flags_squash_info_help="add branch info during squash"'
4291__flags_squash_info_help="add branch info during squash"
4292++ __flags_squash_info_help='add branch info during squash'
4293+ eval '__flags_squash_info_short='\''~'\'''
4294__flags_squash_info_short='~'
4295++ __flags_squash_info_short='~'
4296+ __flags_shortNames=' ~ F r p k ~ ~ D S ~ '
4297_flags_removeExclamationName ${_flags_name_}
4298++ _flags_removeExclamationName squash-info
4299++ _flags_opt_=squash-info
4300++ _flags_isNegate squash-info
4301++ case $1 in
4302++ flags_return=0
4303++ return 0
4304++ echo squash-info
4305++ unset _flags_opt_
4306++ return 0
4307+ __flags_longNames=' showcommands fetch rebase preserve-merges keep keepremote keeplocal force_delete squash squash-info '
4308+ '[' 1 -eq 1 -a 0 -eq 0 ']'
4309+ __flags_boolNames=' noshowcommands nofetch norebase nopreserve-merges nokeep nokeepremote nokeeplocal noforce_delete nosquash nosquash-info '
4310+ __flags_definedNames=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote nokeepremote keepremote keeplocal nokeeplocal keeplocal force_delete noforce_delete force_delete squash nosquash squash squash_info '
4311+ '[' 1 -eq 1 ']'
4312+ '[' 0 -eq 0 ']'
4313+ __flags_definedNames=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote nokeepremote keepremote keeplocal nokeeplocal keeplocal force_delete noforce_delete force_delete squash nosquash squash squash_info nosquash_info '
4314+ __flags_definedNames=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote nokeepremote keepremote keeplocal nokeeplocal keeplocal force_delete noforce_delete force_delete squash nosquash squash squash_info nosquash_info squash_info '
4315+ '[' 1 -eq 1 ']'
4316+ '[' 0 -eq 1 ']'
4317+ flags_return=0
4318+ unset _flags_default_ _flags_help_ _flags_name_ _flags_return_ _flags_short_ _flags_type_ _flags_usName_
4319+ '[' 0 -eq 2 ']'
4320+ return 0
4321+ DEFINE_boolean 'no-ff!' false 'Don'\''t fast-forward ever during merge '
4322+ _flags_define 1 'no-ff!' false 'Don'\''t fast-forward ever during merge '
4323+ '[' 4 -lt 4 ']'
4324+ _flags_type_=1
4325+ _flags_name_='no-ff!'
4326+ _flags_default_=false
4327+ _flags_help_='Don'\''t fast-forward ever during merge '
4328+ _flags_short_='~'
4329+ _flags_return_=0
4330_flags_removeExclamationName ${_flags_name_}
4331++ _flags_removeExclamationName 'no-ff!'
4332++ _flags_opt_='no-ff!'
4333++ _flags_isNegate 'no-ff!'
4334++ case $1 in
4335++ flags_return=1
4336++ return 1
4337++ _flags_useBuiltin
4338++ return 0
4339++ echo no-ff
4340++ unset _flags_opt_
4341++ return 0
4342+ _flags_usName_=no-ff
4343_flags_underscoreName ${_flags_usName_}
4344++ _flags_underscoreName no-ff
4345++ echo no-ff
4346++ tr - _
4347+ _flags_usName_=no_ff
4348+ _flags_itemInList no_ff ' ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE  VERSION '
4349+ _flags_str_=no_ff
4350+ shift
4351+ _flags_list_='  ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE  VERSION  '
4352+ case ${_flags_list_} in
4353+ flags_return=1
4354+ unset _flags_str_ _flags_list_
4355+ return 1
4356+ '[' 1 -eq 0 ']'
4357+ '[' 0 -eq 0 -a 1 -ne 1 -a '~' = '~' ']'
4358+ '[' 0 -eq 0 ']'
4359+ _flags_itemInList no_ff showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote nokeepremote keepremote keeplocal nokeeplocal keeplocal force_delete noforce_delete force_delete squash nosquash squash squash_info nosquash_info squash_info
4360+ _flags_str_=no_ff
4361+ shift
4362+ _flags_list_=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote nokeepremote keepremote keeplocal nokeeplocal keeplocal force_delete noforce_delete force_delete squash nosquash squash squash_info nosquash_info squash_info '
4363+ case ${_flags_list_} in
4364+ flags_return=1
4365+ unset _flags_str_ _flags_list_
4366+ return 1
4367+ '[' 0 -eq 0 -a '~' '!=' '~' ']'
4368+ '[' 0 -eq 0 ']'
4369+ case ${_flags_type_} in
4370+ _flags_validBool false
4371+ _flags_bool_=false
4372+ flags_return=0
4373+ case "${_flags_bool_}" in
4374+ unset _flags_bool_
4375+ return 0
4376+ case ${_flags_default_} in
4377+ _flags_default_=1
4378+ _flags_isNegate 'no-ff!'
4379+ case $1 in
4380+ flags_return=1
4381+ return 1
4382+ _flags_isNegate_=1
4383+ '[' 0 -eq 0 ']'
4384+ eval 'FLAGS_no_ff='\''1'\'''
4385FLAGS_no_ff='1'
4386++ FLAGS_no_ff=1
4387+ eval __flags_no_ff_type=1
4388__flags_no_ff_type=1
4389++ __flags_no_ff_type=1
4390+ eval '__flags_no_ff_default="1"'
4391__flags_no_ff_default="1"
4392++ __flags_no_ff_default=1
4393+ eval '__flags_no_ff_help="Don'\''t fast-forward ever during merge "'
4394__flags_no_ff_help="Don't fast-forward ever during merge "
4395++ __flags_no_ff_help='Don'\''t fast-forward ever during merge '
4396+ eval '__flags_no_ff_short='\''~'\'''
4397__flags_no_ff_short='~'
4398++ __flags_no_ff_short='~'
4399+ __flags_shortNames=' ~ F r p k ~ ~ D S ~ ~ '
4400_flags_removeExclamationName ${_flags_name_}
4401++ _flags_removeExclamationName 'no-ff!'
4402++ _flags_opt_='no-ff!'
4403++ _flags_isNegate 'no-ff!'
4404++ case $1 in
4405++ flags_return=1
4406++ return 1
4407++ _flags_useBuiltin
4408++ return 0
4409++ echo no-ff
4410++ unset _flags_opt_
4411++ return 0
4412+ __flags_longNames=' showcommands fetch rebase preserve-merges keep keepremote keeplocal force_delete squash squash-info no-ff '
4413+ '[' 1 -eq 1 -a 1 -eq 0 ']'
4414+ __flags_definedNames=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote nokeepremote keepremote keeplocal nokeeplocal keeplocal force_delete noforce_delete force_delete squash nosquash squash squash_info nosquash_info squash_info no_ff '
4415+ '[' 1 -eq 1 ']'
4416+ '[' 1 -eq 0 ']'
4417+ __flags_definedNames=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote nokeepremote keepremote keeplocal nokeeplocal keeplocal force_delete noforce_delete force_delete squash nosquash squash squash_info nosquash_info squash_info no_ff no_ff '
4418+ '[' 1 -eq 1 ']'
4419+ '[' 1 -eq 1 ']'
4420_flags_removeExclamationName ${_flags_name_}
4421++ _flags_removeExclamationName 'no-ff!'
4422++ _flags_opt_='no-ff!'
4423++ _flags_isNegate 'no-ff!'
4424++ case $1 in
4425++ flags_return=1
4426++ return 1
4427++ _flags_useBuiltin
4428++ return 0
4429++ echo no-ff
4430++ unset _flags_opt_
4431++ return 0
4432+ __flags_nonegateNames=' no-ff '
4433+ flags_return=0
4434+ unset _flags_default_ _flags_help_ _flags_name_ _flags_return_ _flags_short_ _flags_type_ _flags_usName_
4435+ '[' 0 -eq 2 ']'
4436+ return 0
4437+ gitflow_override_flag_boolean feature.finish.fetch fetch
4438+ local _variable
4439git config --bool --get gitflow.$1 2>&1
4440++ git config --bool --get gitflow.feature.finish.fetch
4441+ _variable=
4442+ case $? in
4443+ unset _variable
4444+ return 0
4445+ gitflow_override_flag_boolean feature.finish.rebase rebase
4446+ local _variable
4447git config --bool --get gitflow.$1 2>&1
4448++ git config --bool --get gitflow.feature.finish.rebase
4449+ _variable=
4450+ case $? in
4451+ unset _variable
4452+ return 0
4453+ gitflow_override_flag_boolean feature.finish.preserve-merges preserve_merges
4454+ local _variable
4455git config --bool --get gitflow.$1 2>&1
4456++ git config --bool --get gitflow.feature.finish.preserve-merges
4457+ _variable=
4458+ case $? in
4459+ unset _variable
4460+ return 0
4461+ gitflow_override_flag_boolean feature.finish.keep keep
4462+ local _variable
4463git config --bool --get gitflow.$1 2>&1
4464++ git config --bool --get gitflow.feature.finish.keep
4465+ _variable=
4466+ case $? in
4467+ unset _variable
4468+ return 0
4469+ gitflow_override_flag_boolean feature.finish.keepremote keepremote
4470+ local _variable
4471git config --bool --get gitflow.$1 2>&1
4472++ git config --bool --get gitflow.feature.finish.keepremote
4473+ _variable=
4474+ case $? in
4475+ unset _variable
4476+ return 0
4477+ gitflow_override_flag_boolean feature.finish.keeplocal keeplocal
4478+ local _variable
4479git config --bool --get gitflow.$1 2>&1
4480++ git config --bool --get gitflow.feature.finish.keeplocal
4481+ _variable=
4482+ case $? in
4483+ unset _variable
4484+ return 0
4485+ gitflow_override_flag_boolean feature.finish.force-delete force_delete
4486+ local _variable
4487git config --bool --get gitflow.$1 2>&1
4488++ git config --bool --get gitflow.feature.finish.force-delete
4489+ _variable=
4490+ case $? in
4491+ unset _variable
4492+ return 0
4493+ gitflow_override_flag_boolean feature.finish.squash squash
4494+ local _variable
4495git config --bool --get gitflow.$1 2>&1
4496++ git config --bool --get gitflow.feature.finish.squash
4497+ _variable=
4498+ case $? in
4499+ unset _variable
4500+ return 0
4501+ gitflow_override_flag_boolean feature.finish.squash-info squash_info
4502+ local _variable
4503git config --bool --get gitflow.$1 2>&1
4504++ git config --bool --get gitflow.feature.finish.squash-info
4505+ _variable=
4506+ case $? in
4507+ unset _variable
4508+ return 0
4509+ gitflow_override_flag_boolean feature.finish.no-ff no_ff
4510+ local _variable
4511git config --bool --get gitflow.$1 2>&1
4512++ git config --bool --get gitflow.feature.finish.no-ff
4513+ _variable=
4514+ case $? in
4515+ unset _variable
4516+ return 0
4517+ parse_args f3 ''
4518+ FLAGS f3 ''
4519+ '[' -z '' ']'
4520+ DEFINE_boolean 'help!' false 'show this help' h
4521+ _flags_define 1 'help!' false 'show this help' h
4522+ '[' 5 -lt 4 ']'
4523+ _flags_type_=1
4524+ _flags_name_='help!'
4525+ _flags_default_=false
4526+ _flags_help_='show this help'
4527+ _flags_short_=h
4528+ _flags_return_=0
4529_flags_removeExclamationName ${_flags_name_}
4530++ _flags_removeExclamationName 'help!'
4531++ _flags_opt_='help!'
4532++ _flags_isNegate 'help!'
4533++ case $1 in
4534++ flags_return=1
4535++ return 1
4536++ _flags_useBuiltin
4537++ return 0
4538++ echo help
4539++ unset _flags_opt_
4540++ return 0
4541+ _flags_usName_=help
4542_flags_underscoreName ${_flags_usName_}
4543++ _flags_underscoreName help
4544++ echo help
4545++ tr - _
4546+ _flags_usName_=help
4547+ _flags_itemInList help ' ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE  VERSION '
4548+ _flags_str_=help
4549+ shift
4550+ _flags_list_='  ARGC ARGV ERROR FALSE GETOPT_CMD HELP PARENT TRUE  VERSION  '
4551+ case ${_flags_list_} in
4552+ flags_return=1
4553+ unset _flags_str_ _flags_list_
4554+ return 1
4555+ '[' 1 -eq 0 ']'
4556+ '[' 0 -eq 0 -a 1 -ne 1 -a h = '~' ']'
4557+ '[' 0 -eq 0 ']'
4558+ _flags_itemInList help showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote nokeepremote keepremote keeplocal nokeeplocal keeplocal force_delete noforce_delete force_delete squash nosquash squash squash_info nosquash_info squash_info no_ff no_ff
4559+ _flags_str_=help
4560+ shift
4561+ _flags_list_=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote nokeepremote keepremote keeplocal nokeeplocal keeplocal force_delete noforce_delete force_delete squash nosquash squash squash_info nosquash_info squash_info no_ff no_ff '
4562+ case ${_flags_list_} in
4563+ flags_return=1
4564+ unset _flags_str_ _flags_list_
4565+ return 1
4566+ '[' 0 -eq 0 -a h '!=' '~' ']'
4567+ _flags_itemInList h '~' F r p k '~' '~' D S '~' '~'
4568+ _flags_str_=h
4569+ shift
4570+ _flags_list_=' ~ F r p k ~ ~ D S ~ ~ '
4571+ case ${_flags_list_} in
4572+ flags_return=1
4573+ unset _flags_str_ _flags_list_
4574+ return 1
4575+ '[' 0 -eq 0 ']'
4576+ case ${_flags_type_} in
4577+ _flags_validBool false
4578+ _flags_bool_=false
4579+ flags_return=0
4580+ case "${_flags_bool_}" in
4581+ unset _flags_bool_
4582+ return 0
4583+ case ${_flags_default_} in
4584+ _flags_default_=1
4585+ _flags_isNegate 'help!'
4586+ case $1 in
4587+ flags_return=1
4588+ return 1
4589+ _flags_isNegate_=1
4590+ '[' 0 -eq 0 ']'
4591+ eval 'FLAGS_help='\''1'\'''
4592FLAGS_help='1'
4593++ FLAGS_help=1
4594+ eval __flags_help_type=1
4595__flags_help_type=1
4596++ __flags_help_type=1
4597+ eval '__flags_help_default="1"'
4598__flags_help_default="1"
4599++ __flags_help_default=1
4600+ eval '__flags_help_help="show this help"'
4601__flags_help_help="show this help"
4602++ __flags_help_help='show this help'
4603+ eval '__flags_help_short='\''h'\'''
4604__flags_help_short='h'
4605++ __flags_help_short=h
4606+ __flags_shortNames=' ~ F r p k ~ ~ D S ~ ~ h '
4607_flags_removeExclamationName ${_flags_name_}
4608++ _flags_removeExclamationName 'help!'
4609++ _flags_opt_='help!'
4610++ _flags_isNegate 'help!'
4611++ case $1 in
4612++ flags_return=1
4613++ return 1
4614++ _flags_useBuiltin
4615++ return 0
4616++ echo help
4617++ unset _flags_opt_
4618++ return 0
4619+ __flags_longNames=' showcommands fetch rebase preserve-merges keep keepremote keeplocal force_delete squash squash-info no-ff help '
4620+ '[' 1 -eq 1 -a 1 -eq 0 ']'
4621+ __flags_definedNames=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote nokeepremote keepremote keeplocal nokeeplocal keeplocal force_delete noforce_delete force_delete squash nosquash squash squash_info nosquash_info squash_info no_ff no_ff help '
4622+ '[' 1 -eq 1 ']'
4623+ '[' 1 -eq 0 ']'
4624+ __flags_definedNames=' showcommands noshowcommands showcommands fetch nofetch fetch rebase norebase rebase preserve_merges nopreserve_merges preserve_merges keep nokeep keep keepremote nokeepremote keepremote keeplocal nokeeplocal keeplocal force_delete noforce_delete force_delete squash nosquash squash squash_info nosquash_info squash_info no_ff no_ff help help '
4625+ '[' 1 -eq 1 ']'
4626+ '[' 1 -eq 1 ']'
4627_flags_removeExclamationName ${_flags_name_}
4628++ _flags_removeExclamationName 'help!'
4629++ _flags_opt_='help!'
4630++ _flags_isNegate 'help!'
4631++ case $1 in
4632++ flags_return=1
4633++ return 1
4634++ _flags_useBuiltin
4635++ return 0
4636++ echo help
4637++ unset _flags_opt_
4638++ return 0
4639+ __flags_nonegateNames=' no-ff help '
4640+ flags_return=0
4641+ unset _flags_default_ _flags_help_ _flags_name_ _flags_return_ _flags_short_ _flags_type_ _flags_usName_
4642+ '[' 0 -eq 2 ']'
4643+ return 0
4644+ '[' 2 -gt 0 ']'
4645+ '[' 1 -ne 1 ']'
4646+ _flags_getoptEnhanced f3 ''
4647+ flags_return=0
4648_flags_genOptStr ${__FLAGS_OPTSTR_SHORT}
4649++ _flags_genOptStr 0
4650++ _flags_optStrType_=0
4651++ _flags_opts_=
4652++ for _flags_name_ in '${__flags_longNames}'
4653_flags_removeExclamationName ${_flags_name_}
4654+++ _flags_removeExclamationName showcommands
4655+++ _flags_opt_=showcommands
4656+++ _flags_isNegate showcommands
4657+++ case $1 in
4658+++ flags_return=0
4659+++ return 0
4660+++ echo showcommands
4661+++ unset _flags_opt_
4662+++ return 0
4663++ _flags_usName_=showcommands
4664_flags_underscoreName ${_flags_usName_}
4665+++ _flags_underscoreName showcommands
4666+++ echo showcommands
4667+++ tr - _
4668++ _flags_usName_=showcommands
4669_flags_getFlagInfo ${_flags_usName_} ${__FLAGS_INFO_TYPE}
4670+++ _flags_getFlagInfo showcommands type
4671+++ _flags_gFI_usName_=showcommands
4672+++ _flags_gFI_info_=type
4673+++ _flags_infoVar_=__flags_showcommands_type
4674+++ _flags_strToEval_='_flags_infoValue_="${__flags_showcommands_type:-}"'
4675+++ eval '_flags_infoValue_="${__flags_showcommands_type:-}"'
4676_flags_infoValue_="${__flags_showcommands_type:-}"
4677++++ _flags_infoValue_=1
4678+++ '[' -n 1 ']'
4679+++ flags_return=0
4680+++ echo 1
4681+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
4682+++ '[' 0 -eq 2 ']'
4683+++ return 0
4684++ _flags_type_=1
4685++ '[' 0 -eq 0 ']'
4686++ case ${_flags_optStrType_} in
4687_flags_getFlagInfo             ${_flags_usName_} ${__FLAGS_INFO_SHORT}
4688+++ _flags_getFlagInfo showcommands short
4689+++ _flags_gFI_usName_=showcommands
4690+++ _flags_gFI_info_=short
4691+++ _flags_infoVar_=__flags_showcommands_short
4692+++ _flags_strToEval_='_flags_infoValue_="${__flags_showcommands_short:-}"'
4693+++ eval '_flags_infoValue_="${__flags_showcommands_short:-}"'
4694_flags_infoValue_="${__flags_showcommands_short:-}"
4695++++ _flags_infoValue_='~'
4696+++ '[' -n '~' ']'
4697+++ flags_return=0
4698+++ echo '~'
4699+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
4700+++ '[' 0 -eq 2 ']'
4701+++ return 0
4702++ _flags_shortName_='~'
4703++ '[' '~' '!=' '~' ']'
4704++ for _flags_name_ in '${__flags_longNames}'
4705_flags_removeExclamationName ${_flags_name_}
4706+++ _flags_removeExclamationName fetch
4707+++ _flags_opt_=fetch
4708+++ _flags_isNegate fetch
4709+++ case $1 in
4710+++ flags_return=0
4711+++ return 0
4712+++ echo fetch
4713+++ unset _flags_opt_
4714+++ return 0
4715++ _flags_usName_=fetch
4716_flags_underscoreName ${_flags_usName_}
4717+++ _flags_underscoreName fetch
4718+++ echo fetch
4719+++ tr - _
4720++ _flags_usName_=fetch
4721_flags_getFlagInfo ${_flags_usName_} ${__FLAGS_INFO_TYPE}
4722+++ _flags_getFlagInfo fetch type
4723+++ _flags_gFI_usName_=fetch
4724+++ _flags_gFI_info_=type
4725+++ _flags_infoVar_=__flags_fetch_type
4726+++ _flags_strToEval_='_flags_infoValue_="${__flags_fetch_type:-}"'
4727+++ eval '_flags_infoValue_="${__flags_fetch_type:-}"'
4728_flags_infoValue_="${__flags_fetch_type:-}"
4729++++ _flags_infoValue_=1
4730+++ '[' -n 1 ']'
4731+++ flags_return=0
4732+++ echo 1
4733+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
4734+++ '[' 0 -eq 2 ']'
4735+++ return 0
4736++ _flags_type_=1
4737++ '[' 0 -eq 0 ']'
4738++ case ${_flags_optStrType_} in
4739_flags_getFlagInfo             ${_flags_usName_} ${__FLAGS_INFO_SHORT}
4740+++ _flags_getFlagInfo fetch short
4741+++ _flags_gFI_usName_=fetch
4742+++ _flags_gFI_info_=short
4743+++ _flags_infoVar_=__flags_fetch_short
4744+++ _flags_strToEval_='_flags_infoValue_="${__flags_fetch_short:-}"'
4745+++ eval '_flags_infoValue_="${__flags_fetch_short:-}"'
4746_flags_infoValue_="${__flags_fetch_short:-}"
4747++++ _flags_infoValue_=F
4748+++ '[' -n F ']'
4749+++ flags_return=0
4750+++ echo F
4751+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
4752+++ '[' 0 -eq 2 ']'
4753+++ return 0
4754++ _flags_shortName_=F
4755++ '[' F '!=' '~' ']'
4756++ _flags_opts_=F
4757++ '[' 1 -ne 1 ']'
4758++ for _flags_name_ in '${__flags_longNames}'
4759_flags_removeExclamationName ${_flags_name_}
4760+++ _flags_removeExclamationName rebase
4761+++ _flags_opt_=rebase
4762+++ _flags_isNegate rebase
4763+++ case $1 in
4764+++ flags_return=0
4765+++ return 0
4766+++ echo rebase
4767+++ unset _flags_opt_
4768+++ return 0
4769++ _flags_usName_=rebase
4770_flags_underscoreName ${_flags_usName_}
4771+++ _flags_underscoreName rebase
4772+++ echo rebase
4773+++ tr - _
4774++ _flags_usName_=rebase
4775_flags_getFlagInfo ${_flags_usName_} ${__FLAGS_INFO_TYPE}
4776+++ _flags_getFlagInfo rebase type
4777+++ _flags_gFI_usName_=rebase
4778+++ _flags_gFI_info_=type
4779+++ _flags_infoVar_=__flags_rebase_type
4780+++ _flags_strToEval_='_flags_infoValue_="${__flags_rebase_type:-}"'
4781+++ eval '_flags_infoValue_="${__flags_rebase_type:-}"'
4782_flags_infoValue_="${__flags_rebase_type:-}"
4783++++ _flags_infoValue_=1
4784+++ '[' -n 1 ']'
4785+++ flags_return=0
4786+++ echo 1
4787+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
4788+++ '[' 0 -eq 2 ']'
4789+++ return 0
4790++ _flags_type_=1
4791++ '[' 0 -eq 0 ']'
4792++ case ${_flags_optStrType_} in
4793_flags_getFlagInfo             ${_flags_usName_} ${__FLAGS_INFO_SHORT}
4794+++ _flags_getFlagInfo rebase short
4795+++ _flags_gFI_usName_=rebase
4796+++ _flags_gFI_info_=short
4797+++ _flags_infoVar_=__flags_rebase_short
4798+++ _flags_strToEval_='_flags_infoValue_="${__flags_rebase_short:-}"'
4799+++ eval '_flags_infoValue_="${__flags_rebase_short:-}"'
4800_flags_infoValue_="${__flags_rebase_short:-}"
4801++++ _flags_infoValue_=r
4802+++ '[' -n r ']'
4803+++ flags_return=0
4804+++ echo r
4805+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
4806+++ '[' 0 -eq 2 ']'
4807+++ return 0
4808++ _flags_shortName_=r
4809++ '[' r '!=' '~' ']'
4810++ _flags_opts_=Fr
4811++ '[' 1 -ne 1 ']'
4812++ for _flags_name_ in '${__flags_longNames}'
4813_flags_removeExclamationName ${_flags_name_}
4814+++ _flags_removeExclamationName preserve-merges
4815+++ _flags_opt_=preserve-merges
4816+++ _flags_isNegate preserve-merges
4817+++ case $1 in
4818+++ flags_return=0
4819+++ return 0
4820+++ echo preserve-merges
4821+++ unset _flags_opt_
4822+++ return 0
4823++ _flags_usName_=preserve-merges
4824_flags_underscoreName ${_flags_usName_}
4825+++ _flags_underscoreName preserve-merges
4826+++ echo preserve-merges
4827+++ tr - _
4828++ _flags_usName_=preserve_merges
4829_flags_getFlagInfo ${_flags_usName_} ${__FLAGS_INFO_TYPE}
4830+++ _flags_getFlagInfo preserve_merges type
4831+++ _flags_gFI_usName_=preserve_merges
4832+++ _flags_gFI_info_=type
4833+++ _flags_infoVar_=__flags_preserve_merges_type
4834+++ _flags_strToEval_='_flags_infoValue_="${__flags_preserve_merges_type:-}"'
4835+++ eval '_flags_infoValue_="${__flags_preserve_merges_type:-}"'
4836_flags_infoValue_="${__flags_preserve_merges_type:-}"
4837++++ _flags_infoValue_=1
4838+++ '[' -n 1 ']'
4839+++ flags_return=0
4840+++ echo 1
4841+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
4842+++ '[' 0 -eq 2 ']'
4843+++ return 0
4844++ _flags_type_=1
4845++ '[' 0 -eq 0 ']'
4846++ case ${_flags_optStrType_} in
4847_flags_getFlagInfo             ${_flags_usName_} ${__FLAGS_INFO_SHORT}
4848+++ _flags_getFlagInfo preserve_merges short
4849+++ _flags_gFI_usName_=preserve_merges
4850+++ _flags_gFI_info_=short
4851+++ _flags_infoVar_=__flags_preserve_merges_short
4852+++ _flags_strToEval_='_flags_infoValue_="${__flags_preserve_merges_short:-}"'
4853+++ eval '_flags_infoValue_="${__flags_preserve_merges_short:-}"'
4854_flags_infoValue_="${__flags_preserve_merges_short:-}"
4855++++ _flags_infoValue_=p
4856+++ '[' -n p ']'
4857+++ flags_return=0
4858+++ echo p
4859+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
4860+++ '[' 0 -eq 2 ']'
4861+++ return 0
4862++ _flags_shortName_=p
4863++ '[' p '!=' '~' ']'
4864++ _flags_opts_=Frp
4865++ '[' 1 -ne 1 ']'
4866++ for _flags_name_ in '${__flags_longNames}'
4867_flags_removeExclamationName ${_flags_name_}
4868+++ _flags_removeExclamationName keep
4869+++ _flags_opt_=keep
4870+++ _flags_isNegate keep
4871+++ case $1 in
4872+++ flags_return=0
4873+++ return 0
4874+++ echo keep
4875+++ unset _flags_opt_
4876+++ return 0
4877++ _flags_usName_=keep
4878_flags_underscoreName ${_flags_usName_}
4879+++ _flags_underscoreName keep
4880+++ echo keep
4881+++ tr - _
4882++ _flags_usName_=keep
4883_flags_getFlagInfo ${_flags_usName_} ${__FLAGS_INFO_TYPE}
4884+++ _flags_getFlagInfo keep type
4885+++ _flags_gFI_usName_=keep
4886+++ _flags_gFI_info_=type
4887+++ _flags_infoVar_=__flags_keep_type
4888+++ _flags_strToEval_='_flags_infoValue_="${__flags_keep_type:-}"'
4889+++ eval '_flags_infoValue_="${__flags_keep_type:-}"'
4890_flags_infoValue_="${__flags_keep_type:-}"
4891++++ _flags_infoValue_=1
4892+++ '[' -n 1 ']'
4893+++ flags_return=0
4894+++ echo 1
4895+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
4896+++ '[' 0 -eq 2 ']'
4897+++ return 0
4898++ _flags_type_=1
4899++ '[' 0 -eq 0 ']'
4900++ case ${_flags_optStrType_} in
4901_flags_getFlagInfo             ${_flags_usName_} ${__FLAGS_INFO_SHORT}
4902+++ _flags_getFlagInfo keep short
4903+++ _flags_gFI_usName_=keep
4904+++ _flags_gFI_info_=short
4905+++ _flags_infoVar_=__flags_keep_short
4906+++ _flags_strToEval_='_flags_infoValue_="${__flags_keep_short:-}"'
4907+++ eval '_flags_infoValue_="${__flags_keep_short:-}"'
4908_flags_infoValue_="${__flags_keep_short:-}"
4909++++ _flags_infoValue_=k
4910+++ '[' -n k ']'
4911+++ flags_return=0
4912+++ echo k
4913+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
4914+++ '[' 0 -eq 2 ']'
4915+++ return 0
4916++ _flags_shortName_=k
4917++ '[' k '!=' '~' ']'
4918++ _flags_opts_=Frpk
4919++ '[' 1 -ne 1 ']'
4920++ for _flags_name_ in '${__flags_longNames}'
4921_flags_removeExclamationName ${_flags_name_}
4922+++ _flags_removeExclamationName keepremote
4923+++ _flags_opt_=keepremote
4924+++ _flags_isNegate keepremote
4925+++ case $1 in
4926+++ flags_return=0
4927+++ return 0
4928+++ echo keepremote
4929+++ unset _flags_opt_
4930+++ return 0
4931++ _flags_usName_=keepremote
4932_flags_underscoreName ${_flags_usName_}
4933+++ _flags_underscoreName keepremote
4934+++ echo keepremote
4935+++ tr - _
4936++ _flags_usName_=keepremote
4937_flags_getFlagInfo ${_flags_usName_} ${__FLAGS_INFO_TYPE}
4938+++ _flags_getFlagInfo keepremote type
4939+++ _flags_gFI_usName_=keepremote
4940+++ _flags_gFI_info_=type
4941+++ _flags_infoVar_=__flags_keepremote_type
4942+++ _flags_strToEval_='_flags_infoValue_="${__flags_keepremote_type:-}"'
4943+++ eval '_flags_infoValue_="${__flags_keepremote_type:-}"'
4944_flags_infoValue_="${__flags_keepremote_type:-}"
4945++++ _flags_infoValue_=1
4946+++ '[' -n 1 ']'
4947+++ flags_return=0
4948+++ echo 1
4949+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
4950+++ '[' 0 -eq 2 ']'
4951+++ return 0
4952++ _flags_type_=1
4953++ '[' 0 -eq 0 ']'
4954++ case ${_flags_optStrType_} in
4955_flags_getFlagInfo             ${_flags_usName_} ${__FLAGS_INFO_SHORT}
4956+++ _flags_getFlagInfo keepremote short
4957+++ _flags_gFI_usName_=keepremote
4958+++ _flags_gFI_info_=short
4959+++ _flags_infoVar_=__flags_keepremote_short
4960+++ _flags_strToEval_='_flags_infoValue_="${__flags_keepremote_short:-}"'
4961+++ eval '_flags_infoValue_="${__flags_keepremote_short:-}"'
4962_flags_infoValue_="${__flags_keepremote_short:-}"
4963++++ _flags_infoValue_='~'
4964+++ '[' -n '~' ']'
4965+++ flags_return=0
4966+++ echo '~'
4967+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
4968+++ '[' 0 -eq 2 ']'
4969+++ return 0
4970++ _flags_shortName_='~'
4971++ '[' '~' '!=' '~' ']'
4972++ for _flags_name_ in '${__flags_longNames}'
4973_flags_removeExclamationName ${_flags_name_}
4974+++ _flags_removeExclamationName keeplocal
4975+++ _flags_opt_=keeplocal
4976+++ _flags_isNegate keeplocal
4977+++ case $1 in
4978+++ flags_return=0
4979+++ return 0
4980+++ echo keeplocal
4981+++ unset _flags_opt_
4982+++ return 0
4983++ _flags_usName_=keeplocal
4984_flags_underscoreName ${_flags_usName_}
4985+++ _flags_underscoreName keeplocal
4986+++ echo keeplocal
4987+++ tr - _
4988++ _flags_usName_=keeplocal
4989_flags_getFlagInfo ${_flags_usName_} ${__FLAGS_INFO_TYPE}
4990+++ _flags_getFlagInfo keeplocal type
4991+++ _flags_gFI_usName_=keeplocal
4992+++ _flags_gFI_info_=type
4993+++ _flags_infoVar_=__flags_keeplocal_type
4994+++ _flags_strToEval_='_flags_infoValue_="${__flags_keeplocal_type:-}"'
4995+++ eval '_flags_infoValue_="${__flags_keeplocal_type:-}"'
4996_flags_infoValue_="${__flags_keeplocal_type:-}"
4997++++ _flags_infoValue_=1
4998+++ '[' -n 1 ']'
4999+++ flags_return=0
5000+++ echo 1
5001+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
5002+++ '[' 0 -eq 2 ']'
5003+++ return 0
5004++ _flags_type_=1
5005++ '[' 0 -eq 0 ']'
5006++ case ${_flags_optStrType_} in
5007_flags_getFlagInfo             ${_flags_usName_} ${__FLAGS_INFO_SHORT}
5008+++ _flags_getFlagInfo keeplocal short
5009+++ _flags_gFI_usName_=keeplocal
5010+++ _flags_gFI_info_=short
5011+++ _flags_infoVar_=__flags_keeplocal_short
5012+++ _flags_strToEval_='_flags_infoValue_="${__flags_keeplocal_short:-}"'
5013+++ eval '_flags_infoValue_="${__flags_keeplocal_short:-}"'
5014_flags_infoValue_="${__flags_keeplocal_short:-}"
5015++++ _flags_infoValue_='~'
5016+++ '[' -n '~' ']'
5017+++ flags_return=0
5018+++ echo '~'
5019+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
5020+++ '[' 0 -eq 2 ']'
5021+++ return 0
5022++ _flags_shortName_='~'
5023++ '[' '~' '!=' '~' ']'
5024++ for _flags_name_ in '${__flags_longNames}'
5025_flags_removeExclamationName ${_flags_name_}
5026+++ _flags_removeExclamationName force_delete
5027+++ _flags_opt_=force_delete
5028+++ _flags_isNegate force_delete
5029+++ case $1 in
5030+++ flags_return=0
5031+++ return 0
5032+++ echo force_delete
5033+++ unset _flags_opt_
5034+++ return 0
5035++ _flags_usName_=force_delete
5036_flags_underscoreName ${_flags_usName_}
5037+++ _flags_underscoreName force_delete
5038+++ echo force_delete
5039+++ tr - _
5040++ _flags_usName_=force_delete
5041_flags_getFlagInfo ${_flags_usName_} ${__FLAGS_INFO_TYPE}
5042+++ _flags_getFlagInfo force_delete type
5043+++ _flags_gFI_usName_=force_delete
5044+++ _flags_gFI_info_=type
5045+++ _flags_infoVar_=__flags_force_delete_type
5046+++ _flags_strToEval_='_flags_infoValue_="${__flags_force_delete_type:-}"'
5047+++ eval '_flags_infoValue_="${__flags_force_delete_type:-}"'
5048_flags_infoValue_="${__flags_force_delete_type:-}"
5049++++ _flags_infoValue_=1
5050+++ '[' -n 1 ']'
5051+++ flags_return=0
5052+++ echo 1
5053+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
5054+++ '[' 0 -eq 2 ']'
5055+++ return 0
5056++ _flags_type_=1
5057++ '[' 0 -eq 0 ']'
5058++ case ${_flags_optStrType_} in
5059_flags_getFlagInfo             ${_flags_usName_} ${__FLAGS_INFO_SHORT}
5060+++ _flags_getFlagInfo force_delete short
5061+++ _flags_gFI_usName_=force_delete
5062+++ _flags_gFI_info_=short
5063+++ _flags_infoVar_=__flags_force_delete_short
5064+++ _flags_strToEval_='_flags_infoValue_="${__flags_force_delete_short:-}"'
5065+++ eval '_flags_infoValue_="${__flags_force_delete_short:-}"'
5066_flags_infoValue_="${__flags_force_delete_short:-}"
5067++++ _flags_infoValue_=D
5068+++ '[' -n D ']'
5069+++ flags_return=0
5070+++ echo D
5071+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
5072+++ '[' 0 -eq 2 ']'
5073+++ return 0
5074++ _flags_shortName_=D
5075++ '[' D '!=' '~' ']'
5076++ _flags_opts_=FrpkD
5077++ '[' 1 -ne 1 ']'
5078++ for _flags_name_ in '${__flags_longNames}'
5079_flags_removeExclamationName ${_flags_name_}
5080+++ _flags_removeExclamationName squash
5081+++ _flags_opt_=squash
5082+++ _flags_isNegate squash
5083+++ case $1 in
5084+++ flags_return=0
5085+++ return 0
5086+++ echo squash
5087+++ unset _flags_opt_
5088+++ return 0
5089++ _flags_usName_=squash
5090_flags_underscoreName ${_flags_usName_}
5091+++ _flags_underscoreName squash
5092+++ echo squash
5093+++ tr - _
5094++ _flags_usName_=squash
5095_flags_getFlagInfo ${_flags_usName_} ${__FLAGS_INFO_TYPE}
5096+++ _flags_getFlagInfo squash type
5097+++ _flags_gFI_usName_=squash
5098+++ _flags_gFI_info_=type
5099+++ _flags_infoVar_=__flags_squash_type
5100+++ _flags_strToEval_='_flags_infoValue_="${__flags_squash_type:-}"'
5101+++ eval '_flags_infoValue_="${__flags_squash_type:-}"'
5102_flags_infoValue_="${__flags_squash_type:-}"
5103++++ _flags_infoValue_=1
5104+++ '[' -n 1 ']'
5105+++ flags_return=0
5106+++ echo 1
5107+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
5108+++ '[' 0 -eq 2 ']'
5109+++ return 0
5110++ _flags_type_=1
5111++ '[' 0 -eq 0 ']'
5112++ case ${_flags_optStrType_} in
5113_flags_getFlagInfo             ${_flags_usName_} ${__FLAGS_INFO_SHORT}
5114+++ _flags_getFlagInfo squash short
5115+++ _flags_gFI_usName_=squash
5116+++ _flags_gFI_info_=short
5117+++ _flags_infoVar_=__flags_squash_short
5118+++ _flags_strToEval_='_flags_infoValue_="${__flags_squash_short:-}"'
5119+++ eval '_flags_infoValue_="${__flags_squash_short:-}"'
5120_flags_infoValue_="${__flags_squash_short:-}"
5121++++ _flags_infoValue_=S
5122+++ '[' -n S ']'
5123+++ flags_return=0
5124+++ echo S
5125+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
5126+++ '[' 0 -eq 2 ']'
5127+++ return 0
5128++ _flags_shortName_=S
5129++ '[' S '!=' '~' ']'
5130++ _flags_opts_=FrpkDS
5131++ '[' 1 -ne 1 ']'
5132++ for _flags_name_ in '${__flags_longNames}'
5133_flags_removeExclamationName ${_flags_name_}
5134+++ _flags_removeExclamationName squash-info
5135+++ _flags_opt_=squash-info
5136+++ _flags_isNegate squash-info
5137+++ case $1 in
5138+++ flags_return=0
5139+++ return 0
5140+++ echo squash-info
5141+++ unset _flags_opt_
5142+++ return 0
5143++ _flags_usName_=squash-info
5144_flags_underscoreName ${_flags_usName_}
5145+++ _flags_underscoreName squash-info
5146+++ echo squash-info
5147+++ tr - _
5148++ _flags_usName_=squash_info
5149_flags_getFlagInfo ${_flags_usName_} ${__FLAGS_INFO_TYPE}
5150+++ _flags_getFlagInfo squash_info type
5151+++ _flags_gFI_usName_=squash_info
5152+++ _flags_gFI_info_=type
5153+++ _flags_infoVar_=__flags_squash_info_type
5154+++ _flags_strToEval_='_flags_infoValue_="${__flags_squash_info_type:-}"'
5155+++ eval '_flags_infoValue_="${__flags_squash_info_type:-}"'
5156_flags_infoValue_="${__flags_squash_info_type:-}"
5157++++ _flags_infoValue_=1
5158+++ '[' -n 1 ']'
5159+++ flags_return=0
5160+++ echo 1
5161+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
5162+++ '[' 0 -eq 2 ']'
5163+++ return 0
5164++ _flags_type_=1
5165++ '[' 0 -eq 0 ']'
5166++ case ${_flags_optStrType_} in
5167_flags_getFlagInfo             ${_flags_usName_} ${__FLAGS_INFO_SHORT}
5168+++ _flags_getFlagInfo squash_info short
5169+++ _flags_gFI_usName_=squash_info
5170+++ _flags_gFI_info_=short
5171+++ _flags_infoVar_=__flags_squash_info_short
5172+++ _flags_strToEval_='_flags_infoValue_="${__flags_squash_info_short:-}"'
5173+++ eval '_flags_infoValue_="${__flags_squash_info_short:-}"'
5174_flags_infoValue_="${__flags_squash_info_short:-}"
5175++++ _flags_infoValue_='~'
5176+++ '[' -n '~' ']'
5177+++ flags_return=0
5178+++ echo '~'
5179+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
5180+++ '[' 0 -eq 2 ']'
5181+++ return 0
5182++ _flags_shortName_='~'
5183++ '[' '~' '!=' '~' ']'
5184++ for _flags_name_ in '${__flags_longNames}'
5185_flags_removeExclamationName ${_flags_name_}
5186+++ _flags_removeExclamationName no-ff
5187+++ _flags_opt_=no-ff
5188+++ _flags_isNegate no-ff
5189+++ case $1 in
5190+++ flags_return=0
5191+++ return 0
5192+++ echo no-ff
5193+++ unset _flags_opt_
5194+++ return 0
5195++ _flags_usName_=no-ff
5196_flags_underscoreName ${_flags_usName_}
5197+++ _flags_underscoreName no-ff
5198+++ echo no-ff
5199+++ tr - _
5200++ _flags_usName_=no_ff
5201_flags_getFlagInfo ${_flags_usName_} ${__FLAGS_INFO_TYPE}
5202+++ _flags_getFlagInfo no_ff type
5203+++ _flags_gFI_usName_=no_ff
5204+++ _flags_gFI_info_=type
5205+++ _flags_infoVar_=__flags_no_ff_type
5206+++ _flags_strToEval_='_flags_infoValue_="${__flags_no_ff_type:-}"'
5207+++ eval '_flags_infoValue_="${__flags_no_ff_type:-}"'
5208_flags_infoValue_="${__flags_no_ff_type:-}"
5209++++ _flags_infoValue_=1
5210+++ '[' -n 1 ']'
5211+++ flags_return=0
5212+++ echo 1
5213+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
5214+++ '[' 0 -eq 2 ']'
5215+++ return 0
5216++ _flags_type_=1
5217++ '[' 0 -eq 0 ']'
5218++ case ${_flags_optStrType_} in
5219_flags_getFlagInfo             ${_flags_usName_} ${__FLAGS_INFO_SHORT}
5220+++ _flags_getFlagInfo no_ff short
5221+++ _flags_gFI_usName_=no_ff
5222+++ _flags_gFI_info_=short
5223+++ _flags_infoVar_=__flags_no_ff_short
5224+++ _flags_strToEval_='_flags_infoValue_="${__flags_no_ff_short:-}"'
5225+++ eval '_flags_infoValue_="${__flags_no_ff_short:-}"'
5226_flags_infoValue_="${__flags_no_ff_short:-}"
5227++++ _flags_infoValue_='~'
5228+++ '[' -n '~' ']'
5229+++ flags_return=0
5230+++ echo '~'
5231+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
5232+++ '[' 0 -eq 2 ']'
5233+++ return 0
5234++ _flags_shortName_='~'
5235++ '[' '~' '!=' '~' ']'
5236++ for _flags_name_ in '${__flags_longNames}'
5237_flags_removeExclamationName ${_flags_name_}
5238+++ _flags_removeExclamationName help
5239+++ _flags_opt_=help
5240+++ _flags_isNegate help
5241+++ case $1 in
5242+++ flags_return=0
5243+++ return 0
5244+++ echo help
5245+++ unset _flags_opt_
5246+++ return 0
5247++ _flags_usName_=help
5248_flags_underscoreName ${_flags_usName_}
5249+++ _flags_underscoreName help
5250+++ echo help
5251+++ tr - _
5252++ _flags_usName_=help
5253_flags_getFlagInfo ${_flags_usName_} ${__FLAGS_INFO_TYPE}
5254+++ _flags_getFlagInfo help type
5255+++ _flags_gFI_usName_=help
5256+++ _flags_gFI_info_=type
5257+++ _flags_infoVar_=__flags_help_type
5258+++ _flags_strToEval_='_flags_infoValue_="${__flags_help_type:-}"'
5259+++ eval '_flags_infoValue_="${__flags_help_type:-}"'
5260_flags_infoValue_="${__flags_help_type:-}"
5261++++ _flags_infoValue_=1
5262+++ '[' -n 1 ']'
5263+++ flags_return=0
5264+++ echo 1
5265+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
5266+++ '[' 0 -eq 2 ']'
5267+++ return 0
5268++ _flags_type_=1
5269++ '[' 0 -eq 0 ']'
5270++ case ${_flags_optStrType_} in
5271_flags_getFlagInfo             ${_flags_usName_} ${__FLAGS_INFO_SHORT}
5272+++ _flags_getFlagInfo help short
5273+++ _flags_gFI_usName_=help
5274+++ _flags_gFI_info_=short
5275+++ _flags_infoVar_=__flags_help_short
5276+++ _flags_strToEval_='_flags_infoValue_="${__flags_help_short:-}"'
5277+++ eval '_flags_infoValue_="${__flags_help_short:-}"'
5278_flags_infoValue_="${__flags_help_short:-}"
5279++++ _flags_infoValue_=h
5280+++ '[' -n h ']'
5281+++ flags_return=0
5282+++ echo h
5283+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
5284+++ '[' 0 -eq 2 ']'
5285+++ return 0
5286++ _flags_shortName_=h
5287++ '[' h '!=' '~' ']'
5288++ _flags_opts_=FrpkDSh
5289++ '[' 1 -ne 1 ']'
5290++ echo FrpkDSh
5291++ unset _flags_name_ _flags_opts_ _flags_optStrType_ _flags_shortName_ _flags_type_ _flags_usName_
5292++ return 0
5293+ _flags_shortOpts_=FrpkDSh
5294echo "${__flags_boolNames}"       |sed 's/^ *//;s/ *$//;s/ /,/g'
5295++ echo ' noshowcommands nofetch norebase nopreserve-merges nokeep nokeepremote nokeeplocal noforce_delete nosquash nosquash-info '
5296++ sed 's/^ *//;s/ *$//;s/ /,/g'
5297+ _flags_boolOpts_=noshowcommands,nofetch,norebase,nopreserve-merges,nokeep,nokeepremote,nokeeplocal,noforce_delete,nosquash,nosquash-info
5298_flags_genOptStr ${__FLAGS_OPTSTR_LONG}
5299++ _flags_genOptStr 1
5300++ _flags_optStrType_=1
5301++ _flags_opts_=
5302++ for _flags_name_ in '${__flags_longNames}'
5303_flags_removeExclamationName ${_flags_name_}
5304+++ _flags_removeExclamationName showcommands
5305+++ _flags_opt_=showcommands
5306+++ _flags_isNegate showcommands
5307+++ case $1 in
5308+++ flags_return=0
5309+++ return 0
5310+++ echo showcommands
5311+++ unset _flags_opt_
5312+++ return 0
5313++ _flags_usName_=showcommands
5314_flags_underscoreName ${_flags_usName_}
5315+++ _flags_underscoreName showcommands
5316+++ echo showcommands
5317+++ tr - _
5318++ _flags_usName_=showcommands
5319_flags_getFlagInfo ${_flags_usName_} ${__FLAGS_INFO_TYPE}
5320+++ _flags_getFlagInfo showcommands type
5321+++ _flags_gFI_usName_=showcommands
5322+++ _flags_gFI_info_=type
5323+++ _flags_infoVar_=__flags_showcommands_type
5324+++ _flags_strToEval_='_flags_infoValue_="${__flags_showcommands_type:-}"'
5325+++ eval '_flags_infoValue_="${__flags_showcommands_type:-}"'
5326_flags_infoValue_="${__flags_showcommands_type:-}"
5327++++ _flags_infoValue_=1
5328+++ '[' -n 1 ']'
5329+++ flags_return=0
5330+++ echo 1
5331+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
5332+++ '[' 0 -eq 2 ']'
5333+++ return 0
5334++ _flags_type_=1
5335++ '[' 0 -eq 0 ']'
5336++ case ${_flags_optStrType_} in
5337_flags_removeExclamationName ${_flags_name_}
5338+++ _flags_removeExclamationName showcommands
5339+++ _flags_opt_=showcommands
5340+++ _flags_isNegate showcommands
5341+++ case $1 in
5342+++ flags_return=0
5343+++ return 0
5344+++ echo showcommands
5345+++ unset _flags_opt_
5346+++ return 0
5347++ _flags_opts_=showcommands
5348++ '[' 1 -ne 1 ']'
5349++ for _flags_name_ in '${__flags_longNames}'
5350_flags_removeExclamationName ${_flags_name_}
5351+++ _flags_removeExclamationName fetch
5352+++ _flags_opt_=fetch
5353+++ _flags_isNegate fetch
5354+++ case $1 in
5355+++ flags_return=0
5356+++ return 0
5357+++ echo fetch
5358+++ unset _flags_opt_
5359+++ return 0
5360++ _flags_usName_=fetch
5361_flags_underscoreName ${_flags_usName_}
5362+++ _flags_underscoreName fetch
5363+++ echo fetch
5364+++ tr - _
5365++ _flags_usName_=fetch
5366_flags_getFlagInfo ${_flags_usName_} ${__FLAGS_INFO_TYPE}
5367+++ _flags_getFlagInfo fetch type
5368+++ _flags_gFI_usName_=fetch
5369+++ _flags_gFI_info_=type
5370+++ _flags_infoVar_=__flags_fetch_type
5371+++ _flags_strToEval_='_flags_infoValue_="${__flags_fetch_type:-}"'
5372+++ eval '_flags_infoValue_="${__flags_fetch_type:-}"'
5373_flags_infoValue_="${__flags_fetch_type:-}"
5374++++ _flags_infoValue_=1
5375+++ '[' -n 1 ']'
5376+++ flags_return=0
5377+++ echo 1
5378+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
5379+++ '[' 0 -eq 2 ']'
5380+++ return 0
5381++ _flags_type_=1
5382++ '[' 0 -eq 0 ']'
5383++ case ${_flags_optStrType_} in
5384_flags_removeExclamationName ${_flags_name_}
5385+++ _flags_removeExclamationName fetch
5386+++ _flags_opt_=fetch
5387+++ _flags_isNegate fetch
5388+++ case $1 in
5389+++ flags_return=0
5390+++ return 0
5391+++ echo fetch
5392+++ unset _flags_opt_
5393+++ return 0
5394++ _flags_opts_=showcommands,fetch
5395++ '[' 1 -ne 1 ']'
5396++ for _flags_name_ in '${__flags_longNames}'
5397_flags_removeExclamationName ${_flags_name_}
5398+++ _flags_removeExclamationName rebase
5399+++ _flags_opt_=rebase
5400+++ _flags_isNegate rebase
5401+++ case $1 in
5402+++ flags_return=0
5403+++ return 0
5404+++ echo rebase
5405+++ unset _flags_opt_
5406+++ return 0
5407++ _flags_usName_=rebase
5408_flags_underscoreName ${_flags_usName_}
5409+++ _flags_underscoreName rebase
5410+++ echo rebase
5411+++ tr - _
5412++ _flags_usName_=rebase
5413_flags_getFlagInfo ${_flags_usName_} ${__FLAGS_INFO_TYPE}
5414+++ _flags_getFlagInfo rebase type
5415+++ _flags_gFI_usName_=rebase
5416+++ _flags_gFI_info_=type
5417+++ _flags_infoVar_=__flags_rebase_type
5418+++ _flags_strToEval_='_flags_infoValue_="${__flags_rebase_type:-}"'
5419+++ eval '_flags_infoValue_="${__flags_rebase_type:-}"'
5420_flags_infoValue_="${__flags_rebase_type:-}"
5421++++ _flags_infoValue_=1
5422+++ '[' -n 1 ']'
5423+++ flags_return=0
5424+++ echo 1
5425+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
5426+++ '[' 0 -eq 2 ']'
5427+++ return 0
5428++ _flags_type_=1
5429++ '[' 0 -eq 0 ']'
5430++ case ${_flags_optStrType_} in
5431_flags_removeExclamationName ${_flags_name_}
5432+++ _flags_removeExclamationName rebase
5433+++ _flags_opt_=rebase
5434+++ _flags_isNegate rebase
5435+++ case $1 in
5436+++ flags_return=0
5437+++ return 0
5438+++ echo rebase
5439+++ unset _flags_opt_
5440+++ return 0
5441++ _flags_opts_=showcommands,fetch,rebase
5442++ '[' 1 -ne 1 ']'
5443++ for _flags_name_ in '${__flags_longNames}'
5444_flags_removeExclamationName ${_flags_name_}
5445+++ _flags_removeExclamationName preserve-merges
5446+++ _flags_opt_=preserve-merges
5447+++ _flags_isNegate preserve-merges
5448+++ case $1 in
5449+++ flags_return=0
5450+++ return 0
5451+++ echo preserve-merges
5452+++ unset _flags_opt_
5453+++ return 0
5454++ _flags_usName_=preserve-merges
5455_flags_underscoreName ${_flags_usName_}
5456+++ _flags_underscoreName preserve-merges
5457+++ echo preserve-merges
5458+++ tr - _
5459++ _flags_usName_=preserve_merges
5460_flags_getFlagInfo ${_flags_usName_} ${__FLAGS_INFO_TYPE}
5461+++ _flags_getFlagInfo preserve_merges type
5462+++ _flags_gFI_usName_=preserve_merges
5463+++ _flags_gFI_info_=type
5464+++ _flags_infoVar_=__flags_preserve_merges_type
5465+++ _flags_strToEval_='_flags_infoValue_="${__flags_preserve_merges_type:-}"'
5466+++ eval '_flags_infoValue_="${__flags_preserve_merges_type:-}"'
5467_flags_infoValue_="${__flags_preserve_merges_type:-}"
5468++++ _flags_infoValue_=1
5469+++ '[' -n 1 ']'
5470+++ flags_return=0
5471+++ echo 1
5472+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
5473+++ '[' 0 -eq 2 ']'
5474+++ return 0
5475++ _flags_type_=1
5476++ '[' 0 -eq 0 ']'
5477++ case ${_flags_optStrType_} in
5478_flags_removeExclamationName ${_flags_name_}
5479+++ _flags_removeExclamationName preserve-merges
5480+++ _flags_opt_=preserve-merges
5481+++ _flags_isNegate preserve-merges
5482+++ case $1 in
5483+++ flags_return=0
5484+++ return 0
5485+++ echo preserve-merges
5486+++ unset _flags_opt_
5487+++ return 0
5488++ _flags_opts_=showcommands,fetch,rebase,preserve-merges
5489++ '[' 1 -ne 1 ']'
5490++ for _flags_name_ in '${__flags_longNames}'
5491_flags_removeExclamationName ${_flags_name_}
5492+++ _flags_removeExclamationName keep
5493+++ _flags_opt_=keep
5494+++ _flags_isNegate keep
5495+++ case $1 in
5496+++ flags_return=0
5497+++ return 0
5498+++ echo keep
5499+++ unset _flags_opt_
5500+++ return 0
5501++ _flags_usName_=keep
5502_flags_underscoreName ${_flags_usName_}
5503+++ _flags_underscoreName keep
5504+++ tr - _
5505+++ echo keep
5506++ _flags_usName_=keep
5507_flags_getFlagInfo ${_flags_usName_} ${__FLAGS_INFO_TYPE}
5508+++ _flags_getFlagInfo keep type
5509+++ _flags_gFI_usName_=keep
5510+++ _flags_gFI_info_=type
5511+++ _flags_infoVar_=__flags_keep_type
5512+++ _flags_strToEval_='_flags_infoValue_="${__flags_keep_type:-}"'
5513+++ eval '_flags_infoValue_="${__flags_keep_type:-}"'
5514_flags_infoValue_="${__flags_keep_type:-}"
5515++++ _flags_infoValue_=1
5516+++ '[' -n 1 ']'
5517+++ flags_return=0
5518+++ echo 1
5519+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
5520+++ '[' 0 -eq 2 ']'
5521+++ return 0
5522++ _flags_type_=1
5523++ '[' 0 -eq 0 ']'
5524++ case ${_flags_optStrType_} in
5525_flags_removeExclamationName ${_flags_name_}
5526+++ _flags_removeExclamationName keep
5527+++ _flags_opt_=keep
5528+++ _flags_isNegate keep
5529+++ case $1 in
5530+++ flags_return=0
5531+++ return 0
5532+++ echo keep
5533+++ unset _flags_opt_
5534+++ return 0
5535++ _flags_opts_=showcommands,fetch,rebase,preserve-merges,keep
5536++ '[' 1 -ne 1 ']'
5537++ for _flags_name_ in '${__flags_longNames}'
5538_flags_removeExclamationName ${_flags_name_}
5539+++ _flags_removeExclamationName keepremote
5540+++ _flags_opt_=keepremote
5541+++ _flags_isNegate keepremote
5542+++ case $1 in
5543+++ flags_return=0
5544+++ return 0
5545+++ echo keepremote
5546+++ unset _flags_opt_
5547+++ return 0
5548++ _flags_usName_=keepremote
5549_flags_underscoreName ${_flags_usName_}
5550+++ _flags_underscoreName keepremote
5551+++ echo keepremote
5552+++ tr - _
5553++ _flags_usName_=keepremote
5554_flags_getFlagInfo ${_flags_usName_} ${__FLAGS_INFO_TYPE}
5555+++ _flags_getFlagInfo keepremote type
5556+++ _flags_gFI_usName_=keepremote
5557+++ _flags_gFI_info_=type
5558+++ _flags_infoVar_=__flags_keepremote_type
5559+++ _flags_strToEval_='_flags_infoValue_="${__flags_keepremote_type:-}"'
5560+++ eval '_flags_infoValue_="${__flags_keepremote_type:-}"'
5561_flags_infoValue_="${__flags_keepremote_type:-}"
5562++++ _flags_infoValue_=1
5563+++ '[' -n 1 ']'
5564+++ flags_return=0
5565+++ echo 1
5566+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
5567+++ '[' 0 -eq 2 ']'
5568+++ return 0
5569++ _flags_type_=1
5570++ '[' 0 -eq 0 ']'
5571++ case ${_flags_optStrType_} in
5572_flags_removeExclamationName ${_flags_name_}
5573+++ _flags_removeExclamationName keepremote
5574+++ _flags_opt_=keepremote
5575+++ _flags_isNegate keepremote
5576+++ case $1 in
5577+++ flags_return=0
5578+++ return 0
5579+++ echo keepremote
5580+++ unset _flags_opt_
5581+++ return 0
5582++ _flags_opts_=showcommands,fetch,rebase,preserve-merges,keep,keepremote
5583++ '[' 1 -ne 1 ']'
5584++ for _flags_name_ in '${__flags_longNames}'
5585_flags_removeExclamationName ${_flags_name_}
5586+++ _flags_removeExclamationName keeplocal
5587+++ _flags_opt_=keeplocal
5588+++ _flags_isNegate keeplocal
5589+++ case $1 in
5590+++ flags_return=0
5591+++ return 0
5592+++ echo keeplocal
5593+++ unset _flags_opt_
5594+++ return 0
5595++ _flags_usName_=keeplocal
5596_flags_underscoreName ${_flags_usName_}
5597+++ _flags_underscoreName keeplocal
5598+++ echo keeplocal
5599+++ tr - _
5600++ _flags_usName_=keeplocal
5601_flags_getFlagInfo ${_flags_usName_} ${__FLAGS_INFO_TYPE}
5602+++ _flags_getFlagInfo keeplocal type
5603+++ _flags_gFI_usName_=keeplocal
5604+++ _flags_gFI_info_=type
5605+++ _flags_infoVar_=__flags_keeplocal_type
5606+++ _flags_strToEval_='_flags_infoValue_="${__flags_keeplocal_type:-}"'
5607+++ eval '_flags_infoValue_="${__flags_keeplocal_type:-}"'
5608_flags_infoValue_="${__flags_keeplocal_type:-}"
5609++++ _flags_infoValue_=1
5610+++ '[' -n 1 ']'
5611+++ flags_return=0
5612+++ echo 1
5613+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
5614+++ '[' 0 -eq 2 ']'
5615+++ return 0
5616++ _flags_type_=1
5617++ '[' 0 -eq 0 ']'
5618++ case ${_flags_optStrType_} in
5619_flags_removeExclamationName ${_flags_name_}
5620+++ _flags_removeExclamationName keeplocal
5621+++ _flags_opt_=keeplocal
5622+++ _flags_isNegate keeplocal
5623+++ case $1 in
5624+++ flags_return=0
5625+++ return 0
5626+++ echo keeplocal
5627+++ unset _flags_opt_
5628+++ return 0
5629++ _flags_opts_=showcommands,fetch,rebase,preserve-merges,keep,keepremote,keeplocal
5630++ '[' 1 -ne 1 ']'
5631++ for _flags_name_ in '${__flags_longNames}'
5632_flags_removeExclamationName ${_flags_name_}
5633+++ _flags_removeExclamationName force_delete
5634+++ _flags_opt_=force_delete
5635+++ _flags_isNegate force_delete
5636+++ case $1 in
5637+++ flags_return=0
5638+++ return 0
5639+++ echo force_delete
5640+++ unset _flags_opt_
5641+++ return 0
5642++ _flags_usName_=force_delete
5643_flags_underscoreName ${_flags_usName_}
5644+++ _flags_underscoreName force_delete
5645+++ echo force_delete
5646+++ tr - _
5647++ _flags_usName_=force_delete
5648_flags_getFlagInfo ${_flags_usName_} ${__FLAGS_INFO_TYPE}
5649+++ _flags_getFlagInfo force_delete type
5650+++ _flags_gFI_usName_=force_delete
5651+++ _flags_gFI_info_=type
5652+++ _flags_infoVar_=__flags_force_delete_type
5653+++ _flags_strToEval_='_flags_infoValue_="${__flags_force_delete_type:-}"'
5654+++ eval '_flags_infoValue_="${__flags_force_delete_type:-}"'
5655_flags_infoValue_="${__flags_force_delete_type:-}"
5656++++ _flags_infoValue_=1
5657+++ '[' -n 1 ']'
5658+++ flags_return=0
5659+++ echo 1
5660+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
5661+++ '[' 0 -eq 2 ']'
5662+++ return 0
5663++ _flags_type_=1
5664++ '[' 0 -eq 0 ']'
5665++ case ${_flags_optStrType_} in
5666_flags_removeExclamationName ${_flags_name_}
5667+++ _flags_removeExclamationName force_delete
5668+++ _flags_opt_=force_delete
5669+++ _flags_isNegate force_delete
5670+++ case $1 in
5671+++ flags_return=0
5672+++ return 0
5673+++ echo force_delete
5674+++ unset _flags_opt_
5675+++ return 0
5676++ _flags_opts_=showcommands,fetch,rebase,preserve-merges,keep,keepremote,keeplocal,force_delete
5677++ '[' 1 -ne 1 ']'
5678++ for _flags_name_ in '${__flags_longNames}'
5679_flags_removeExclamationName ${_flags_name_}
5680+++ _flags_removeExclamationName squash
5681+++ _flags_opt_=squash
5682+++ _flags_isNegate squash
5683+++ case $1 in
5684+++ flags_return=0
5685+++ return 0
5686+++ echo squash
5687+++ unset _flags_opt_
5688+++ return 0
5689++ _flags_usName_=squash
5690_flags_underscoreName ${_flags_usName_}
5691+++ _flags_underscoreName squash
5692+++ echo squash
5693+++ tr - _
5694++ _flags_usName_=squash
5695_flags_getFlagInfo ${_flags_usName_} ${__FLAGS_INFO_TYPE}
5696+++ _flags_getFlagInfo squash type
5697+++ _flags_gFI_usName_=squash
5698+++ _flags_gFI_info_=type
5699+++ _flags_infoVar_=__flags_squash_type
5700+++ _flags_strToEval_='_flags_infoValue_="${__flags_squash_type:-}"'
5701+++ eval '_flags_infoValue_="${__flags_squash_type:-}"'
5702_flags_infoValue_="${__flags_squash_type:-}"
5703++++ _flags_infoValue_=1
5704+++ '[' -n 1 ']'
5705+++ flags_return=0
5706+++ echo 1
5707+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
5708+++ '[' 0 -eq 2 ']'
5709+++ return 0
5710++ _flags_type_=1
5711++ '[' 0 -eq 0 ']'
5712++ case ${_flags_optStrType_} in
5713_flags_removeExclamationName ${_flags_name_}
5714+++ _flags_removeExclamationName squash
5715+++ _flags_opt_=squash
5716+++ _flags_isNegate squash
5717+++ case $1 in
5718+++ flags_return=0
5719+++ return 0
5720+++ echo squash
5721+++ unset _flags_opt_
5722+++ return 0
5723++ _flags_opts_=showcommands,fetch,rebase,preserve-merges,keep,keepremote,keeplocal,force_delete,squash
5724++ '[' 1 -ne 1 ']'
5725++ for _flags_name_ in '${__flags_longNames}'
5726_flags_removeExclamationName ${_flags_name_}
5727+++ _flags_removeExclamationName squash-info
5728+++ _flags_opt_=squash-info
5729+++ _flags_isNegate squash-info
5730+++ case $1 in
5731+++ flags_return=0
5732+++ return 0
5733+++ echo squash-info
5734+++ unset _flags_opt_
5735+++ return 0
5736++ _flags_usName_=squash-info
5737_flags_underscoreName ${_flags_usName_}
5738+++ _flags_underscoreName squash-info
5739+++ echo squash-info
5740+++ tr - _
5741++ _flags_usName_=squash_info
5742_flags_getFlagInfo ${_flags_usName_} ${__FLAGS_INFO_TYPE}
5743+++ _flags_getFlagInfo squash_info type
5744+++ _flags_gFI_usName_=squash_info
5745+++ _flags_gFI_info_=type
5746+++ _flags_infoVar_=__flags_squash_info_type
5747+++ _flags_strToEval_='_flags_infoValue_="${__flags_squash_info_type:-}"'
5748+++ eval '_flags_infoValue_="${__flags_squash_info_type:-}"'
5749_flags_infoValue_="${__flags_squash_info_type:-}"
5750++++ _flags_infoValue_=1
5751+++ '[' -n 1 ']'
5752+++ flags_return=0
5753+++ echo 1
5754+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
5755+++ '[' 0 -eq 2 ']'
5756+++ return 0
5757++ _flags_type_=1
5758++ '[' 0 -eq 0 ']'
5759++ case ${_flags_optStrType_} in
5760_flags_removeExclamationName ${_flags_name_}
5761+++ _flags_removeExclamationName squash-info
5762+++ _flags_opt_=squash-info
5763+++ _flags_isNegate squash-info
5764+++ case $1 in
5765+++ flags_return=0
5766+++ return 0
5767+++ echo squash-info
5768+++ unset _flags_opt_
5769+++ return 0
5770++ _flags_opts_=showcommands,fetch,rebase,preserve-merges,keep,keepremote,keeplocal,force_delete,squash,squash-info
5771++ '[' 1 -ne 1 ']'
5772++ for _flags_name_ in '${__flags_longNames}'
5773_flags_removeExclamationName ${_flags_name_}
5774+++ _flags_removeExclamationName no-ff
5775+++ _flags_opt_=no-ff
5776+++ _flags_isNegate no-ff
5777+++ case $1 in
5778+++ flags_return=0
5779+++ return 0
5780+++ echo no-ff
5781+++ unset _flags_opt_
5782+++ return 0
5783++ _flags_usName_=no-ff
5784_flags_underscoreName ${_flags_usName_}
5785+++ _flags_underscoreName no-ff
5786+++ echo no-ff
5787+++ tr - _
5788++ _flags_usName_=no_ff
5789_flags_getFlagInfo ${_flags_usName_} ${__FLAGS_INFO_TYPE}
5790+++ _flags_getFlagInfo no_ff type
5791+++ _flags_gFI_usName_=no_ff
5792+++ _flags_gFI_info_=type
5793+++ _flags_infoVar_=__flags_no_ff_type
5794+++ _flags_strToEval_='_flags_infoValue_="${__flags_no_ff_type:-}"'
5795+++ eval '_flags_infoValue_="${__flags_no_ff_type:-}"'
5796_flags_infoValue_="${__flags_no_ff_type:-}"
5797++++ _flags_infoValue_=1
5798+++ '[' -n 1 ']'
5799+++ flags_return=0
5800+++ echo 1
5801+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
5802+++ '[' 0 -eq 2 ']'
5803+++ return 0
5804++ _flags_type_=1
5805++ '[' 0 -eq 0 ']'
5806++ case ${_flags_optStrType_} in
5807_flags_removeExclamationName ${_flags_name_}
5808+++ _flags_removeExclamationName no-ff
5809+++ _flags_opt_=no-ff
5810+++ _flags_isNegate no-ff
5811+++ case $1 in
5812+++ flags_return=0
5813+++ return 0
5814+++ echo no-ff
5815+++ unset _flags_opt_
5816+++ return 0
5817++ _flags_opts_=showcommands,fetch,rebase,preserve-merges,keep,keepremote,keeplocal,force_delete,squash,squash-info,no-ff
5818++ '[' 1 -ne 1 ']'
5819++ for _flags_name_ in '${__flags_longNames}'
5820_flags_removeExclamationName ${_flags_name_}
5821+++ _flags_removeExclamationName help
5822+++ _flags_opt_=help
5823+++ _flags_isNegate help
5824+++ case $1 in
5825+++ flags_return=0
5826+++ return 0
5827+++ echo help
5828+++ unset _flags_opt_
5829+++ return 0
5830++ _flags_usName_=help
5831_flags_underscoreName ${_flags_usName_}
5832+++ _flags_underscoreName help
5833+++ echo help
5834+++ tr - _
5835++ _flags_usName_=help
5836_flags_getFlagInfo ${_flags_usName_} ${__FLAGS_INFO_TYPE}
5837+++ _flags_getFlagInfo help type
5838+++ _flags_gFI_usName_=help
5839+++ _flags_gFI_info_=type
5840+++ _flags_infoVar_=__flags_help_type
5841+++ _flags_strToEval_='_flags_infoValue_="${__flags_help_type:-}"'
5842+++ eval '_flags_infoValue_="${__flags_help_type:-}"'
5843_flags_infoValue_="${__flags_help_type:-}"
5844++++ _flags_infoValue_=1
5845+++ '[' -n 1 ']'
5846+++ flags_return=0
5847+++ echo 1
5848+++ unset _flags_gFI_usName_ _flags_gfI_info_ _flags_infoValue_ _flags_infoVar_ _flags_strToEval_ _flags_typeValue_ _flags_typeVar_
5849+++ '[' 0 -eq 2 ']'
5850+++ return 0
5851++ _flags_type_=1
5852++ '[' 0 -eq 0 ']'
5853++ case ${_flags_optStrType_} in
5854_flags_removeExclamationName ${_flags_name_}
5855+++ _flags_removeExclamationName help
5856+++ _flags_opt_=help
5857+++ _flags_isNegate help
5858+++ case $1 in
5859+++ flags_return=0
5860+++ return 0
5861+++ echo help
5862+++ unset _flags_opt_
5863+++ return 0
5864++ _flags_opts_=showcommands,fetch,rebase,preserve-merges,keep,keepremote,keeplocal,force_delete,squash,squash-info,no-ff,help
5865++ '[' 1 -ne 1 ']'
5866++ echo showcommands,fetch,rebase,preserve-merges,keep,keepremote,keeplocal,force_delete,squash,squash-info,no-ff,help
5867++ unset _flags_name_ _flags_opts_ _flags_optStrType_ _flags_shortName_ _flags_type_ _flags_usName_
5868++ return 0
5869+ _flags_longOpts_=showcommands,fetch,rebase,preserve-merges,keep,keepremote,keeplocal,force_delete,squash,squash-info,no-ff,help
5870${FLAGS_GETOPT_CMD}       -o ${_flags_shortOpts_}       -l "${_flags_longOpts_},${_flags_boolOpts_}"       -- "$@" 2>&1
5871++ getopt -o FrpkDSh -l showcommands,fetch,rebase,preserve-merges,keep,keepremote,keeplocal,force_delete,squash,squash-info,no-ff,help,noshowcommands,nofetch,norebase,nopreserve-merges,nokeep,nokeepremote,nokeeplocal,noforce_delete,nosquash,nosquash-info -- f3 ''
5872+ __flags_opts=' -- '\''f3'\'' '\'''\'''
5873+ _flags_rtrn_=0
5874+ '[' 0 -ne 0 ']'
5875+ unset _flags_boolOpts_ _flags_longOpts_ _flags_rtrn_ _flags_shortOpts_
5876+ return 0
5877+ flags_return=0
5878+ '[' 0 -eq 0 ']'
5879+ _flags_parseGetopt 2 ' -- '\''f3'\'' '\'''\'''
5880+ _flags_argc_=2
5881+ shift
5882+ flags_return=0
5883+ '[' 1 -ne 1 ']'
5884+ eval set -- ' -- '\''f3'\'' '\'''\'''
5885set --  -- 'f3' ''
5886++ set -- -- f3 ''
5887_flags_math "$# - 1 - ${_flags_argc_}"
5888++ _flags_math '3 - 1 - 2'
5889++ '[' 1 -eq 0 ']'
5890++ _flags_useBuiltin
5891++ return 0
5892++ _flags_expr_='$(($@))'
5893++ eval echo '$(($@))'
5894echo $(($@))
5895+++ echo 0
5896++ flags_return=0
5897++ unset _flags_expr_
5898++ return 0
5899+ FLAGS_ARGC=0
5900+ true
5901+ _flags_opt_=--
5902+ _flags_arg_=f3
5903+ _flags_type_=0
5904+ _flags_name_=
5905+ case "${_flags_opt_}" in
5906+ shift
5907+ break
5908+ FLAGS_ARGV=
5909+ '[' 2 -gt 0 ']'
5910+ FLAGS_ARGV=''\''f3'\'''
5911+ shift
5912+ '[' 1 -gt 0 ']'
5913+ FLAGS_ARGV=''\''f3'\'' '\'''\'''
5914+ shift
5915+ '[' 0 -gt 0 ']'
5916+ unset _flags_arg_ _flags_len_ _flags_name_ _flags_opt_ _flags_pos_ _flags_strToEval_ _flags_type_ _flags_usName_ _flags_val_
5917+ return 0
5918+ flags_return=0
5919+ '[' 0 -eq 2 ']'
5920+ return 0
5921+ eval set -- ''\''f3'\'' '\'''\'''
5922set -- 'f3' ''
5923++ set -- f3 ''
5924+ NAME=f3
5925+ BRANCH=feature/f3
5926+ gitflow_expand_nameprefix_arg_or_current
5927+ '[' f3 '!=' '' ']'
5928+ gitflow_expand_nameprefix_arg
5929+ local expanded_name exitcode
5930+ gitflow_require_name_arg
5931+ '[' f3 = '' ']'
5932gitflow_resolve_nameprefix "$NAME" "$PREFIX"
5933++ gitflow_resolve_nameprefix f3 feature/
5934++ local name prefix
5935++ local match matches num_matches
5936++ name=f3
5937++ prefix=feature/
5938++ git_local_branch_exists feature/f3
5939++ '[' -n feature/f3 ']'
5940git for-each-ref --format='%(refname:short)' refs/heads/$1
5941+++ git for-each-ref '--format=%(refname:short)' refs/heads/feature/f3
5942++ '[' -n feature/f3 ']'
5943++ echo f3
5944++ return 0
5945+ expanded_name=f3
5946+ exitcode=0
5947+ case $exitcode in
5948+ NAME=f3
5949+ BRANCH=feature/f3
5950+ require_branch feature/f3
5951+ git_branch_exists feature/f3
5952+ '[' -n feature/f3 ']'
5953+ git_local_branch_exists feature/f3
5954+ '[' -n feature/f3 ']'
5955git for-each-ref --format='%(refname:short)' refs/heads/$1
5956++ git for-each-ref '--format=%(refname:short)' refs/heads/feature/f3
5957+ '[' -n feature/f3 ']'
5958+ flag keepremote
5959+ local FLAG
5960+ eval 'FLAG=$FLAGS_keepremote'
5961FLAG=$FLAGS_keepremote
5962++ FLAG=1
5963+ '[' 1 -eq 0 ']'
5964+ require_branch feature/f3
5965+ git_branch_exists feature/f3
5966+ '[' -n feature/f3 ']'
5967+ git_local_branch_exists feature/f3
5968+ '[' -n feature/f3 ']'
5969git for-each-ref --format='%(refname:short)' refs/heads/$1
5970++ git for-each-ref '--format=%(refname:short)' refs/heads/feature/f3
5971+ '[' -n feature/f3 ']'
5972gitflow_config_get_base_branch $BRANCH
5973++ gitflow_config_get_base_branch feature/f3
5974++ local branch
5975++ branch=feature/f3
5976git config --local --get "gitflow.branch.$branch.base"
5977+++ git config --local --get gitflow.branch.feature/f3.base
5978++ echo develop
5979+ BASE_BRANCH=develop
5980+ BASE_BRANCH=develop
5981+ git_local_branch_exists develop
5982+ '[' -n develop ']'
5983git for-each-ref --format='%(refname:short)' refs/heads/$1
5984++ git for-each-ref '--format=%(refname:short)' refs/heads/develop
5985+ '[' -n develop ']'
5986+ '[' -f .git/.gitflow/MERGE_BASE ']'
5987+ git_is_clean_working_tree
5988+ git rev-parse --verify HEAD
5989+ git update-index -q --ignore-submodules --refresh
5990file.txt: needs merge
5991+ git diff-files --quiet --ignore-submodules
5992+ return 1
5993+ echo
5994
5995+ echo 'Merge conflicts not resolved yet, use:'
5996Merge conflicts not resolved yet, use:
5997+ echo '    git mergetool'
5998    git mergetool
5999+ echo '    git commit'
6000    git commit
6001+ echo
6002
6003+ echo 'You can then complete the finish by running it again:'
6004You can then complete the finish by running it again:
6005+ echo '    git flow feature finish f3'
6006    git flow feature finish f3
6007+ echo
6008
6009+ exit 1