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