@@ -493,7 +493,7 @@ static int is_index_unchanged(void)
493493 struct commit * head_commit ;
494494
495495 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" ));
497497
498498 head_commit = lookup_commit (& head_oid );
499499
@@ -513,7 +513,7 @@ static int is_index_unchanged(void)
513513
514514 if (!cache_tree_fully_valid (active_cache_tree ))
515515 if (cache_tree_update (& the_index , 0 ))
516- return error (_ ("unable to update cache tree\n " ));
516+ return error (_ ("unable to update cache tree" ));
517517
518518 return !oidcmp (& active_cache_tree -> oid ,
519519 & head_commit -> tree -> object .oid );
@@ -699,12 +699,12 @@ static int is_original_commit_empty(struct commit *commit)
699699 const struct object_id * ptree_oid ;
700700
701701 if (parse_commit (commit ))
702- return error (_ ("could not parse commit %s\n " ),
702+ return error (_ ("could not parse commit %s" ),
703703 oid_to_hex (& commit -> object .oid ));
704704 if (commit -> parents ) {
705705 struct commit * parent = commit -> parents -> item ;
706706 if (parse_commit (parent ))
707- return error (_ ("could not parse parent commit %s\n " ),
707+ return error (_ ("could not parse parent commit %s" ),
708708 oid_to_hex (& parent -> object .oid ));
709709 ptree_oid = & parent -> tree -> object .oid ;
710710 } else {
@@ -1013,9 +1013,7 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
10131013 opts );
10141014 if (res || command != TODO_REWORD )
10151015 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 ;
10191017 msg_file = NULL ;
10201018 goto fast_forward_edit ;
10211019 }
@@ -1263,18 +1261,23 @@ static int parse_insn_line(struct todo_item *item, const char *bol, char *eol)
12631261 if (i >= TODO_COMMENT )
12641262 return -1 ;
12651263
1264+ /* Eat up extra spaces/ tabs before object name */
1265+ padding = strspn (bol , " \t" );
1266+ bol += padding ;
1267+
12661268 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 );
12671272 item -> commit = NULL ;
12681273 item -> arg = bol ;
12691274 item -> arg_len = eol - bol ;
12701275 return 0 ;
12711276 }
12721277
1273- /* Eat up extra spaces/ tabs before object name */
1274- padding = strspn (bol , " \t" );
12751278 if (!padding )
1276- return -1 ;
1277- bol += padding ;
1279+ return error ( _ ( "missing arguments for %s" ),
1280+ command_to_string ( item -> command )) ;
12781281
12791282 if (item -> command == TODO_EXEC ) {
12801283 item -> commit = NULL ;
@@ -2583,7 +2586,10 @@ int transform_todos(unsigned flags)
25832586 strbuf_addf (& buf , " %s" , oid );
25842587 }
25852588 /* 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 );
25872593 }
25882594
25892595 i = write_message (buf .buf , buf .len , todo_file , 0 );
0 commit comments