* [PATCH] revert: prettify fatal messages
@ 2011-11-15 9:31 Ramkumar Ramachandra
2011-11-15 10:04 ` Matthieu Moy
2011-11-16 1:05 ` Junio C Hamano
0 siblings, 2 replies; 5+ messages in thread
From: Ramkumar Ramachandra @ 2011-11-15 9:31 UTC (permalink / raw)
To: Git List; +Cc: Junio C Hamano, Jonathan Nieder
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 the die_errno() function that takes a custom error
message string as an argument and appends ": <message from errno>"
before printing it. So, we can fix the problem by not terminating the
string argument to the function with a '.' (period). Fatal messages
look nicer now:
fatal: Could not open .git/sequencer/todo: No such file or directory
Signed-off-by: Ramkumar Ramachandra <artagnon@gmail.com>
---
Candidate for 'maint'?
builtin/revert.c | 10 +++++-----
1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/builtin/revert.c b/builtin/revert.c
index 87df70e..e0319c8 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -331,7 +331,7 @@ static void write_message(struct strbuf *msgbuf, const char *filename)
int msg_fd = hold_lock_file_for_update(&msg_file, filename,
LOCK_DIE_ON_ERROR);
if (write_in_full(msg_fd, msgbuf->buf, msgbuf->len) < 0)
- die_errno(_("Could not write to %s."), filename);
+ die_errno(_("Could not write to %s"), filename);
strbuf_release(msgbuf);
if (commit_lock_file(&msg_file) < 0)
die(_("Error wrapping up %s"), filename);
@@ -767,7 +767,7 @@ static void read_populate_todo(struct commit_list **todo_list,
fd = open(todo_file, O_RDONLY);
if (fd < 0)
- die_errno(_("Could not open %s."), todo_file);
+ die_errno(_("Could not open %s"), todo_file);
if (strbuf_read(&buf, fd, 0) < 0) {
close(fd);
strbuf_release(&buf);
@@ -845,7 +845,7 @@ static int create_seq_dir(void)
if (file_exists(seq_dir))
return error(_("%s already exists."), seq_dir);
else if (mkdir(seq_dir, 0777) < 0)
- die_errno(_("Could not create sequencer directory '%s'."), seq_dir);
+ die_errno(_("Could not create sequencer directory %s"), seq_dir);
return 0;
}
@@ -859,7 +859,7 @@ static void save_head(const char *head)
fd = hold_lock_file_for_update(&head_lock, head_file, LOCK_DIE_ON_ERROR);
strbuf_addf(&buf, "%s\n", head);
if (write_in_full(fd, buf.buf, buf.len) < 0)
- die_errno(_("Could not write to %s."), head_file);
+ die_errno(_("Could not write to %s"), head_file);
if (commit_lock_file(&head_lock) < 0)
die(_("Error wrapping up %s."), head_file);
}
@@ -876,7 +876,7 @@ static void save_todo(struct commit_list *todo_list, struct replay_opts *opts)
die(_("Could not format %s."), todo_file);
if (write_in_full(fd, buf.buf, buf.len) < 0) {
strbuf_release(&buf);
- die_errno(_("Could not write to %s."), todo_file);
+ die_errno(_("Could not write to %s"), todo_file);
}
if (commit_lock_file(&todo_lock) < 0) {
strbuf_release(&buf);
--
1.7.6.351.gb35ac.dirty
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] revert: prettify fatal messages
2011-11-15 9:31 [PATCH] revert: prettify fatal messages Ramkumar Ramachandra
@ 2011-11-15 10:04 ` Matthieu Moy
2011-11-16 1:05 ` Junio C Hamano
1 sibling, 0 replies; 5+ messages in thread
From: Matthieu Moy @ 2011-11-15 10:04 UTC (permalink / raw)
To: Ramkumar Ramachandra; +Cc: Git List, Junio C Hamano, Jonathan Nieder
Ramkumar Ramachandra <artagnon@gmail.com> writes:
> 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 the die_errno() function that takes a custom error
> message string as an argument and appends ": <message from errno>"
> before printing it. So, we can fix the problem by not terminating the
> string argument to the function with a '.' (period). Fatal messages
> look nicer now:
>
> fatal: Could not open .git/sequencer/todo: No such file or directory
Sounds (obviously) good.
(I just misread the subject line at first, and understood that this was
a revert of an earlier commit, while this is actually a commit touching
the "revert" part of Git)
--
Matthieu Moy
http://www-verimag.imag.fr/~moy/
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] revert: prettify fatal messages
2011-11-15 9:31 [PATCH] revert: prettify fatal messages Ramkumar Ramachandra
2011-11-15 10:04 ` Matthieu Moy
@ 2011-11-16 1:05 ` Junio C Hamano
2011-11-16 6:23 ` Ramkumar Ramachandra
1 sibling, 1 reply; 5+ messages in thread
From: Junio C Hamano @ 2011-11-16 1:05 UTC (permalink / raw)
To: Ramkumar Ramachandra; +Cc: Git List, Jonathan Nieder
Ramkumar Ramachandra <artagnon@gmail.com> writes:
> Candidate for 'maint'?
Too minor to matter when 'master' is already at -rc2.
Thanks.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] revert: prettify fatal messages
2011-11-16 1:05 ` Junio C Hamano
@ 2011-11-16 6:23 ` Ramkumar Ramachandra
2011-11-16 6:42 ` Jonathan Nieder
0 siblings, 1 reply; 5+ messages in thread
From: Ramkumar Ramachandra @ 2011-11-16 6:23 UTC (permalink / raw)
To: Junio C Hamano; +Cc: Git List, Jonathan Nieder, Matthieu Moy
Hi,
Matthieu Moy wrote:
> (I just misread the subject line at first, and understood that this was> a revert of an earlier commit, while this is actually a commit touching> the "revert" part of Git)
Reminds me of an earlier note Jonathan made about the git-revert
commit message format. To avoid confusion, reverts should always look
like the following:
Revert [commit message]
This reverts commit [unabbreviated sha1 hex].
Junio C Hamano wrote:
> Ramkumar Ramachandra <artagnon@gmail.com> writes:
>> Candidate for 'maint'?
>
> Too minor to matter when 'master' is already at -rc2.
Ah, I haven't been paying much attention to these release cycles. I
suppose we can put this patch in `master` after the release? I wince
everytime I see these ugly fatal messages: it happens shockingly often
while testing :)
Thanks.
-- Ram
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] revert: prettify fatal messages
2011-11-16 6:23 ` Ramkumar Ramachandra
@ 2011-11-16 6:42 ` Jonathan Nieder
0 siblings, 0 replies; 5+ messages in thread
From: Jonathan Nieder @ 2011-11-16 6:42 UTC (permalink / raw)
To: Ramkumar Ramachandra; +Cc: Junio C Hamano, Git List, Matthieu Moy
Ramkumar Ramachandra wrote:
> To avoid confusion, reverts should always look
> like the following:
>
> Revert [commit message]
>
> This reverts commit [unabbreviated sha1 hex].
Don't forget the description of why it is being reverted. :)
Actually, I think Matthieu's confusion makes a lot of sense. I don't
think it matters very much, but it can sometimes be clearer to say
"cherry-pick/revert: remove spurious period in error message".
Another benefit to moving the juicy part to sequencer.c, I guess.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2011-11-16 6:42 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-15 9:31 [PATCH] revert: prettify fatal messages Ramkumar Ramachandra
2011-11-15 10:04 ` Matthieu Moy
2011-11-16 1:05 ` Junio C Hamano
2011-11-16 6:23 ` Ramkumar Ramachandra
2011-11-16 6:42 ` Jonathan Nieder
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).