Show usage string for 'git commit-tree -h'
Treat an "-h" option as a request for help, rather than a "Not a valid object name" error. "commit-tree -h" could be asking to create a new commit from a treeish 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 already. commit-tree is usually used in scripts with raw object ids, anyway. For consistency, the "-h" option uses its new meaning even if followed by other arguments. 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
6e9daeffec0213fa1cee76ad9d899fe492409f46
1 file changed
+1
-1
builtin-commit-tree.c
+1
-1
@@ -105,7 +105,7 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)
105
106
git_config(git_default_config, NULL);
107
108
- if (argc < 2)
108
+ if (argc < 2 || !strcmp(argv[1], "-h"))
109
usage(commit_tree_usage);
110
if (get_sha1(argv[1], tree_sha1))
111
die("Not a valid object name %s", argv[1]);