9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Kyle Milz <krwmilz@gmail.com>
To: 9front@9front.org
Subject: [9front] git/revert: fix empty invocation
Date: Thu, 4 Nov 2021 12:02:42 -0700	[thread overview]
Message-ID: <YYQuUsuOdyNNW4dI@imac.0x30.net> (raw)

[-- Attachment #1: git_revert_args.diff --]
[-- Type: text/plain, Size: 835 bytes --]

hi,

git/revert requires a file name argument, but when none is given
it fails in a strange way:

	% git/revert
	usage: cleanname [-d pwd] name...
	/bin/git/revert:15: null list in concatenation

it looks like getflags does not verify *arguments*, and the 'args'
variable is only used by aux/usage. diff below adds a check
for a nonzero amount of arguments. here is the new output:

	% git/revert
	usage: revert [-c query] file ...

i tested -c to make sure it works like it did without this change.

kyle

diff 3f495077869362629de9d0c0b070ffca10ceb729 uncommitted
--- a/sys/src/cmd/git/revert
+++ b/sys/src/cmd/git/revert
@@ -5,7 +5,8 @@
 gitup
 
 flagfmt='c:query query' args='file ...'
-eval `''{aux/getflags $*} || exec aux/usage
+if (! eval `''{aux/getflags $*} || ~ $#* 0)
+	exec aux/usage
 
 commit=$gitfs/HEAD
 if(~ $#query 1)

             reply	other threads:[~2021-11-04 19:09 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-04 19:02 Kyle Milz [this message]
2021-11-04 19:48 ` ori

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=YYQuUsuOdyNNW4dI@imac.0x30.net \
    --to=krwmilz@gmail.com \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).