Re: [PATCH] submodule: no [--merge|--rebase] when newly cloned
- From
Johannes Sixt <j.sixt@viscovery.net>
- Date
- Feb 17, 2011, 07:10 UTC
- Message-ID
- <4D5CC9C9.60705@viscovery.net>
- In-Reply-To
- <7v62sjkbbi.fsf@alter.siamese.dyndns.org>
Am 2/16/2011 20:51, schrieb Junio C Hamano:
Show 11 quoted lines
> Here is how to write the above more concisely, efficiently and portably. > > case "$2;" in > *";$1;"*) > echo yes ;; > *) > echo no ;; > esac > > The trailing ';' takes care of the case where cloned_modules has only one > element, in which case you have ";name" in "$2". No need for a loop.
And while you are here, you could make this:
list_contains()
{
case "$2;" in
*";$1;"*)
: yes ;;
*)
! : no ;;
esac
}and test for the exit code of this function rather than its output at the call site.
-- Hannes