9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] git/revert: fix empty invocation
@ 2021-11-04 19:02 Kyle Milz
  2021-11-04 19:48 ` ori
  0 siblings, 1 reply; 2+ messages in thread
From: Kyle Milz @ 2021-11-04 19:02 UTC (permalink / raw)
  To: 9front

[-- 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)

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2021-11-04 19:59 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-04 19:02 [9front] git/revert: fix empty invocation Kyle Milz
2021-11-04 19:48 ` ori

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).