Skip to content

Commit 5e1e6b9

Browse files
artagnongitster
authored andcommitted
revert: prettify fatal messages
Some of the fatal messages printed by revert and cherry-pick look ugly like the following: fatal: Could not open .git/sequencer/todo.: No such file or directory The culprit here is that these callers of the die_errno() function did not take it into account that the message string they give to it is followed by ": <strerror>", hence the message typically should not end with the full-stop. Signed-off-by: Ramkumar Ramachandra <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent f0c7fd4 commit 5e1e6b9

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

builtin/revert.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ static void write_message(struct strbuf *msgbuf, const char *filename)
331331
int msg_fd = hold_lock_file_for_update(&msg_file, filename,
332332
LOCK_DIE_ON_ERROR);
333333
if (write_in_full(msg_fd, msgbuf->buf, msgbuf->len) < 0)
334-
die_errno(_("Could not write to %s."), filename);
334+
die_errno(_("Could not write to %s"), filename);
335335
strbuf_release(msgbuf);
336336
if (commit_lock_file(&msg_file) < 0)
337337
die(_("Error wrapping up %s"), filename);
@@ -767,7 +767,7 @@ static void read_populate_todo(struct commit_list **todo_list,
767767

768768
fd = open(todo_file, O_RDONLY);
769769
if (fd < 0)
770-
die_errno(_("Could not open %s."), todo_file);
770+
die_errno(_("Could not open %s"), todo_file);
771771
if (strbuf_read(&buf, fd, 0) < 0) {
772772
close(fd);
773773
strbuf_release(&buf);
@@ -845,7 +845,7 @@ static int create_seq_dir(void)
845845
if (file_exists(seq_dir))
846846
return error(_("%s already exists."), seq_dir);
847847
else if (mkdir(seq_dir, 0777) < 0)
848-
die_errno(_("Could not create sequencer directory '%s'."), seq_dir);
848+
die_errno(_("Could not create sequencer directory %s"), seq_dir);
849849
return 0;
850850
}
851851

@@ -859,7 +859,7 @@ static void save_head(const char *head)
859859
fd = hold_lock_file_for_update(&head_lock, head_file, LOCK_DIE_ON_ERROR);
860860
strbuf_addf(&buf, "%s\n", head);
861861
if (write_in_full(fd, buf.buf, buf.len) < 0)
862-
die_errno(_("Could not write to %s."), head_file);
862+
die_errno(_("Could not write to %s"), head_file);
863863
if (commit_lock_file(&head_lock) < 0)
864864
die(_("Error wrapping up %s."), head_file);
865865
}
@@ -876,7 +876,7 @@ static void save_todo(struct commit_list *todo_list, struct replay_opts *opts)
876876
die(_("Could not format %s."), todo_file);
877877
if (write_in_full(fd, buf.buf, buf.len) < 0) {
878878
strbuf_release(&buf);
879-
die_errno(_("Could not write to %s."), todo_file);
879+
die_errno(_("Could not write to %s"), todo_file);
880880
}
881881
if (commit_lock_file(&todo_lock) < 0) {
882882
strbuf_release(&buf);

0 commit comments

Comments
 (0)