Thread (34 messages) flat view 34 messages, 3 authors, 2016-06-15
STALE3743d

[PATCH 16/24] Show usage string for 'git unpack-file -h'

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:47:41
Subsystem: the rest · Maintainer: Linus Torvalds

"unpack-file -h" could be asking to save the contents of a blob
named "-h".  Strictly speaking, such a pathological ref name is
possible, but the user would have to had said something like
"tags/-h" to name such a pathological ref already.  When used in
scripts, unpack-file is typically not passed a user-supplied tag
name directly.

Signed-off-by: Jonathan Nieder <redacted>
---
 unpack-file.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/unpack-file.c b/unpack-file.c
index ac9cbf7..e9d8934 100644
--- a/unpack-file.c
+++ b/unpack-file.c
@@ -28,7 +28,7 @@ int main(int argc, char **argv)
 
 	git_extract_argv0_path(argv[0]);
 
-	if (argc != 2)
+	if (argc != 2 || !strcmp(argv[1], "-h"))
 		usage("git unpack-file <sha1>");
 	if (get_sha1(argv[1], sha1))
 		die("Not a valid object name %s", argv[1]);
-- 
1.6.5.2
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help