git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 20/25] gettextize: git-tag basic messages

From
Ævar Arnfjörð Bjarmason <avarab@gmail.com>
Date
Sep 2, 2010, 19:40 UTC
Message-ID
<1283456446-22577-21-git-send-email-avarab@gmail.com>
In-Reply-To
<1283373845-2022-1-git-send-email-avarab@gmail.com>
Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>
---
 builtin/tag.c |   60 ++++++++++++++++++++++++++++----------------------------
 1 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/builtin/tag.c b/builtin/tag.c
index c200e1e..7870d87 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -120,12 +120,12 @@ static int for_each_tag_name(const char **argv, each_tag_name_fn fn)
 	for (p = argv; *p; p++) {
 		if (snprintf(ref, sizeof(ref), "refs/tags/%s", *p)
 					>= sizeof(ref)) {
-			error("tag name too long: %.*s...", 50, *p);
+			error(_("tag name too long: %.*s..."), 50, *p);
 			had_error = 1;
 			continue;
 		}
 		if (!resolve_ref(ref, sha1, 1, NULL)) {
-			error("tag '%s' not found.", *p);
+			error(_("tag '%s' not found."), *p);
 			had_error = 1;
 			continue;
 		}
@@ -140,7 +140,7 @@ static int delete_tag(const char *name, const char *ref,
 {
 	if (delete_ref(ref, sha1, 0))
 		return 1;
-	printf("Deleted tag '%s' (was %s)\n", name, find_unique_abbrev(sha1, DEFAULT_ABBREV));
+	printf(_("Deleted tag '%s' (was %s)\n"), name, find_unique_abbrev(sha1, DEFAULT_ABBREV));
 	return 0;
 }
 
@@ -152,7 +152,7 @@ static int verify_tag(const char *name, const char *ref,
 	argv_verify_tag[2] = sha1_to_hex(sha1);
 
 	if (run_command_v_opt(argv_verify_tag, RUN_GIT_CMD))
-		return error("could not verify the tag '%s'", name);
+		return error(_("could not verify the tag '%s'"), name);
 	return 0;
 }
 
@@ -167,7 +167,7 @@ static int do_sign(struct strbuf *buffer)
 	if (!*signingkey) {
 		if (strlcpy(signingkey, git_committer_info(IDENT_ERROR_ON_NO_NAME),
 				sizeof(signingkey)) > sizeof(signingkey) - 1)
-			return error("committer info too long.");
+			return error(_("committer info too long."));
 		bracket = strchr(signingkey, '>');
 		if (bracket)
 			bracket[1] = '\0';
@@ -187,20 +187,20 @@ static int do_sign(struct strbuf *buffer)
 	args[3] = NULL;
 
 	if (start_command(&gpg))
-		return error("could not run gpg.");
+		return error(_("could not run gpg."));
 
 	if (write_in_full(gpg.in, buffer->buf, buffer->len) != buffer->len) {
 		close(gpg.in);
 		close(gpg.out);
 		finish_command(&gpg);
-		return error("gpg did not accept the tag data");
+		return error(_("gpg did not accept the tag data"));
 	}
 	close(gpg.in);
 	len = strbuf_read(buffer, gpg.out, 1024);
 	close(gpg.out);
 
 	if (finish_command(&gpg) || !len || len < 0)
-		return error("gpg failed to sign the tag");
+		return error(_("gpg failed to sign the tag"));
 
 	/* Strip CR from the line endings, in case we are on Windows. */
 	for (i = j = 0; i < buffer->len; i++)
@@ -223,7 +223,7 @@ static const char tag_template[] =
 static void set_signingkey(const char *value)
 {
 	if (strlcpy(signingkey, value, sizeof(signingkey)) >= sizeof(signingkey))
-		die("signing key value too long (%.10s...)", value);
+		die(_("signing key value too long (%.10s...)"), value);
 }
 
 static int git_tag_config(const char *var, const char *value, void *cb)
@@ -269,9 +269,9 @@ static void write_tag_body(int fd, const unsigned char *sha1)
 static int build_tag_object(struct strbuf *buf, int sign, unsigned char *result)
 {
 	if (sign && do_sign(buf) < 0)
-		return error("unable to sign the tag");
+		return error(_("unable to sign the tag"));
 	if (write_sha1_file(buf->buf, buf->len, tag_type, result) < 0)
-		return error("unable to write tag file");
+		return error(_("unable to write tag file"));
 	return 0;
 }
 
@@ -286,7 +286,7 @@ static void create_tag(const unsigned char *object, const char *tag,
 
 	type = sha1_object_info(object, NULL);
 	if (type <= OBJ_NONE)
-	    die("bad object type.");
+	    die(_("bad object type."));
 
 	header_len = snprintf(header_buf, sizeof(header_buf),
 			  "object %s\n"
@@ -299,7 +299,7 @@ static void create_tag(const unsigned char *object, const char *tag,
 			  git_committer_info(IDENT_ERROR_ON_NO_NAME));
 
 	if (header_len > sizeof(header_buf) - 1)
-		die("tag header too big.");
+		die(_("tag header too big."));
 
 	if (!message) {
 		int fd;
@@ -308,7 +308,7 @@ static void create_tag(const unsigned char *object, const char *tag,
 		path = git_pathdup("TAG_EDITMSG");
 		fd = open(path, O_CREAT | O_TRUNC | O_WRONLY, 0600);
 		if (fd < 0)
-			die_errno("could not create file '%s'", path);
+			die_errno(_("could not create file '%s'"), path);
 
 		if (!is_null_sha1(prev))
 			write_tag_body(fd, prev);
@@ -318,7 +318,7 @@ static void create_tag(const unsigned char *object, const char *tag,
 
 		if (launch_editor(path, buf, NULL)) {
 			fprintf(stderr,
-			"Please supply the message using either -m or -F option.\n");
+			_("Please supply the message using either -m or -F option.\n"));
 			exit(1);
 		}
 	}
@@ -326,13 +326,13 @@ static void create_tag(const unsigned char *object, const char *tag,
 	stripspace(buf, 1);
 
 	if (!message && !buf->len)
-		die("no tag message?");
+		die(_("no tag message?"));
 
 	strbuf_insert(buf, 0, header_buf, header_len);
 
 	if (build_tag_object(buf, sign, result) < 0) {
 		if (path)
-			fprintf(stderr, "The tag message has been left in %s\n",
+			fprintf(stderr, _("The tag message has been left in %s\n"),
 				path);
 		exit(128);
 	}
@@ -425,9 +425,9 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
 		return list_tags(argv[0], lines == -1 ? 0 : lines,
 				 with_commit);
 	if (lines != -1)
-		die("-n option is only allowed with -l.");
+		die(_("-n option is only allowed with -l."));
 	if (with_commit)
-		die("--contains option is only allowed with -l.");
+		die(_("--contains option is only allowed with -l."));
 	if (delete)
 		return for_each_tag_name(argv, delete_tag);
 	if (verify)
@@ -435,17 +435,17 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
 
 	if (msg.given || msgfile) {
 		if (msg.given && msgfile)
-			die("only one -F or -m option is allowed.");
+			die(_("only one -F or -m option is allowed."));
 		annotate = 1;
 		if (msg.given)
 			strbuf_addbuf(&buf, &(msg.buf));
 		else {
 			if (!strcmp(msgfile, "-")) {
 				if (strbuf_read(&buf, 0, 1024) < 0)
-					die_errno("cannot read '%s'", msgfile);
+					die_errno(_("cannot read '%s'"), msgfile);
 			} else {
 				if (strbuf_read_file(&buf, msgfile, 1024) < 0)
-					die_errno("could not open or read '%s'",
+					die_errno(_("could not open or read '%s'"),
 						msgfile);
 			}
 		}
@@ -455,20 +455,20 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
 
 	object_ref = argc == 2 ? argv[1] : "HEAD";
 	if (argc > 2)
-		die("too many params");
+		die(_("too many params"));
 
 	if (get_sha1(object_ref, object))
-		die("Failed to resolve '%s' as a valid ref.", object_ref);
+		die(_("Failed to resolve '%s' as a valid ref."), object_ref);
 
 	if (snprintf(ref, sizeof(ref), "refs/tags/%s", tag) > sizeof(ref) - 1)
-		die("tag name too long: %.*s...", 50, tag);
+		die(_("tag name too long: %.*s..."), 50, tag);
 	if (check_ref_format(ref))
-		die("'%s' is not a valid tag name.", tag);
+		die(_("'%s' is not a valid tag name."), tag);
 
 	if (!resolve_ref(ref, prev, 1, NULL))
 		hashclr(prev);
 	else if (!force)
-		die("tag '%s' already exists", tag);
+		die(_("tag '%s' already exists"), tag);
 
 	if (annotate)
 		create_tag(object, tag, &buf, msg.given || msgfile,
@@ -476,11 +476,11 @@ int cmd_tag(int argc, const char **argv, const char *prefix)
 
 	lock = lock_any_ref_for_update(ref, prev, 0);
 	if (!lock)
-		die("%s: cannot lock the ref", ref);
+		die(_("%s: cannot lock the ref"), ref);
 	if (write_ref_sha1(lock, object, NULL) < 0)
-		die("%s: cannot update the ref", ref);
+		die(_("%s: cannot update the ref"), ref);
 	if (force && hashcmp(prev, object))
-		printf("Updated tag '%s' (was %s)\n", tag, find_unique_abbrev(prev, DEFAULT_ABBREV));
+		printf(_("Updated tag '%s' (was %s)\n"), tag, find_unique_abbrev(prev, DEFAULT_ABBREV));
 
 	strbuf_release(&buf);
 	return 0;
-- 
1.7.2.2.614.g1dc9
Previous: Thomas RastNext: Ævar Arnfjörð Bjarmason
Message 53 of 63 in “gettextize the first 4 C mainporcelain common commands”
  1. 00/13 gettextize the first 4 C mainporcelain common commandsÆvar Arnfjörð Bjarmason, Sep 1, 2010
  2. 01/13 git-clone: use builtin.h to get gettext.hÆvar Arnfjörð Bjarmason, Sep 1, 2010
  3. 02/13 gettextize: git-clone basic messagesÆvar Arnfjörð Bjarmason, Sep 1, 2010
  4. 03/13 gettextize: git-clone "Cloning into" messageÆvar Arnfjörð Bjarmason, Sep 1, 2010
  5. 04/13 gettextize: git-add basic messagesÆvar Arnfjörð Bjarmason, Sep 1, 2010
  6. 05/13 gettextize: git-add refresh_index messageÆvar Arnfjörð Bjarmason, Sep 1, 2010
  7. Jonathan NiederSep 2, 2010
  8. 06/13 gettextize: git-branch basic messagesÆvar Arnfjörð Bjarmason, Sep 1, 2010
  9. 07/13 gettextize: git-branch "remote branch '%s' not found" messageÆvar Arnfjörð Bjarmason, Sep 1, 2010
  10. 08/13 gettextize: git-branch "git branch -v" messagesÆvar Arnfjörð Bjarmason, Sep 1, 2010
  11. 09/13 gettextize: git-branch "(no branch)" messageÆvar Arnfjörð Bjarmason, Sep 1, 2010
  12. 10/13 gettextize: git-checkout: our/their version messageÆvar Arnfjörð Bjarmason, Sep 1, 2010
  13. 11/13 gettextize: git-checkout basic messagesÆvar Arnfjörð Bjarmason, Sep 1, 2010
  14. 12/13 gettextize: git-checkout describe_detached_head messagesÆvar Arnfjörð Bjarmason, Sep 1, 2010
  15. 13/13 gettextize: git-checkout "Switched to a .. branch" messageÆvar Arnfjörð Bjarmason, Sep 1, 2010
  16. 00/25 [CONTINUED] gettextize all C mainporcelain common commandsÆvar Arnfjörð Bjarmason, Sep 2, 2010
  17. 01/25 gettextize: git-commit basic messagesÆvar Arnfjörð Bjarmason, Sep 2, 2010
  18. 02/25 gettextize: git-commit formatting messagesÆvar Arnfjörð Bjarmason, Sep 2, 2010
  19. 03/25 gettextize: git-commit advice messagesÆvar Arnfjörð Bjarmason, Sep 2, 2010
  20. 04/25 gettextize: git-diff basic messagesÆvar Arnfjörð Bjarmason, Sep 2, 2010
  21. 05/25 gettextize: git-fetch basic messagesÆvar Arnfjörð Bjarmason, Sep 2, 2010
  22. 06/25 gettextize: git-fetch formatting messagesÆvar Arnfjörð Bjarmason, Sep 2, 2010
  23. Jonathan NiederSep 2, 2010
  24. Ævar Arnfjörð BjarmasonSep 2, 2010
  25. Jeff KingSep 2, 2010
  26. Ævar Arnfjörð BjarmasonSep 2, 2010
  27. 07/25 gettextize: git-grep basic messagesÆvar Arnfjörð Bjarmason, Sep 2, 2010
  28. 08/25 gettextize: git-log basic messagesÆvar Arnfjörð Bjarmason, Sep 2, 2010
  29. 09/25 gettextize: git-format-patch --cover-letter messageÆvar Arnfjörð Bjarmason, Sep 2, 2010
  30. 10/25 gettextize: git-merge basic messagesÆvar Arnfjörð Bjarmason, Sep 2, 2010
  31. Jonathan NiederSep 2, 2010
  32. Ævar Arnfjörð BjarmasonSep 2, 2010
  33. Jonathan NiederSep 2, 2010
  34. Ævar Arnfjörð BjarmasonSep 2, 2010
  35. Jonathan NiederSep 2, 2010
  36. Ævar Arnfjörð BjarmasonSep 2, 2010
  37. Jonathan NiederSep 2, 2010
  38. Ævar Arnfjörð BjarmasonSep 3, 2010
  39. Jonathan NiederSep 3, 2010
  40. Ævar Arnfjörð BjarmasonSep 3, 2010
  41. Ævar Arnfjörð BjarmasonSep 3, 2010
  42. 11/25 gettextize: git-merge "In-index merge" messageÆvar Arnfjörð Bjarmason, Sep 2, 2010
  43. 12/25 gettextize: git-merge "Merge made by %s." messageÆvar Arnfjörð Bjarmason, Sep 2, 2010
  44. 13/25 gettextize: git-merge remaining cmd_merge messagesÆvar Arnfjörð Bjarmason, Sep 2, 2010
  45. 14/25 gettextize: git-mv basic messagesÆvar Arnfjörð Bjarmason, Sep 2, 2010
  46. 15/25 gettextize: git-mv "bad" messagesÆvar Arnfjörð Bjarmason, Sep 2, 2010
  47. 16/25 gettextize: git-rm basic messagesÆvar Arnfjörð Bjarmason, Sep 2, 2010
  48. 17/25 builtin: use builtin.h in git-resetÆvar Arnfjörð Bjarmason, Sep 2, 2010
  49. 18/25 gettextize: git-reset basic messagesÆvar Arnfjörð Bjarmason, Sep 2, 2010
  50. 19/25 gettextize: git-reset reset_type_names messagesÆvar Arnfjörð Bjarmason, Sep 2, 2010
  51. Peter KreftingSep 15, 2010
  52. Thomas RastSep 15, 2010
  53. 20/25 gettextize: git-tag basic messagesÆvar Arnfjörð Bjarmason, Sep 2, 2010
  54. 21/25 gettextize: git-tag tag_template messageÆvar Arnfjörð Bjarmason, Sep 2, 2010
  55. 22/25 gettextize: git-push basic messagesÆvar Arnfjörð Bjarmason, Sep 2, 2010
  56. 23/25 builtin: use builtin.h in git-statusÆvar Arnfjörð Bjarmason, Sep 2, 2010
  57. 24/25 gettextize: git-status basic messagesÆvar Arnfjörð Bjarmason, Sep 2, 2010
  58. Jonathan NiederSep 2, 2010
  59. Ævar Arnfjörð BjarmasonSep 2, 2010
  60. Jonathan NiederSep 2, 2010
  61. 25/25 gettextize: git-status shortstatus messagesÆvar Arnfjörð Bjarmason, Sep 2, 2010
  62. Jonathan NiederSep 2, 2010
  63. Ævar Arnfjörð BjarmasonSep 2, 2010

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.