sequencer: start error messages consistently with lower case
Quite a few error messages touched by this developer during the work to speed up rebase -i started with an upper case letter, violating our current conventions. Instead of sneaking in this fix (and forgetting quite a few error messages), let's just have one wholesale patch fixing all of the error messages in the sequencer. While at it, the funny "error: Error wrapping up..." was changed to a less funny, but more helpful, "error: failed to finalize...". Pointed out by Junio Hamano. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Johannes Schindelin committed
Oct 21, 2016 at 14:26 UTC
93b3df6f147fa2bf10116aaeb3597e0b6becaf35
2 files changed
+35
-35
sequencer.c
+34
-34
@@ -241,18 +241,18 @@ static int write_message(const void *buf, size_t len, const char *filename,
241
242
int msg_fd = hold_lock_file_for_update(&msg_file, filename, 0);
243
if (msg_fd < 0)
244
- return error_errno(_("Could not lock '%s'"), filename);
244
+ return error_errno(_("could not lock '%s'"), filename);
245
if (write_in_full(msg_fd, buf, len) < 0) {
246
rollback_lock_file(&msg_file);
247
- return error_errno(_("Could not write to '%s'"), filename);
247
+ return error_errno(_("could not write to '%s'"), filename);
248
}
249
if (append_eol && write(msg_fd, "\n", 1) < 0) {
250
rollback_lock_file(&msg_file);
251
- return error_errno(_("Could not write eol to '%s"), filename);
251
+ return error_errno(_("could not write eol to '%s"), filename);
252
}
253
if (commit_lock_file(&msg_file) < 0) {
254
rollback_lock_file(&msg_file);
255
- return error(_("Error wrapping up '%s'."), filename);
255
+ return error(_("failed to finalize '%s'."), filename);
256
}
257
258
return 0;
@@ -302,11 +302,11 @@ static int error_dirty_index(struct replay_opts *opts)
302
if (read_cache_unmerged())
303
return error_resolve_conflict(_(action_name(opts)));
304
305
- error(_("Your local changes would be overwritten by %s."),
305
+ error(_("your local changes would be overwritten by %s."),
306
_(action_name(opts)));
307
308
if (advice_commit_before_merge)
309
- advise(_("Commit your changes or stash them to proceed."));
309
+ advise(_("commit your changes or stash them to proceed."));
310
return -1;
311
}
312
@@ -415,7 +415,7 @@ static int is_index_unchanged(void)
415
struct commit *head_commit;
416
417
if (!resolve_ref_unsafe("HEAD", RESOLVE_REF_READING, head_sha1, NULL))
418
- return error(_("Could not resolve HEAD commit\n"));
418
+ return error(_("could not resolve HEAD commit\n"));
419
420
head_commit = lookup_commit(head_sha1);
421
@@ -435,7 +435,7 @@ static int is_index_unchanged(void)
435
436
if (!cache_tree_fully_valid(active_cache_tree))
437
if (cache_tree_update(&the_index, 0))
438
- return error(_("Unable to update cache tree\n"));
438
+ return error(_("unable to update cache tree\n"));
439
440
return !hashcmp(active_cache_tree->sha1, head_commit->tree->object.oid.hash);
441
}
@@ -505,7 +505,7 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts,
505
if (!env) {
506
const char *gpg_opt = gpg_sign_opt_quoted(opts);
507
508
- return error("You have staged changes in your working "
508
+ return error("you have staged changes in your working "
509
"tree. If these changes are meant to be\n"
510
"squashed into the previous commit, run:\n\n"
511
" git commit --amend %s\n\n"
@@ -558,12 +558,12 @@ static int is_original_commit_empty(struct commit *commit)
558
const unsigned char *ptree_sha1;
559
560
if (parse_commit(commit))
561
- return error(_("Could not parse commit %s\n"),
561
+ return error(_("could not parse commit %s\n"),
562
oid_to_hex(&commit->object.oid));
563
if (commit->parents) {
564
struct commit *parent = commit->parents->item;
565
if (parse_commit(parent))
566
- return error(_("Could not parse parent commit %s\n"),
566
+ return error(_("could not parse parent commit %s\n"),
567
oid_to_hex(&parent->object.oid));
568
ptree_sha1 = parent->tree->object.oid.hash;
569
} else {
@@ -647,7 +647,7 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
647
* to work on.
648
*/
649
if (write_cache_as_tree(head, 0, NULL))
650
- return error(_("Your index file is unmerged."));
650
+ return error(_("your index file is unmerged."));
651
} else {
652
unborn = get_sha1("HEAD", head);
653
if (unborn)
@@ -666,7 +666,7 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
666
struct commit_list *p;
667
668
if (!opts->mainline)
669
- return error(_("Commit %s is a merge but no -m option was given."),
669
+ return error(_("commit %s is a merge but no -m option was given."),
670
oid_to_hex(&commit->object.oid));
671
672
for (cnt = 1, p = commit->parents;
@@ -674,11 +674,11 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
674
cnt++)
675
p = p->next;
676
if (cnt != opts->mainline || !p)
677
- return error(_("Commit %s does not have parent %d"),
677
+ return error(_("commit %s does not have parent %d"),
678
oid_to_hex(&commit->object.oid), opts->mainline);
679
parent = p->item;
680
} else if (0 < opts->mainline)
681
- return error(_("Mainline was specified but commit %s is not a merge."),
681
+ return error(_("mainline was specified but commit %s is not a merge."),
682
oid_to_hex(&commit->object.oid));
683
else
684
parent = commit->parents->item;
@@ -696,7 +696,7 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
696
oid_to_hex(&parent->object.oid));
697
698
if (get_message(commit, &msg) != 0)
699
- return error(_("Cannot get commit message for %s"),
699
+ return error(_("cannot get commit message for %s"),
700
oid_to_hex(&commit->object.oid));
701
702
/*
@@ -935,13 +935,13 @@ static int parse_insn_buffer(char *buf, struct todo_list *todo_list)
935
item = append_new_todo(todo_list);
936
item->offset_in_buf = p - todo_list->buf.buf;
937
if (parse_insn_line(item, p, eol)) {
938
- res = error(_("Invalid line %d: %.*s"),
938
+ res = error(_("invalid line %d: %.*s"),
939
i, (int)(eol - p), p);
940
item->command = -1;
941
}
942
}
943
if (!todo_list->nr)
944
- return error(_("No commits parsed."));
944
+ return error(_("no commits parsed."));
945
return res;
946
}
947
@@ -954,16 +954,16 @@ static int read_populate_todo(struct todo_list *todo_list,
954
strbuf_reset(&todo_list->buf);
955
fd = open(todo_file, O_RDONLY);
956
if (fd < 0)
957
- return error_errno(_("Could not open '%s'"), todo_file);
957
+ return error_errno(_("could not open '%s'"), todo_file);
958
if (strbuf_read(&todo_list->buf, fd, 0) < 0) {
959
close(fd);
960
- return error(_("Could not read '%s'."), todo_file);
960
+ return error(_("could not read '%s'."), todo_file);
961
}
962
close(fd);
963
964
res = parse_insn_buffer(todo_list->buf.buf, todo_list);
965
if (res)
966
- return error(_("Unusable instruction sheet: '%s'"), todo_file);
966
+ return error(_("unusable instruction sheet: '%s'"), todo_file);
967
968
if (!is_rebase_i(opts)) {
969
enum todo_command valid =
@@ -974,9 +974,9 @@ static int read_populate_todo(struct todo_list *todo_list,
974
if (valid == todo_list->items[i].command)
975
continue;
976
else if (valid == TODO_PICK)
977
- return error(_("Cannot cherry-pick during a revert."));
977
+ return error(_("cannot cherry-pick during a revert."));
978
else
979
- return error(_("Cannot revert during a cherry-pick."));
979
+ return error(_("cannot revert during a cherry-pick."));
980
}
981
982
return 0;
@@ -1019,10 +1019,10 @@ static int populate_opts_cb(const char *key, const char *value, void *data)
1019
ALLOC_GROW(opts->xopts, opts->xopts_nr + 1, opts->xopts_alloc);
1020
opts->xopts[opts->xopts_nr++] = xstrdup(value);
1021
} else
1022
- return error(_("Invalid key: %s"), key);
1022
+ return error(_("invalid key: %s"), key);
1023
1024
if (!error_flag)
1025
- return error(_("Invalid value for %s: %s"), key, value);
1025
+ return error(_("invalid value for %s: %s"), key, value);
1026
1027
return 0;
1028
}
@@ -1054,7 +1054,7 @@ static int read_populate_opts(struct replay_opts *opts)
1054
* are pretty certain that it is syntactically correct.
1055
*/
1056
if (git_config_from_file(populate_opts_cb, git_path_opts_file(), opts) < 0)
1057
- return error(_("Malformed options sheet: '%s'"),
1057
+ return error(_("malformed options sheet: '%s'"),
1058
git_path_opts_file());
1059
return 0;
1060
}
@@ -1097,7 +1097,7 @@ static int create_seq_dir(void)
1097
return -1;
1098
}
1099
else if (mkdir(git_path_seq_dir(), 0777) < 0)
1100
- return error_errno(_("Could not create sequencer directory '%s'"),
1100
+ return error_errno(_("could not create sequencer directory '%s'"),
1101
git_path_seq_dir());
1102
return 0;
1103
}
@@ -1111,17 +1111,17 @@ static int save_head(const char *head)
1111
fd = hold_lock_file_for_update(&head_lock, git_path_head_file(), 0);
1112
if (fd < 0) {
1113
rollback_lock_file(&head_lock);
1114
- return error_errno(_("Could not lock HEAD"));
1114
+ return error_errno(_("could not lock HEAD"));
1115
}
1116
strbuf_addf(&buf, "%s\n", head);
1117
if (write_in_full(fd, buf.buf, buf.len) < 0) {
1118
rollback_lock_file(&head_lock);
1119
- return error_errno(_("Could not write to '%s'"),
1119
+ return error_errno(_("could not write to '%s'"),
1120
git_path_head_file());
1121
}
1122
if (commit_lock_file(&head_lock) < 0) {
1123
rollback_lock_file(&head_lock);
1124
- return error(_("Error wrapping up '%s'."), git_path_head_file());
1124
+ return error(_("failed to finalize '%s'."), git_path_head_file());
1125
}
1126
return 0;
1127
}
@@ -1200,14 +1200,14 @@ static int save_todo(struct todo_list *todo_list, struct replay_opts *opts)
1200
1201
fd = hold_lock_file_for_update(&todo_lock, todo_path, 0);
1202
if (fd < 0)
1203
- return error_errno(_("Could not lock '%s'"), todo_path);
1203
+ return error_errno(_("could not lock '%s'"), todo_path);
1204
offset = next < todo_list->nr ?
1205
todo_list->items[next].offset_in_buf : todo_list->buf.len;
1206
if (write_in_full(fd, todo_list->buf.buf + offset,
1207
todo_list->buf.len - offset) < 0)
1208
- return error_errno(_("Could not write to '%s'"), todo_path);
1208
+ return error_errno(_("could not write to '%s'"), todo_path);
1209
if (commit_lock_file(&todo_lock) < 0)
1210
- return error(_("Error wrapping up '%s'."), todo_path);
1210
+ return error(_("failed to finalize '%s'."), todo_path);
1211
return 0;
1212
}
1213
@@ -1382,7 +1382,7 @@ int sequencer_pick_revisions(struct replay_opts *opts)
1382
create_seq_dir() < 0)
1383
return -1;
1384
if (get_sha1("HEAD", sha1) && (opts->action == REPLAY_REVERT))
1385
- return error(_("Can't revert as initial commit"));
1385
+ return error(_("can't revert as initial commit"));
1386
if (save_head(sha1_to_hex(sha1)))
1387
return -1;
1388
if (save_opts(opts))
t/t3501-revert-cherry-pick.sh
+1
-1
@@ -96,7 +96,7 @@ test_expect_success 'revert forbidden on dirty working tree' '
96
echo content >extra_file &&
97
git add extra_file &&
98
test_must_fail git revert HEAD 2>errors &&
99
- test_i18ngrep "Your local changes would be overwritten by " errors
99
+ test_i18ngrep "your local changes would be overwritten by " errors
100
101
'
102