git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Vincent van Ravesteijn <vfr@lyx.org>
To: git@vger.kernel.org
Cc: gitster@pobox.com, Vincent van Ravesteijn <vfr@lyx.org>
Subject: [PATCH 1/2] Unification of user message strings
Date: Mon, 19 Mar 2012 18:51:42 +0100	[thread overview]
Message-ID: <1332179503-2992-2-git-send-email-vfr@lyx.org> (raw)
In-Reply-To: <1332179503-2992-1-git-send-email-vfr@lyx.org>

From: Vincent van Ravesteijn <vfr@lyx.org>

Rewrite user messages to stick to a uniform style for all messages. From the surrounding code, the following guidelines were deduced:
- messages start with a capital,
- short messages do not end with a full stop,
- paths, filenames, and commands are quoted by single quotes (if not separated by the normal text by a ':'),
- 'could not' is used rather than 'cannot'.

Signed-off-by: Vincent van Ravesteijn <vfr@lyx.org>
---
 gpg-interface.c |    6 +++---
 grep.c          |    2 +-
 help.c          |    2 +-
 sequencer.c     |   24 ++++++++++++------------
 4 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/gpg-interface.c b/gpg-interface.c
index 09ab64a..5e14a21 100644
--- a/gpg-interface.c
+++ b/gpg-interface.c
@@ -56,7 +56,7 @@ int sign_buffer(struct strbuf *buffer, struct strbuf *signature, const char *sig
 	args[3] = NULL;
 
 	if (start_command(&gpg))
-		return error(_("could not run gpg."));
+		return error(_("Could not run 'gpg'"));
 
 	/*
 	 * When the username signingkey is bad, program could be terminated
@@ -68,7 +68,7 @@ int sign_buffer(struct strbuf *buffer, struct strbuf *signature, const char *sig
 		close(gpg.in);
 		close(gpg.out);
 		finish_command(&gpg);
-		return error(_("gpg did not accept the data"));
+		return error(_("'gpg' did not accept the data"));
 	}
 	close(gpg.in);
 
@@ -79,7 +79,7 @@ int sign_buffer(struct strbuf *buffer, struct strbuf *signature, const char *sig
 	sigchain_pop(SIGPIPE);
 
 	if (finish_command(&gpg) || !len || len < 0)
-		return error(_("gpg failed to sign the data"));
+		return error(_("'gpg' failed to sign the data"));
 
 	/* Strip CR from the line endings, in case we are on Windows. */
 	for (i = j = bottom; i < signature->len; i++)
diff --git a/grep.c b/grep.c
index 190139c..6e0fef5 100644
--- a/grep.c
+++ b/grep.c
@@ -1277,7 +1277,7 @@ static int grep_source_load_sha1(struct grep_source *gs)
 	grep_read_unlock();
 
 	if (!gs->buf)
-		return error(_("'%s': unable to read %s"),
+		return error(_("%s: unable to read '%s'"),
 			     gs->name,
 			     sha1_to_hex(gs->identifier));
 	return 0;
diff --git a/help.c b/help.c
index 14eefc9..5ab076b 100644
--- a/help.c
+++ b/help.c
@@ -285,7 +285,7 @@ static void add_cmd_list(struct cmdnames *cmds, struct cmdnames *old)
 
 static const char bad_interpreter_advice[] =
 	N_("'%s' appears to be a git command, but we were not\n"
-	"able to execute it. Maybe git-%s is broken?");
+	"able to execute it. Maybe 'git-%s' is broken?");
 
 const char *help_unknown_cmd(const char *cmd)
 {
diff --git a/sequencer.c b/sequencer.c
index a37846a..1554173 100644
--- a/sequencer.c
+++ b/sequencer.c
@@ -156,10 +156,10 @@ 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);
+		die(_("Error wrapping up '%s'"), filename);
 }
 
 static struct tree *empty_tree(void)
@@ -588,11 +588,11 @@ 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);
-		die(_("Could not read %s."), todo_file);
+		die(_("Could not read '%s'"), todo_file);
 	}
 	close(fd);
 
@@ -668,7 +668,7 @@ static int create_seq_dir(void)
 		return -1;
 	}
 	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;
 }
 
@@ -682,9 +682,9 @@ 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);
+		die(_("Error wrapping up '%s'"), head_file);
 }
 
 static int reset_for_rollback(const unsigned char *sha1)
@@ -729,10 +729,10 @@ static int sequencer_rollback(struct replay_opts *opts)
 		return rollback_single_pick();
 	}
 	if (!f)
-		return error(_("cannot open %s: %s"), filename,
+		return error(_("Could not open '%s': %s"), filename,
 						strerror(errno));
 	if (strbuf_getline(&buf, f, '\n')) {
-		error(_("cannot read %s: %s"), filename, ferror(f) ?
+		error(_("Could not read '%s': %s"), filename, ferror(f) ?
 			strerror(errno) : _("unexpected end of file"));
 		fclose(f);
 		goto fail;
@@ -762,14 +762,14 @@ static void save_todo(struct commit_list *todo_list, struct replay_opts *opts)
 
 	fd = hold_lock_file_for_update(&todo_lock, todo_file, LOCK_DIE_ON_ERROR);
 	if (format_todo(&buf, todo_list, opts) < 0)
-		die(_("Could not format %s."), todo_file);
+		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);
-		die(_("Error wrapping up %s."), todo_file);
+		die(_("Error wrapping up '%s'"), todo_file);
 	}
 	strbuf_release(&buf);
 }
-- 
1.7.5.4

  reply	other threads:[~2012-03-19 17:52 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-03-19 17:51 [PATCH 0/2] Unify the style of user messages Vincent van Ravesteijn
2012-03-19 17:51 ` Vincent van Ravesteijn [this message]
2012-03-19 19:39   ` [PATCH 1/2] Unification of user message strings Junio C Hamano
2012-03-19 20:16     ` Vincent van Ravesteijn
2012-03-19 20:53   ` Jeff King
2012-03-19 21:36     ` Junio C Hamano
2012-03-20  7:47       ` Vincent van Ravesteijn
2012-03-20 12:01         ` Jakub Narebski
2012-03-20 12:33           ` Vincent van Ravesteijn
2012-03-19 17:51 ` [PATCH 2/2] Make some strings translatable Vincent van Ravesteijn

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1332179503-2992-2-git-send-email-vfr@lyx.org \
    --to=vfr@lyx.org \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).