Re: [PATCH 2/2] Teach "-m <msg>" and "-F <file>" to "git notes edit"

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

 



Hi,

On Tue, 21 Apr 2009, Johan Herland wrote:

> The "-m" and "-F" options are already the established method
> (in both git-commit and git-tag) to specify a commit/tag message
> without invoking the editor. This patch teaches "git notes edit"
> to respect the same options for specifying a notes message without
> invoking the editor.
> 
> The patch also updates the "git notes" documentation and adds a
> couple of selftests for the new functionality.
> 
> Signed-off-by: Johan Herland <johan@xxxxxxxxxxx>
> ---

Nice!

> +MESSAGE=
> +while test $# != 0
> +do
> +	case "$1" in
> +	-m)
> +		test "$ACTION" = "edit" || usage
> +		shift
> +		if test "$#" = "0"; then
> +			die "error: option -m needs an argument"
> +		else
> +			MESSAGE="$1"
> +			shift
> +		fi
> +		;;
> +	-F)
> +		test "$ACTION" = "edit" || usage
> +		shift
> +		if test "$#" = "0"; then
> +			die "error: option -F needs an argument"
> +		else
> +			MESSAGE="$(cat "$1")"
> +			shift
> +		fi
> +		;;
> +	-*)
> +		usage
> +		;;
> +	*)
> +		break
> +		;;
> +	esac
> +done

Well, either you forbid multiple -F/-m options, or you merge the messages, 
right?  AFAIR 'git commit -m A -m B' combines 'A' and 'B'...

> +	if [ -n "$MESSAGE" ]; then

Here's a chance for me to learn: I was under the impression that "! -z" is 
more portable than "-n".  Am I completely off the track?

Ciao,
Dscho
--
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]