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 <artagnon@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Ramkumar Ramachandra committed
Nov 15, 2011 at 15:01 UTC
5e1e6b93d024b5a01f4e957a2bedba899cb22f68
1 file changed
+5
-5
builtin/revert.c
+5
-5
@@ -331,7 +331,7 @@ static void write_message(struct strbuf *msgbuf, const char *filename)
331
int msg_fd = hold_lock_file_for_update(&msg_file, filename,
332
LOCK_DIE_ON_ERROR);
333
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);
335
strbuf_release(msgbuf);
336
if (commit_lock_file(&msg_file) < 0)
337
die(_("Error wrapping up %s"), filename);
@@ -767,7 +767,7 @@ static void read_populate_todo(struct commit_list **todo_list,
767
768
fd = open(todo_file, O_RDONLY);
769
if (fd < 0)
770
- die_errno(_("Could not open %s."), todo_file);
770
+ die_errno(_("Could not open %s"), todo_file);
771
if (strbuf_read(&buf, fd, 0) < 0) {
772
close(fd);
773
strbuf_release(&buf);
@@ -845,7 +845,7 @@ static int create_seq_dir(void)
845
if (file_exists(seq_dir))
846
return error(_("%s already exists."), seq_dir);
847
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);
849
return 0;
850
}
851
@@ -859,7 +859,7 @@ static void save_head(const char *head)
859
fd = hold_lock_file_for_update(&head_lock, head_file, LOCK_DIE_ON_ERROR);
860
strbuf_addf(&buf, "%s\n", head);
861
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);
863
if (commit_lock_file(&head_lock) < 0)
864
die(_("Error wrapping up %s."), head_file);
865
}
@@ -876,7 +876,7 @@ static void save_todo(struct commit_list *todo_list, struct replay_opts *opts)
876
die(_("Could not format %s."), todo_file);
877
if (write_in_full(fd, buf.buf, buf.len) < 0) {
878
strbuf_release(&buf);
879
- die_errno(_("Could not write to %s."), todo_file);
879
+ die_errno(_("Could not write to %s"), todo_file);
880
}
881
if (commit_lock_file(&todo_lock) < 0) {
882
strbuf_release(&buf);