Skip to content

Commit 93b3df6

Browse files
dschogitster
authored andcommitted
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 <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f7ed195 commit 93b3df6

File tree

2 files changed

+35
-35
lines changed

2 files changed

+35
-35
lines changed

sequencer.c

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -241,18 +241,18 @@ static int write_message(const void *buf, size_t len, const char *filename,
241241

242242
int msg_fd = hold_lock_file_for_update(&msg_file, filename, 0);
243243
if (msg_fd < 0)
244-
return error_errno(_("Could not lock '%s'"), filename);
244+
return error_errno(_("could not lock '%s'"), filename);
245245
if (write_in_full(msg_fd, buf, len) < 0) {
246246
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);
248248
}
249249
if (append_eol && write(msg_fd, "\n", 1) < 0) {
250250
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);
252252
}
253253
if (commit_lock_file(&msg_file) < 0) {
254254
rollback_lock_file(&msg_file);
255-
return error(_("Error wrapping up '%s'."), filename);
255+
return error(_("failed to finalize '%s'."), filename);
256256
}
257257

258258
return 0;
@@ -302,11 +302,11 @@ static int error_dirty_index(struct replay_opts *opts)
302302
if (read_cache_unmerged())
303303
return error_resolve_conflict(_(action_name(opts)));
304304

305-
error(_("Your local changes would be overwritten by %s."),
305+
error(_("your local changes would be overwritten by %s."),
306306
_(action_name(opts)));
307307

308308
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."));
310310
return -1;
311311
}
312312

@@ -415,7 +415,7 @@ static int is_index_unchanged(void)
415415
struct commit *head_commit;
416416

417417
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"));
419419

420420
head_commit = lookup_commit(head_sha1);
421421

@@ -435,7 +435,7 @@ static int is_index_unchanged(void)
435435

436436
if (!cache_tree_fully_valid(active_cache_tree))
437437
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"));
439439

440440
return !hashcmp(active_cache_tree->sha1, head_commit->tree->object.oid.hash);
441441
}
@@ -505,7 +505,7 @@ static int run_git_commit(const char *defmsg, struct replay_opts *opts,
505505
if (!env) {
506506
const char *gpg_opt = gpg_sign_opt_quoted(opts);
507507

508-
return error("You have staged changes in your working "
508+
return error("you have staged changes in your working "
509509
"tree. If these changes are meant to be\n"
510510
"squashed into the previous commit, run:\n\n"
511511
" git commit --amend %s\n\n"
@@ -558,12 +558,12 @@ static int is_original_commit_empty(struct commit *commit)
558558
const unsigned char *ptree_sha1;
559559

560560
if (parse_commit(commit))
561-
return error(_("Could not parse commit %s\n"),
561+
return error(_("could not parse commit %s\n"),
562562
oid_to_hex(&commit->object.oid));
563563
if (commit->parents) {
564564
struct commit *parent = commit->parents->item;
565565
if (parse_commit(parent))
566-
return error(_("Could not parse parent commit %s\n"),
566+
return error(_("could not parse parent commit %s\n"),
567567
oid_to_hex(&parent->object.oid));
568568
ptree_sha1 = parent->tree->object.oid.hash;
569569
} else {
@@ -647,7 +647,7 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
647647
* to work on.
648648
*/
649649
if (write_cache_as_tree(head, 0, NULL))
650-
return error(_("Your index file is unmerged."));
650+
return error(_("your index file is unmerged."));
651651
} else {
652652
unborn = get_sha1("HEAD", head);
653653
if (unborn)
@@ -666,19 +666,19 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
666666
struct commit_list *p;
667667

668668
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."),
670670
oid_to_hex(&commit->object.oid));
671671

672672
for (cnt = 1, p = commit->parents;
673673
cnt != opts->mainline && p;
674674
cnt++)
675675
p = p->next;
676676
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"),
678678
oid_to_hex(&commit->object.oid), opts->mainline);
679679
parent = p->item;
680680
} 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."),
682682
oid_to_hex(&commit->object.oid));
683683
else
684684
parent = commit->parents->item;
@@ -696,7 +696,7 @@ static int do_pick_commit(enum todo_command command, struct commit *commit,
696696
oid_to_hex(&parent->object.oid));
697697

698698
if (get_message(commit, &msg) != 0)
699-
return error(_("Cannot get commit message for %s"),
699+
return error(_("cannot get commit message for %s"),
700700
oid_to_hex(&commit->object.oid));
701701

702702
/*
@@ -935,13 +935,13 @@ static int parse_insn_buffer(char *buf, struct todo_list *todo_list)
935935
item = append_new_todo(todo_list);
936936
item->offset_in_buf = p - todo_list->buf.buf;
937937
if (parse_insn_line(item, p, eol)) {
938-
res = error(_("Invalid line %d: %.*s"),
938+
res = error(_("invalid line %d: %.*s"),
939939
i, (int)(eol - p), p);
940940
item->command = -1;
941941
}
942942
}
943943
if (!todo_list->nr)
944-
return error(_("No commits parsed."));
944+
return error(_("no commits parsed."));
945945
return res;
946946
}
947947

@@ -954,16 +954,16 @@ static int read_populate_todo(struct todo_list *todo_list,
954954
strbuf_reset(&todo_list->buf);
955955
fd = open(todo_file, O_RDONLY);
956956
if (fd < 0)
957-
return error_errno(_("Could not open '%s'"), todo_file);
957+
return error_errno(_("could not open '%s'"), todo_file);
958958
if (strbuf_read(&todo_list->buf, fd, 0) < 0) {
959959
close(fd);
960-
return error(_("Could not read '%s'."), todo_file);
960+
return error(_("could not read '%s'."), todo_file);
961961
}
962962
close(fd);
963963

964964
res = parse_insn_buffer(todo_list->buf.buf, todo_list);
965965
if (res)
966-
return error(_("Unusable instruction sheet: '%s'"), todo_file);
966+
return error(_("unusable instruction sheet: '%s'"), todo_file);
967967

968968
if (!is_rebase_i(opts)) {
969969
enum todo_command valid =
@@ -974,9 +974,9 @@ static int read_populate_todo(struct todo_list *todo_list,
974974
if (valid == todo_list->items[i].command)
975975
continue;
976976
else if (valid == TODO_PICK)
977-
return error(_("Cannot cherry-pick during a revert."));
977+
return error(_("cannot cherry-pick during a revert."));
978978
else
979-
return error(_("Cannot revert during a cherry-pick."));
979+
return error(_("cannot revert during a cherry-pick."));
980980
}
981981

982982
return 0;
@@ -1019,10 +1019,10 @@ static int populate_opts_cb(const char *key, const char *value, void *data)
10191019
ALLOC_GROW(opts->xopts, opts->xopts_nr + 1, opts->xopts_alloc);
10201020
opts->xopts[opts->xopts_nr++] = xstrdup(value);
10211021
} else
1022-
return error(_("Invalid key: %s"), key);
1022+
return error(_("invalid key: %s"), key);
10231023

10241024
if (!error_flag)
1025-
return error(_("Invalid value for %s: %s"), key, value);
1025+
return error(_("invalid value for %s: %s"), key, value);
10261026

10271027
return 0;
10281028
}
@@ -1054,7 +1054,7 @@ static int read_populate_opts(struct replay_opts *opts)
10541054
* are pretty certain that it is syntactically correct.
10551055
*/
10561056
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'"),
10581058
git_path_opts_file());
10591059
return 0;
10601060
}
@@ -1097,7 +1097,7 @@ static int create_seq_dir(void)
10971097
return -1;
10981098
}
10991099
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'"),
11011101
git_path_seq_dir());
11021102
return 0;
11031103
}
@@ -1111,17 +1111,17 @@ static int save_head(const char *head)
11111111
fd = hold_lock_file_for_update(&head_lock, git_path_head_file(), 0);
11121112
if (fd < 0) {
11131113
rollback_lock_file(&head_lock);
1114-
return error_errno(_("Could not lock HEAD"));
1114+
return error_errno(_("could not lock HEAD"));
11151115
}
11161116
strbuf_addf(&buf, "%s\n", head);
11171117
if (write_in_full(fd, buf.buf, buf.len) < 0) {
11181118
rollback_lock_file(&head_lock);
1119-
return error_errno(_("Could not write to '%s'"),
1119+
return error_errno(_("could not write to '%s'"),
11201120
git_path_head_file());
11211121
}
11221122
if (commit_lock_file(&head_lock) < 0) {
11231123
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());
11251125
}
11261126
return 0;
11271127
}
@@ -1200,14 +1200,14 @@ static int save_todo(struct todo_list *todo_list, struct replay_opts *opts)
12001200

12011201
fd = hold_lock_file_for_update(&todo_lock, todo_path, 0);
12021202
if (fd < 0)
1203-
return error_errno(_("Could not lock '%s'"), todo_path);
1203+
return error_errno(_("could not lock '%s'"), todo_path);
12041204
offset = next < todo_list->nr ?
12051205
todo_list->items[next].offset_in_buf : todo_list->buf.len;
12061206
if (write_in_full(fd, todo_list->buf.buf + offset,
12071207
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);
12091209
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);
12111211
return 0;
12121212
}
12131213

@@ -1382,7 +1382,7 @@ int sequencer_pick_revisions(struct replay_opts *opts)
13821382
create_seq_dir() < 0)
13831383
return -1;
13841384
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"));
13861386
if (save_head(sha1_to_hex(sha1)))
13871387
return -1;
13881388
if (save_opts(opts))

t/t3501-revert-cherry-pick.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ test_expect_success 'revert forbidden on dirty working tree' '
9696
echo content >extra_file &&
9797
git add extra_file &&
9898
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
100100
101101
'
102102

0 commit comments

Comments
 (0)