[PATCH 04/24] Show usage string for 'git commit-tree -h'

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 builtin-commit-tree.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/builtin-commit-tree.c b/builtin-commit-tree.c
index 6467077..ddcb7a4 100644
--- a/builtin-commit-tree.c
+++ b/builtin-commit-tree.c
@@ -105,7 +105,7 @@ int cmd_commit_tree(int argc, const char **argv, const char *prefix)
 
 	git_config(git_default_config, NULL);
 
-	if (argc < 2)
+	if (argc < 2 || !strcmp(argv[1], "-h"))
 		usage(commit_tree_usage);
 	if (get_sha1(argv[1], tree_sha1))
 		die("Not a valid object name %s", argv[1]);
-- 
1.6.5.2

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]