@@ -493,7 +493,7 @@ static int is_index_unchanged(void)
493
493
struct commit * head_commit ;
494
494
495
495
if (!resolve_ref_unsafe ("HEAD" , RESOLVE_REF_READING , & head_oid , NULL ))
496
- return error (_ ("could not resolve HEAD commit\n " ));
496
+ return error (_ ("could not resolve HEAD commit" ));
497
497
498
498
head_commit = lookup_commit (& head_oid );
499
499
@@ -513,7 +513,7 @@ static int is_index_unchanged(void)
513
513
514
514
if (!cache_tree_fully_valid (active_cache_tree ))
515
515
if (cache_tree_update (& the_index , 0 ))
516
- return error (_ ("unable to update cache tree\n " ));
516
+ return error (_ ("unable to update cache tree" ));
517
517
518
518
return !oidcmp (& active_cache_tree -> oid ,
519
519
& head_commit -> tree -> object .oid );
@@ -699,12 +699,12 @@ static int is_original_commit_empty(struct commit *commit)
699
699
const struct object_id * ptree_oid ;
700
700
701
701
if (parse_commit (commit ))
702
- return error (_ ("could not parse commit %s\n " ),
702
+ return error (_ ("could not parse commit %s" ),
703
703
oid_to_hex (& commit -> object .oid ));
704
704
if (commit -> parents ) {
705
705
struct commit * parent = commit -> parents -> item ;
706
706
if (parse_commit (parent ))
707
- return error (_ ("could not parse parent commit %s\n " ),
707
+ return error (_ ("could not parse parent commit %s" ),
708
708
oid_to_hex (& parent -> object .oid ));
709
709
ptree_oid = & parent -> tree -> object .oid ;
710
710
} else {
@@ -1013,9 +1013,7 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
1013
1013
opts );
1014
1014
if (res || command != TODO_REWORD )
1015
1015
goto leave ;
1016
- flags |= EDIT_MSG | AMEND_MSG ;
1017
- if (command == TODO_REWORD )
1018
- flags |= VERIFY_MSG ;
1016
+ flags |= EDIT_MSG | AMEND_MSG | VERIFY_MSG ;
1019
1017
msg_file = NULL ;
1020
1018
goto fast_forward_edit ;
1021
1019
}
@@ -1263,18 +1261,23 @@ static int parse_insn_line(struct todo_item *item, const char *bol, char *eol)
1263
1261
if (i >= TODO_COMMENT )
1264
1262
return -1 ;
1265
1263
1264
+ /* Eat up extra spaces/ tabs before object name */
1265
+ padding = strspn (bol , " \t" );
1266
+ bol += padding ;
1267
+
1266
1268
if (item -> command == TODO_NOOP ) {
1269
+ if (bol != eol )
1270
+ return error (_ ("%s does not accept arguments: '%s'" ),
1271
+ command_to_string (item -> command ), bol );
1267
1272
item -> commit = NULL ;
1268
1273
item -> arg = bol ;
1269
1274
item -> arg_len = eol - bol ;
1270
1275
return 0 ;
1271
1276
}
1272
1277
1273
- /* Eat up extra spaces/ tabs before object name */
1274
- padding = strspn (bol , " \t" );
1275
1278
if (!padding )
1276
- return -1 ;
1277
- bol += padding ;
1279
+ return error ( _ ( "missing arguments for %s" ),
1280
+ command_to_string ( item -> command )) ;
1278
1281
1279
1282
if (item -> command == TODO_EXEC ) {
1280
1283
item -> commit = NULL ;
@@ -2583,7 +2586,10 @@ int transform_todos(unsigned flags)
2583
2586
strbuf_addf (& buf , " %s" , oid );
2584
2587
}
2585
2588
/* add all the rest */
2586
- strbuf_addf (& buf , " %.*s\n" , item -> arg_len , item -> arg );
2589
+ if (!item -> arg_len )
2590
+ strbuf_addch (& buf , '\n' );
2591
+ else
2592
+ strbuf_addf (& buf , " %.*s\n" , item -> arg_len , item -> arg );
2587
2593
}
2588
2594
2589
2595
i = write_message (buf .buf , buf .len , todo_file , 0 );
0 commit comments