Re: [PATCH] submodule: no [--merge|--rebase] when newly cloned

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Am 2/16/2011 20:51, schrieb Junio C Hamano:
> 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
--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]