@matheusbsbs / matheus-bagliano / commits / 20c7e3d5cf
Fork 0

Show usage string for 'git merge-ours -h'

This change is strictly about 'git merge-ours -h' without any other options and arguments. This change cannot break compatibility since merge drivers are always passed '--', among other arguments. Any usage string for this command is a lie, since it ignored its arguments until now. Still, it makes sense to let the user know the expected usage when asked. 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 20c7e3d5cfcc0834fd5d38200e94d15a103ab271
1 file changed +6
builtin-merge-ours.c
+6
@@ -10,6 +10,9 @@
10 #include "git-compat-util.h"
11 #include "builtin.h"
12
13 +static const char builtin_merge_ours_usage[] =
14 + "git merge-ours <base>... -- HEAD <remote>...";
15 +
16 static const char *diff_index_args[] = {
17 "diff-index", "--quiet", "--cached", "HEAD", "--", NULL
18 };
@@ -17,6 +20,9 @@ static const char *diff_index_args[] = {
20
21 int cmd_merge_ours(int argc, const char **argv, const char *prefix)
22 {
23 + if (argc == 2 && !strcmp(argv[1], "-h"))
24 + usage(builtin_merge_ours_usage);
25 +
26 /*
27 * We need to exit with 2 if the index does not match our HEAD tree,
28 * because the current index is what we will be committing as the