Show usage string for 'git unpack-file -h'
"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 <jrnieder@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Jonathan Nieder committed
Nov 9, 2009 at 09:04 UTC
1507301204180a17f915b929fc8377e69aef979d
1 file changed
+1
-1
unpack-file.c
+1
-1
@@ -28,7 +28,7 @@ int main(int argc, char **argv)
28
29
git_extract_argv0_path(argv[0]);
30
31
- if (argc != 2)
31
+ if (argc != 2 || !strcmp(argv[1], "-h"))
32
usage("git unpack-file <sha1>");
33
if (get_sha1(argv[1], sha1))
34
die("Not a valid object name %s", argv[1]);