@@ -124,30 +124,36 @@ int cmd_replace(int argc, const char **argv, const char *prefix)
124
124
argc = parse_options (argc , argv , prefix , options , git_replace_usage , 0 );
125
125
126
126
if (list && delete )
127
- usage_with_options (git_replace_usage , options );
127
+ usage_msg_opt ("-l and -d cannot be used together" ,
128
+ git_replace_usage , options );
128
129
129
130
if (force && (list || delete ))
130
- usage_with_options (git_replace_usage , options );
131
+ usage_msg_opt ("-f cannot be used with -d or -l" ,
132
+ git_replace_usage , options );
131
133
132
134
/* Delete refs */
133
135
if (delete ) {
134
136
if (argc < 1 )
135
- usage_with_options (git_replace_usage , options );
137
+ usage_msg_opt ("-d needs at least one argument" ,
138
+ git_replace_usage , options );
136
139
return for_each_replace_name (argv , delete_replace_ref );
137
140
}
138
141
139
142
/* Replace object */
140
143
if (!list && argc ) {
141
144
if (argc != 2 )
142
- usage_with_options (git_replace_usage , options );
145
+ usage_msg_opt ("bad number of arguments" ,
146
+ git_replace_usage , options );
143
147
return replace_object (argv [0 ], argv [1 ], force );
144
148
}
145
149
146
150
/* List refs, even if "list" is not set */
147
151
if (argc > 1 )
148
- usage_with_options (git_replace_usage , options );
152
+ usage_msg_opt ("only one pattern can be given with -l" ,
153
+ git_replace_usage , options );
149
154
if (force )
150
- usage_with_options (git_replace_usage , options );
155
+ usage_msg_opt ("-f needs some arguments" ,
156
+ git_replace_usage , options );
151
157
152
158
return list_replace_refs (argv [0 ]);
153
159
}
0 commit comments