git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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

From
Johannes Schindelin <johannes.schindelin@gmx.de>
Date
Apr 21, 2009, 00:53 UTC
Message-ID
<alpine.DEB.1.00.0904210251220.10279@pacific.mpi-cbg.de>
In-Reply-To
<200904210242.16050.johan@herland.net>
Hi,
On Tue, 21 Apr 2009, Johan Herland wrote:
Show 11 quoted lines
> 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@herland.net>
> ---
Nice!
Show 32 quoted lines
> +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

Previous: Johan HerlandNext: Johan Herland
Message 6 of 8 in “Add "-m" and "-F" options to "git notes edit"”
  1. 0/2 Add "-m" and "-F" options to "git notes edit"Johan Herland, Apr 21, 2009
  2. 1/2 Minor cleanup and bugfixing in git-notes.shJohan Herland, Apr 21, 2009
  3. Johannes SchindelinApr 21, 2009
  4. Johan HerlandApr 21, 2009
  5. 2/2 Teach "-m <msg>" and "-F <file>" to "git notes edit"Johan Herland, Apr 21, 2009
  6. Johannes SchindelinApr 21, 2009
  7. 2/2 Teach "-m <msg>" and "-F <file>" to "git notes edit"Johan Herland, Apr 21, 2009
  8. Johannes SchindelinApr 21, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.