30
30
#include "tag.h"
31
31
32
32
static char blame_usage [] = N_ ("git blame [<options>] [<rev-opts>] [<rev>] [--] <file>" );
33
+ static char annotate_usage [] = N_ ("git annotate [<options>] [<rev-opts>] [<rev>] [--] <file>" );
33
34
34
35
static const char * blame_opt_usage [] = {
35
36
blame_usage ,
@@ -38,6 +39,13 @@ static const char *blame_opt_usage[] = {
38
39
NULL
39
40
};
40
41
42
+ static const char * annotate_opt_usage [] = {
43
+ annotate_usage ,
44
+ "" ,
45
+ N_ ("<rev-opts> are documented in git-rev-list(1)" ),
46
+ NULL
47
+ };
48
+
41
49
static int longest_file ;
42
50
static int longest_author ;
43
51
static int max_orig_digits ;
@@ -899,6 +907,8 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
899
907
long anchor ;
900
908
const int hexsz = the_hash_algo -> hexsz ;
901
909
long num_lines = 0 ;
910
+ const char * str_usage = cmd_is_annotate ? annotate_usage : blame_usage ;
911
+ const char * * opt_usage = cmd_is_annotate ? annotate_opt_usage : blame_opt_usage ;
902
912
903
913
setup_default_color_by_age ();
904
914
git_config (git_blame_config , & output_option );
@@ -914,7 +924,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
914
924
parse_options_start (& ctx , argc , argv , prefix , options ,
915
925
PARSE_OPT_KEEP_DASHDASH | PARSE_OPT_KEEP_ARGV0 );
916
926
for (;;) {
917
- switch (parse_options_step (& ctx , options , blame_opt_usage )) {
927
+ switch (parse_options_step (& ctx , options , opt_usage )) {
918
928
case PARSE_OPT_NON_OPTION :
919
929
case PARSE_OPT_UNKNOWN :
920
930
break ;
@@ -934,7 +944,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
934
944
ctx .argv [0 ] = "--children" ;
935
945
reverse = 1 ;
936
946
}
937
- parse_revision_opt (& revs , & ctx , options , blame_opt_usage );
947
+ parse_revision_opt (& revs , & ctx , options , opt_usage );
938
948
}
939
949
parse_done :
940
950
revision_opts_finish (& revs );
@@ -1040,7 +1050,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
1040
1050
switch (argc - dashdash_pos - 1 ) {
1041
1051
case 2 : /* (1b) */
1042
1052
if (argc != 4 )
1043
- usage_with_options (blame_opt_usage , options );
1053
+ usage_with_options (opt_usage , options );
1044
1054
/* reorder for the new way: <rev> -- <path> */
1045
1055
argv [1 ] = argv [3 ];
1046
1056
argv [3 ] = argv [2 ];
@@ -1051,11 +1061,11 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
1051
1061
argv [argc ] = NULL ;
1052
1062
break ;
1053
1063
default :
1054
- usage_with_options (blame_opt_usage , options );
1064
+ usage_with_options (opt_usage , options );
1055
1065
}
1056
1066
} else {
1057
1067
if (argc < 2 )
1058
- usage_with_options (blame_opt_usage , options );
1068
+ usage_with_options (opt_usage , options );
1059
1069
if (argc == 3 && is_a_rev (argv [argc - 1 ])) { /* (2b) */
1060
1070
path = add_prefix (prefix , argv [1 ]);
1061
1071
argv [1 ] = argv [2 ];
@@ -1113,7 +1123,7 @@ int cmd_blame(int argc, const char **argv, const char *prefix)
1113
1123
nth_line_cb , & sb , lno , anchor ,
1114
1124
& bottom , & top , sb .path ,
1115
1125
the_repository -> index ))
1116
- usage (blame_usage );
1126
+ usage (str_usage );
1117
1127
if ((!lno && (top || bottom )) || lno < bottom )
1118
1128
die (Q_ ("file %s has only %lu line" ,
1119
1129
"file %s has only %lu lines" ,
0 commit comments