[PATCH 00/72] No-op C gettext wrappers

STALE3733d

113 messages, 3 authors, 2016-06-15 · page 1 of 2 · open the first message on its own page

[PATCH 00/72] No-op C gettext wrappers

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

As discussed on-list previously I'm remaking the gettext series in a
form that'll be easier to swallow. This series is what's at the start
of my own ab/i18n branch hosted at git://github.com/avar/git.git.

It only does these:

 * A skeleton no-op gettext.h wrapper that does nothing
 * Marking up of the relevant source messages so they can be translated
 * Marking up and changing tests that would break under
   GETTEXT_POISON=YesPlease

After this is in I'll submit similar no-op wrappers and gettextization
of the *.sh and *.perl files I have gettextized in ab/i18n, after that
I'll be trying to get the remaining bits of ab/i18n in, which'll be:

 * The actual C, Shell and Perl gettext implementation + tests
 * Documentation on how to translate things
 * po/*.po files containing translations

Ævar Arnfjörð Bjarmason (72):
  gettext.h: add no-op _() and N_() wrappers
  cache.h: include gettext.h
  t/test-lib.sh: add always-set NO_GETTEXT_POISON prerequisite
  gettextize: git-init basic messages
  gettextize: git-init "Initialized [...] repository" message
  gettextize: git-clone basic messages
  gettextize: git-clone "Cloning into" message
  gettextize: git-add basic messages
  gettextize: git-add "no files added" message
  gettextize: git-add "Use -f if you really want" message
  gettextize: git-add "pathspec [...] did not match" message
  gettextize: git-add "remove '%s'" message
  gettextize: git-add refresh_index message
  gettextize: git-branch basic messages
  gettextize: git-branch "remote branch '%s' not found" message
  gettextize: git-branch "Deleted branch [...]" message
  gettextize: git-branch "git branch -v" messages
  gettextize: git-branch "(no branch)" message
  gettextize: git-checkout basic messages
  gettextize: git-checkout: our/their version message
  gettextize: git-checkout describe_detached_head messages
  gettextize: git-checkout "HEAD is now at" message
  gettextize: git-checkout "Switched to a .. branch" message
  gettextize: git-commit basic messages
  gettextize: git-commit "middle of a merge" message
  gettextize: git-commit formatting messages
  gettextize: git-commit print_summary messages
  gettextize: git-commit "enter the commit message" message
  gettextize: git-commit advice messages
  gettextize: git-diff basic messages
  gettextize: git-fetch basic messages
  gettextize: git-fetch formatting messages
  gettextize: git-fetch update_local_ref messages
  gettextize: git-fetch split up "(non-fast-forward)" message
  gettextize: git-grep basic messages
  gettextize: git-grep "--open-files-in-pager" message
  gettextize: git-log basic messages
  gettextize: git-log "--OPT does not make sense" messages
  gettextize: git-merge basic messages
  gettextize: git-merge "Updating %s..%s" message
  gettextize: git-merge "You have not concluded your merge" messages
  gettextize: git-merge "Wonderful" message
  gettextize: git-mv basic messages
  gettextize: git-mv "bad" messages
  gettextize: git-rm basic messages
  gettextize: git-reset basic messages
  gettextize: git-reset reset_type_names messages
  gettextize: git-reset "Unstaged changes after reset" message
  gettextize: git-tag basic messages
  gettextize: git-tag tag_template message
  gettextize: git-push basic messages
  gettextize: git-push "prevent you from losing" message
  gettextize: git-status basic messages
  gettextize: git-status "nothing to commit" messages
  gettextize: git-status shortstatus messages
  gettextize: git-status "Changes to be committed" message
  gettextize: git-status "Initial commit" message
  gettextize: git-status "renamed: " message
  gettextize: git-archive basic messages
  gettextize: git-bundle basic messages
  gettextize: git-clean basic messages
  gettextize: git-clean clean.requireForce messages
  gettextize: git-describe basic messages
  gettextize: git-gc basic messages
  gettextize: git-gc "Auto packing the repository" message
  gettextize: git-notes basic commands
  gettextize: git-notes GIT_NOTES_REWRITE_MODE error message
  gettextize: git-revert basic messages
  gettextize: git-revert "Your local changes" message
  gettextize: git-revert literal "me" messages
  gettextize: git-revert split up "could not revert/apply" message
  gettextize: git-shortlog basic messages

 builtin/add.c                    |   46 ++++++------
 builtin/archive.c                |   14 ++--
 builtin/branch.c                 |   69 ++++++++--------
 builtin/bundle.c                 |    6 +-
 builtin/checkout.c               |   93 +++++++++++-----------
 builtin/clean.c                  |   33 +++++---
 builtin/clone.c                  |   63 ++++++++-------
 builtin/commit.c                 |  162 +++++++++++++++++++-------------------
 builtin/describe.c               |   36 ++++----
 builtin/diff.c                   |   18 ++--
 builtin/fetch.c                  |   82 ++++++++++----------
 builtin/gc.c                     |   24 +++---
 builtin/grep.c                   |   34 ++++----
 builtin/init-db.c                |   58 +++++++------
 builtin/log.c                    |   68 ++++++++--------
 builtin/merge.c                  |  128 +++++++++++++++---------------
 builtin/mv.c                     |   32 ++++----
 builtin/notes.c                  |  112 +++++++++++++-------------
 builtin/push.c                   |   42 +++++-----
 builtin/reset.c                  |   42 +++++-----
 builtin/revert.c                 |   76 ++++++++++--------
 builtin/rm.c                     |   22 +++---
 builtin/shortlog.c               |    8 +-
 builtin/tag.c                    |   66 ++++++++--------
 cache.h                          |    1 +
 gettext.h                        |    9 ++
 t/lib-httpd.sh                   |    2 +-
 t/t0001-init.sh                  |    2 +-
 t/t1200-tutorial.sh              |    5 +-
 t/t2200-add-update.sh            |    2 +-
 t/t2204-add-ignored.sh           |   37 ++++++---
 t/t3030-merge-recursive.sh       |    2 +-
 t/t3200-branch.sh                |    2 +-
 t/t3203-branch-output.sh         |    2 +-
 t/t3501-revert-cherry-pick.sh    |    2 +-
 t/t3507-cherry-pick-conflict.sh  |    2 +-
 t/t3700-add.sh                   |   11 ++-
 t/t4001-diff-rename.sh           |    4 +-
 t/t4014-format-patch.sh          |    2 +-
 t/t5526-fetch-submodules.sh      |   40 ++++++++--
 t/t5541-http-push.sh             |    7 +-
 t/t5601-clone.sh                 |    2 +-
 t/t6040-tracking-info.sh         |    2 +-
 t/t6120-describe.sh              |    2 +-
 t/t7004-tag.sh                   |    1 +
 t/t7012-skip-worktree-writing.sh |    4 +-
 t/t7060-wtstatus.sh              |    2 +-
 t/t7102-reset.sh                 |    2 +-
 t/t7110-reset-merge.sh           |    6 +-
 t/t7201-co.sh                    |   10 +-
 t/t7300-clean.sh                 |    6 +-
 t/t7500-commit.sh                |    8 +-
 t/t7501-commit.sh                |    7 +-
 t/t7502-commit.sh                |   60 +++++++++------
 t/t7506-status-submodule.sh      |   28 +++---
 t/t7508-status.sh                |  115 +++++++++++++++------------
 t/t7600-merge.sh                 |    2 +-
 t/t7607-merge-overwrite.sh       |   10 ++-
 t/t7611-merge-abort.sh           |   20 ++++-
 t/t7811-grep-open.sh             |    2 +-
 t/test-lib.sh                    |    5 +
 wt-status.c                      |  116 ++++++++++++++--------------
 62 files changed, 1011 insertions(+), 865 deletions(-)
 create mode 100644 gettext.h

-- 
1.7.2.3

[PATCH 02/72] cache.h: include gettext.h

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Change cache.h to include gettext.h. In previous incarnations of the
gettext series I included gettext.h in builtin.h, then changed
builtin/*.c files to include that when they didn't already.

It was pointed out by Junio and others that it makes more sense to
have the inclusion here, since gettext is going to be used everywhere.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 cache.h |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/cache.h b/cache.h
index 3abf895..a465f38 100644
--- a/cache.h
+++ b/cache.h
@@ -5,6 +5,7 @@
 #include "strbuf.h"
 #include "hash.h"
 #include "advice.h"
+#include "gettext.h"
 
 #include SHA1_HEADER
 #ifndef git_SHA_CTX
-- 
1.7.2.3

[PATCH 01/72] gettext.h: add no-op _() and N_() wrappers

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Add a new header called gettext.h which is currently a no-op. To split
up the gettext series I'm first submitting patches to gettextize the
source tree before I add any of the Makefile and C changes needed to
actually use them.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 gettext.h |    9 +++++++++
 1 files changed, 9 insertions(+), 0 deletions(-)
 create mode 100644 gettext.h
diff --git a/gettext.h b/gettext.h
new file mode 100644
index 0000000..c68bbe9
--- /dev/null
+++ b/gettext.h
@@ -0,0 +1,9 @@
+/*
+ * Copyright (c) 2010 Ævar Arnfjörð Bjarmason
+ *
+ * This is a skeleton no-op implementation of gettext for Git. It'll
+ * be replaced by something that uses libintl.h and wraps gettext() in
+ * a future patch series.
+ */
+#define N_(s) (s)
+#define _(s) (s)
-- 
1.7.2.3

[PATCH 05/72] gettextize: git-init "Initialized [...] repository" message

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Change the git-init "Initialized empty Git repository" message and its
variants to use gettext.

This is one of the messages that could do with splitting up, I had a
WIP patch to do that that began like this:

    const char *reinit_shared   = _("Reinitialized existing shared Git repository in %s\n");
    const char *init_shared	    = _("Initialized empty shared Git repository in %s\n");
    const char *reinit_noshared = _("Reinitialized existing Git repository in %s\n");
    const char *init_noshared   = _("Initialized empty Git repository in %s\n");

But in the first round of gettextization I'm aiming to keep code
changes to a minimum for ease of review.

We can solicit input from translators about which messages that use
too much sprintf-ing are troublesome, and change those later.

Note that the TRANSLATORS comment doesn't use the usual Git
style. This is because everything from "/* TRANSLATORS: " to "*/" will
extracted as-is xgettext(1) and presented to translators, including
newlines and leading "*"'s. There seems to be no way to change that,
short of patching xgettext itself.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/init-db.c |   10 +++++++---
 t/t0001-init.sh   |    2 +-
 2 files changed, 8 insertions(+), 4 deletions(-)
diff --git a/builtin/init-db.c b/builtin/init-db.c
index 35f9f13..67462ad 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -354,9 +354,13 @@ int init_db(const char *template_dir, unsigned int flags)
 	if (!(flags & INIT_DB_QUIET)) {
 		const char *git_dir = get_git_dir();
 		int len = strlen(git_dir);
-		printf("%s%s Git repository in %s%s\n",
-		       reinit ? "Reinitialized existing" : "Initialized empty",
-		       shared_repository ? " shared" : "",
+
+		/* TRANSLATORS: The first '%s' is either "Reinitialized
+		   existing" or "Initialized empty", the second " shared" or
+		   "", and the last '%s%s' is the verbatim directory name. */
+		printf(_("%s%s Git repository in %s%s\n"),
+		       reinit ? _("Reinitialized existing") : _("Initialized empty"),
+		       shared_repository ? _(" shared") : "",
 		       git_dir, len && git_dir[len-1] != '/' ? "/" : "");
 	}
 
diff --git a/t/t0001-init.sh b/t/t0001-init.sh
index f684993..4235ad4 100755
--- a/t/t0001-init.sh
+++ b/t/t0001-init.sh
@@ -180,7 +180,7 @@ test_expect_success 'GIT_DIR & GIT_WORK_TREE (2)' '
 	fi
 '
 
-test_expect_success 'reinit' '
+test_expect_success NO_GETTEXT_POISON 'reinit' '
 
 	(
 		sane_unset GIT_CONFIG GIT_WORK_TREE GIT_CONFIG &&
-- 
1.7.2.3

[PATCH 03/72] t/test-lib.sh: add always-set NO_GETTEXT_POISON prerequisite

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Add a new test prerequisite called NO_GETTEXT_POISON to t/test-lib.sh
that's always set for now.

Some of the gettextize patches that'll follow this one will change
their test outputs if a functioning gettext implementation with poison
support is sitting on top of them, but for now I only have harmless
no-op wrappers in gettext.h so NO_GETTEXT_POISON can be set all the
time.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 t/test-lib.sh |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index 0fdc541..ffcfa2e 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1079,6 +1079,11 @@ esac
 test -z "$NO_PERL" && test_set_prereq PERL
 test -z "$NO_PYTHON" && test_set_prereq PYTHON
 
+# Always set the NO_GETTEXT_POISON prerequisite while we don't have a
+# real gettext implementation in Git. This will be replaced by
+# something that varies in a future patch series.
+test_set_prereq NO_GETTEXT_POISON
+
 # test whether the filesystem supports symbolic links
 ln -s x y 2>/dev/null && test -h y 2>/dev/null && test_set_prereq SYMLINKS
 rm -f y
-- 
1.7.2.3

[PATCH 04/72] gettextize: git-init basic messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Change the user visible strings in init-db.c to use gettext
localizations. This only converts messages which needed to be changed
from "foo" to _("foo"), and didn't need any TRANSLATORS comments.

I haven't marked the messages in init_db_usage or init_db_options for
translation, since that would require additional changes in
parse-options.c. Those can be done later.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/init-db.c |   48 ++++++++++++++++++++++++------------------------
 1 files changed, 24 insertions(+), 24 deletions(-)
diff --git a/builtin/init-db.c b/builtin/init-db.c
index 4f5348e..35f9f13 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -31,7 +31,7 @@ static void safe_create_dir(const char *dir, int share)
 		}
 	}
 	else if (share && adjust_shared_perm(dir))
-		die("Could not make %s writable by group", dir);
+		die(_("Could not make %s writable by group"), dir);
 }
 
 static void copy_templates_1(char *path, int baselen,
@@ -58,25 +58,25 @@ static void copy_templates_1(char *path, int baselen,
 		namelen = strlen(de->d_name);
 		if ((PATH_MAX <= baselen + namelen) ||
 		    (PATH_MAX <= template_baselen + namelen))
-			die("insanely long template name %s", de->d_name);
+			die(_("insanely long template name %s"), de->d_name);
 		memcpy(path + baselen, de->d_name, namelen+1);
 		memcpy(template + template_baselen, de->d_name, namelen+1);
 		if (lstat(path, &st_git)) {
 			if (errno != ENOENT)
-				die_errno("cannot stat '%s'", path);
+				die_errno(_("cannot stat '%s'"), path);
 		}
 		else
 			exists = 1;
 
 		if (lstat(template, &st_template))
-			die_errno("cannot stat template '%s'", template);
+			die_errno(_("cannot stat template '%s'"), template);
 
 		if (S_ISDIR(st_template.st_mode)) {
 			DIR *subdir = opendir(template);
 			int baselen_sub = baselen + namelen;
 			int template_baselen_sub = template_baselen + namelen;
 			if (!subdir)
-				die_errno("cannot opendir '%s'", template);
+				die_errno(_("cannot opendir '%s'"), template);
 			path[baselen_sub++] =
 				template[template_baselen_sub++] = '/';
 			path[baselen_sub] =
@@ -93,20 +93,20 @@ static void copy_templates_1(char *path, int baselen,
 			int len;
 			len = readlink(template, lnk, sizeof(lnk));
 			if (len < 0)
-				die_errno("cannot readlink '%s'", template);
+				die_errno(_("cannot readlink '%s'"), template);
 			if (sizeof(lnk) <= len)
-				die("insanely long symlink %s", template);
+				die(_("insanely long symlink %s"), template);
 			lnk[len] = 0;
 			if (symlink(lnk, path))
-				die_errno("cannot symlink '%s' '%s'", lnk, path);
+				die_errno(_("cannot symlink '%s' '%s'"), lnk, path);
 		}
 		else if (S_ISREG(st_template.st_mode)) {
 			if (copy_file(path, template, st_template.st_mode))
-				die_errno("cannot copy '%s' to '%s'", template,
+				die_errno(_("cannot copy '%s' to '%s'"), template,
 					  path);
 		}
 		else
-			error("ignoring template %s", template);
+			error(_("ignoring template %s"), template);
 	}
 }
 
@@ -129,7 +129,7 @@ static void copy_templates(const char *template_dir)
 		return;
 	template_len = strlen(template_dir);
 	if (PATH_MAX <= (template_len+strlen("/config")))
-		die("insanely long template path %s", template_dir);
+		die(_("insanely long template path %s"), template_dir);
 	strcpy(template_path, template_dir);
 	if (template_path[template_len-1] != '/') {
 		template_path[template_len++] = '/';
@@ -137,7 +137,7 @@ static void copy_templates(const char *template_dir)
 	}
 	dir = opendir(template_path);
 	if (!dir) {
-		warning("templates not found %s", template_dir);
+		warning(_("templates not found %s"), template_dir);
 		return;
 	}
 
@@ -150,8 +150,8 @@ static void copy_templates(const char *template_dir)
 
 	if (repository_format_version &&
 	    repository_format_version != GIT_REPO_VERSION) {
-		warning("not copying templates of "
-			"a wrong format version %d from '%s'",
+		warning(_("not copying templates of "
+			"a wrong format version %d from '%s'"),
 			repository_format_version,
 			template_dir);
 		closedir(dir);
@@ -188,7 +188,7 @@ static int create_default_files(const char *template_path)
 	int filemode;
 
 	if (len > sizeof(path)-50)
-		die("insane git directory %s", git_dir);
+		die(_("insane git directory %s"), git_dir);
 	memcpy(path, git_dir, len);
 
 	if (len && path[len-1] != '/')
@@ -346,7 +346,7 @@ int init_db(const char *template_dir, unsigned int flags)
 		else if (shared_repository == PERM_EVERYBODY)
 			sprintf(buf, "%d", OLD_PERM_EVERYBODY);
 		else
-			die("oops");
+			die(_("oops"));
 		git_config_set("core.sharedrepository", buf);
 		git_config_set("receive.denyNonFastforwards", "true");
 	}
@@ -375,7 +375,7 @@ static int guess_repository_type(const char *git_dir)
 	if (!strcmp(".", git_dir))
 		return 1;
 	if (!getcwd(cwd, sizeof(cwd)))
-		die_errno("cannot tell cwd");
+		die_errno(_("cannot tell cwd"));
 	if (!strcmp(git_dir, cwd))
 		return 1;
 	/*
@@ -450,18 +450,18 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
 					errno = EEXIST;
 					/* fallthru */
 				case -1:
-					die_errno("cannot mkdir %s", argv[0]);
+					die_errno(_("cannot mkdir %s"), argv[0]);
 					break;
 				default:
 					break;
 				}
 				shared_repository = saved;
 				if (mkdir(argv[0], 0777) < 0)
-					die_errno("cannot mkdir %s", argv[0]);
+					die_errno(_("cannot mkdir %s"), argv[0]);
 				mkdir_tried = 1;
 				goto retry;
 			}
-			die_errno("cannot chdir to %s", argv[0]);
+			die_errno(_("cannot chdir to %s"), argv[0]);
 		}
 	} else if (0 < argc) {
 		usage(init_db_usage[0]);
@@ -483,8 +483,8 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
 	git_dir = getenv(GIT_DIR_ENVIRONMENT);
 	work_tree = getenv(GIT_WORK_TREE_ENVIRONMENT);
 	if ((!git_dir || is_bare_repository_cfg == 1) && work_tree)
-		die("%s (or --work-tree=<directory>) not allowed without "
-		    "specifying %s (or --git-dir=<directory>)",
+		die(_("%s (or --work-tree=<directory>) not allowed without "
+			  "specifying %s (or --git-dir=<directory>)"),
 		    GIT_WORK_TREE_ENVIRONMENT,
 		    GIT_DIR_ENVIRONMENT);
 
@@ -509,14 +509,14 @@ int cmd_init_db(int argc, const char **argv, const char *prefix)
 		if (!git_work_tree_cfg) {
 			git_work_tree_cfg = xcalloc(PATH_MAX, 1);
 			if (!getcwd(git_work_tree_cfg, PATH_MAX))
-				die_errno ("Cannot access current working directory");
+				die_errno (_("Cannot access current working directory"));
 		}
 		if (work_tree)
 			set_git_work_tree(make_absolute_path(work_tree));
 		else
 			set_git_work_tree(git_work_tree_cfg);
 		if (access(get_git_work_tree(), X_OK))
-			die_errno ("Cannot access work tree '%s'",
+			die_errno (_("Cannot access work tree '%s'"),
 				   get_git_work_tree());
 	}
 	else {
-- 
1.7.2.3

[PATCH 06/72] gettextize: git-clone basic messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/clone.c |   54 +++++++++++++++++++++++++++---------------------------
 1 files changed, 27 insertions(+), 27 deletions(-)
diff --git a/builtin/clone.c b/builtin/clone.c
index 60d9a64..f46d09b 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -208,7 +208,7 @@ static void setup_reference(const char *repo)
 	if (is_directory(mkpath("%s/.git/objects", ref_git)))
 		ref_git = mkpath("%s/.git", ref_git);
 	else if (!is_directory(mkpath("%s/objects", ref_git)))
-		die("reference repository '%s' is not a local directory.",
+		die(_("reference repository '%s' is not a local directory."),
 		    option_reference);
 
 	ref_git_copy = xstrdup(ref_git);
@@ -235,15 +235,15 @@ static void copy_or_link_directory(struct strbuf *src, struct strbuf *dest)
 
 	dir = opendir(src->buf);
 	if (!dir)
-		die_errno("failed to open '%s'", src->buf);
+		die_errno(_("failed to open '%s'"), src->buf);
 
 	if (mkdir(dest->buf, 0777)) {
 		if (errno != EEXIST)
-			die_errno("failed to create directory '%s'", dest->buf);
+			die_errno(_("failed to create directory '%s'"), dest->buf);
 		else if (stat(dest->buf, &buf))
-			die_errno("failed to stat '%s'", dest->buf);
+			die_errno(_("failed to stat '%s'"), dest->buf);
 		else if (!S_ISDIR(buf.st_mode))
-			die("%s exists and is not a directory", dest->buf);
+			die(_("%s exists and is not a directory"), dest->buf);
 	}
 
 	strbuf_addch(src, '/');
@@ -257,7 +257,7 @@ static void copy_or_link_directory(struct strbuf *src, struct strbuf *dest)
 		strbuf_setlen(dest, dest_len);
 		strbuf_addstr(dest, de->d_name);
 		if (stat(src->buf, &buf)) {
-			warning ("failed to stat %s\n", src->buf);
+			warning (_("failed to stat %s\n"), src->buf);
 			continue;
 		}
 		if (S_ISDIR(buf.st_mode)) {
@@ -267,16 +267,16 @@ static void copy_or_link_directory(struct strbuf *src, struct strbuf *dest)
 		}
 
 		if (unlink(dest->buf) && errno != ENOENT)
-			die_errno("failed to unlink '%s'", dest->buf);
+			die_errno(_("failed to unlink '%s'"), dest->buf);
 		if (!option_no_hardlinks) {
 			if (!link(src->buf, dest->buf))
 				continue;
 			if (option_local)
-				die_errno("failed to create link '%s'", dest->buf);
+				die_errno(_("failed to create link '%s'"), dest->buf);
 			option_no_hardlinks = 1;
 		}
 		if (copy_file_with_time(dest->buf, src->buf, 0666))
-			die_errno("failed to copy file to '%s'", dest->buf);
+			die_errno(_("failed to copy file to '%s'"), dest->buf);
 	}
 	closedir(dir);
 }
@@ -305,7 +305,7 @@ static const struct ref *clone_local(const char *src_repo,
 	ret = transport_get_remote_refs(transport);
 	transport_disconnect(transport);
 	if (0 <= option_verbosity)
-		printf("done.\n");
+		printf(_("done.\n"));
 	return ret;
 }
 
@@ -387,11 +387,11 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 			     builtin_clone_usage, 0);
 
 	if (argc > 2)
-		usage_msg_opt("Too many arguments.",
+		usage_msg_opt(_("Too many arguments."),
 			builtin_clone_usage, builtin_clone_options);
 
 	if (argc == 0)
-		usage_msg_opt("You must specify a repository to clone.",
+		usage_msg_opt(_("You must specify a repository to clone."),
 			builtin_clone_usage, builtin_clone_options);
 
 	if (option_mirror)
@@ -399,7 +399,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 
 	if (option_bare) {
 		if (option_origin)
-			die("--bare and --origin %s options are incompatible.",
+			die(_("--bare and --origin %s options are incompatible."),
 			    option_origin);
 		option_no_checkout = 1;
 	}
@@ -418,7 +418,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 		repo = repo_name;
 	is_local = path && !is_bundle;
 	if (is_local && option_depth)
-		warning("--depth is ignored in local clones; use file:// instead.");
+		warning(_("--depth is ignored in local clones; use file:// instead."));
 
 	if (argc == 2)
 		dir = xstrdup(argv[1]);
@@ -428,8 +428,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 
 	dest_exists = !stat(dir, &buf);
 	if (dest_exists && !is_empty_dir(dir))
-		die("destination path '%s' already exists and is not "
-			"an empty directory.", dir);
+		die(_("destination path '%s' already exists and is not "
+			"an empty directory."), dir);
 
 	strbuf_addf(&reflog_msg, "clone: from %s", repo);
 
@@ -438,7 +438,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 	else {
 		work_tree = getenv("GIT_WORK_TREE");
 		if (work_tree && !stat(work_tree, &buf))
-			die("working tree '%s' already exists.", work_tree);
+			die(_("working tree '%s' already exists."), work_tree);
 	}
 
 	if (option_bare || work_tree)
@@ -451,10 +451,10 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 	if (!option_bare) {
 		junk_work_tree = work_tree;
 		if (safe_create_leading_directories_const(work_tree) < 0)
-			die_errno("could not create leading directories of '%s'",
+			die_errno(_("could not create leading directories of '%s'"),
 				  work_tree);
 		if (!dest_exists && mkdir(work_tree, 0755))
-			die_errno("could not create work tree dir '%s'.",
+			die_errno(_("could not create work tree dir '%s'."),
 				  work_tree);
 		set_git_work_tree(work_tree);
 	}
@@ -465,7 +465,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 	setenv(CONFIG_ENVIRONMENT, mkpath("%s/config", git_dir), 1);
 
 	if (safe_create_leading_directories_const(git_dir) < 0)
-		die("could not create leading directories of '%s'", git_dir);
+		die(_("could not create leading directories of '%s'"), git_dir);
 	set_git_dir(make_absolute_path(git_dir));
 
 	if (0 <= option_verbosity)
@@ -527,7 +527,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 		transport = transport_get(remote, remote->url[0]);
 
 		if (!transport->get_refs_list || !transport->fetch)
-			die("Don't know how to clone %s", transport->url);
+			die(_("Don't know how to clone %s"), transport->url);
 
 		transport_set_option(transport, TRANS_OPT_KEEP, "yes");
 
@@ -566,8 +566,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 			strbuf_release(&head);
 
 			if (!our_head_points_at) {
-				warning("Remote branch %s not found in "
-					"upstream %s, using HEAD instead",
+				warning(_("Remote branch %s not found in "
+					"upstream %s, using HEAD instead"),
 					option_branch, option_origin);
 				our_head_points_at = remote_head_points_at;
 			}
@@ -576,7 +576,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 			our_head_points_at = remote_head_points_at;
 	}
 	else {
-		warning("You appear to have cloned an empty repository.");
+		warning(_("You appear to have cloned an empty repository."));
 		our_head_points_at = NULL;
 		remote_head_points_at = NULL;
 		remote_head = NULL;
@@ -618,8 +618,8 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 	} else {
 		/* Nothing to checkout out */
 		if (!option_no_checkout)
-			warning("remote HEAD refers to nonexistent ref, "
-				"unable to checkout.\n");
+			warning(_("remote HEAD refers to nonexistent ref, "
+				"unable to checkout.\n"));
 		option_no_checkout = 1;
 	}
 
@@ -655,7 +655,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 
 		if (write_cache(fd, active_cache, active_nr) ||
 		    commit_locked_index(lock_file))
-			die("unable to write new index file");
+			die(_("unable to write new index file"));
 
 		err |= run_hook(NULL, "post-checkout", sha1_to_hex(null_sha1),
 				sha1_to_hex(our_head_points_at->old_sha1), "1",
-- 
1.7.2.3

[PATCH 07/72] gettextize: git-clone "Cloning into" message

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Split up the "Cloning into %s" and "Cloning into bare repository %s"
messages to make them easier to translate.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/clone.c  |    9 ++++++---
 t/t5601-clone.sh |    2 +-
 2 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/builtin/clone.c b/builtin/clone.c
index f46d09b..dffcf80 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -468,9 +468,12 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
 		die(_("could not create leading directories of '%s'"), git_dir);
 	set_git_dir(make_absolute_path(git_dir));
 
-	if (0 <= option_verbosity)
-		printf("Cloning into %s%s...\n",
-		       option_bare ? "bare repository " : "", dir);
+	if (0 <= option_verbosity) {
+		if (option_bare)
+			printf(_("Cloning into bare repository %s\n"), dir);
+		else
+			printf(_("Cloning into %s\n"), dir);
+	}
 	init_db(option_template, INIT_DB_QUIET);
 
 	/*
diff --git a/t/t5601-clone.sh b/t/t5601-clone.sh
index 987e0c8..ecb499d 100755
--- a/t/t5601-clone.sh
+++ b/t/t5601-clone.sh
@@ -31,7 +31,7 @@ test_expect_success 'clone with excess parameters (2)' '
 
 '
 
-test_expect_success 'output from clone' '
+test_expect_success NO_GETTEXT_POISON 'output from clone' '
 	rm -fr dst &&
 	git clone -n "file://$(pwd)/src" dst >output &&
 	test $(grep Clon output | wc -l) = 1
-- 
1.7.2.3

[PATCH 08/72] gettextize: git-add basic messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/add.c |   36 ++++++++++++++++++------------------
 1 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/builtin/add.c b/builtin/add.c
index 42c906e..a9a78f4 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -38,7 +38,7 @@ static void update_callback(struct diff_queue_struct *q,
 		const char *path = p->one->path;
 		switch (p->status) {
 		default:
-			die("unexpected diff status %c", p->status);
+			die(_("unexpected diff status %c"), p->status);
 		case DIFF_STATUS_UNMERGED:
 			/*
 			 * ADD_CACHE_IGNORE_REMOVAL is unset if "git
@@ -64,7 +64,7 @@ static void update_callback(struct diff_queue_struct *q,
 		case DIFF_STATUS_TYPE_CHANGED:
 			if (add_file_to_index(&the_index, path, data->flags)) {
 				if (!(data->flags & ADD_CACHE_IGNORE_ERRORS))
-					die("updating files failed");
+					die(_("updating files failed"));
 				data->add_errors++;
 			}
 			break;
@@ -172,7 +172,7 @@ static void treat_gitlinks(const char **pathspec)
 					/* strip trailing slash */
 					pathspec[j] = xstrndup(ce->name, len);
 				else
-					die ("Path '%s' is in submodule '%.*s'",
+					die (_("Path '%s' is in submodule '%.*s'"),
 						pathspec[j], len, ce->name);
 			}
 		}
@@ -191,7 +191,7 @@ static void refresh(int verbose, const char **pathspec)
 		      pathspec, seen, "Unstaged changes after refreshing the index:");
 	for (i = 0; i < specs; i++) {
 		if (!seen[i])
-			die("pathspec '%s' did not match any files", pathspec[i]);
+			die(_("pathspec '%s' did not match any files"), pathspec[i]);
 	}
         free(seen);
 }
@@ -205,7 +205,7 @@ static const char **validate_pathspec(int argc, const char **argv, const char *p
 		for (p = pathspec; *p; p++) {
 			if (has_symlink_leading_path(*p, strlen(*p))) {
 				int len = prefix ? strlen(prefix) : 0;
-				die("'%s' is beyond a symbolic link", *p + len);
+				die(_("'%s' is beyond a symbolic link"), *p + len);
 			}
 		}
 	}
@@ -272,7 +272,7 @@ static int edit_patch(int argc, const char **argv, const char *prefix)
 	git_config(git_diff_basic_config, NULL); /* no "diff" UI options */
 
 	if (read_cache() < 0)
-		die ("Could not read the index");
+		die (_("Could not read the index"));
 
 	init_revisions(&rev, prefix);
 	rev.diffopt.context = 7;
@@ -281,24 +281,24 @@ static int edit_patch(int argc, const char **argv, const char *prefix)
 	rev.diffopt.output_format = DIFF_FORMAT_PATCH;
 	out = open(file, O_CREAT | O_WRONLY, 0644);
 	if (out < 0)
-		die ("Could not open '%s' for writing.", file);
+		die (_("Could not open '%s' for writing."), file);
 	rev.diffopt.file = xfdopen(out, "w");
 	rev.diffopt.close_file = 1;
 	if (run_diff_files(&rev, 0))
-		die ("Could not write patch");
+		die (_("Could not write patch"));
 
 	launch_editor(file, NULL, NULL);
 
 	if (stat(file, &st))
-		die_errno("Could not stat '%s'", file);
+		die_errno(_("Could not stat '%s'"), file);
 	if (!st.st_size)
-		die("Empty patch. Aborted.");
+		die(_("Empty patch. Aborted."));
 
 	memset(&child, 0, sizeof(child));
 	child.git_cmd = 1;
 	child.argv = apply_argv;
 	if (run_command(&child))
-		die ("Could not apply '%s'", file);
+		die (_("Could not apply '%s'"), file);
 
 	unlink(file);
 	return 0;
@@ -354,7 +354,7 @@ static int add_files(struct dir_struct *dir, int flags)
 	for (i = 0; i < dir->nr; i++)
 		if (add_file_to_cache(dir->entries[i]->name, flags)) {
 			if (!ignore_add_errors)
-				die("adding files failed");
+				die(_("adding files failed"));
 			exit_status = 1;
 		}
 	return exit_status;
@@ -386,9 +386,9 @@ int cmd_add(int argc, const char **argv, const char *prefix)
 	argv++;
 
 	if (addremove && take_worktree_changes)
-		die("-A and -u are mutually incompatible");
+		die(_("-A and -u are mutually incompatible"));
 	if (!show_only && ignore_missing)
-		die("Option --ignore-missing can only be used together with --dry-run");
+		die(_("Option --ignore-missing can only be used together with --dry-run"));
 	if ((addremove || take_worktree_changes) && !argc) {
 		static const char *here[2] = { ".", NULL };
 		argc = 1;
@@ -408,14 +408,14 @@ int cmd_add(int argc, const char **argv, const char *prefix)
 		  ? ADD_CACHE_IGNORE_REMOVAL : 0));
 
 	if (require_pathspec && argc == 0) {
-		fprintf(stderr, "Nothing specified, nothing added.\n");
-		fprintf(stderr, "Maybe you wanted to say 'git add .'?\n");
+		fprintf(stderr, _("Nothing specified, nothing added.\n"));
+		fprintf(stderr, _("Maybe you wanted to say 'git add .'?\n"));
 		return 0;
 	}
 	pathspec = validate_pathspec(argc, argv, prefix);
 
 	if (read_cache() < 0)
-		die("index file corrupt");
+		die(_("index file corrupt"));
 	treat_gitlinks(pathspec);
 
 	if (add_new_files) {
@@ -467,7 +467,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
 	if (active_cache_changed) {
 		if (write_cache(newfd, active_cache, active_nr) ||
 		    commit_locked_index(&lock_file))
-			die("Unable to write new index file");
+			die(_("Unable to write new index file"));
 	}
 
 	return exit_status;
-- 
1.7.2.3

[PATCH 09/72] gettextize: git-add "no files added" message

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/add.c  |    2 +-
 t/t3700-add.sh |    5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/builtin/add.c b/builtin/add.c
index a9a78f4..df56429 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -348,7 +348,7 @@ static int add_files(struct dir_struct *dir, int flags)
 		for (i = 0; i < dir->ignored_nr; i++)
 			fprintf(stderr, "%s\n", dir->ignored[i]->name);
 		fprintf(stderr, "Use -f if you really want to add them.\n");
-		die("no files added");
+		die(_("no files added"));
 	}
 
 	for (i = 0; i < dir->nr; i++)
diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index ec71083..d4fc563 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -283,7 +283,10 @@ add 'track-this'
 EOF
 
 test_expect_success 'git add --dry-run --ignore-missing of non-existing file' '
-	test_must_fail git add --dry-run --ignore-missing track-this ignored-file >actual.out 2>actual.err &&
+	test_must_fail git add --dry-run --ignore-missing track-this ignored-file >actual.out 2>actual.err
+'
+
+test_expect_success NO_GETTEXT_POISON 'git add --dry-run --ignore-missing of non-existing file output' '
 	test_cmp expect.out actual.out &&
 	test_cmp expect.err actual.err
 '
-- 
1.7.2.3

[PATCH 11/72] gettextize: git-add "pathspec [...] did not match" message

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Gettextize the "pathspec '%s' did not match any files" message. A test
in t3700-add.sh explicitly checked for this message. Change it to skip
under GETTEXT_POISON=YesPlease.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/add.c  |    2 +-
 t/t3700-add.sh |    6 +++++-
 2 files changed, 6 insertions(+), 2 deletions(-)
diff --git a/builtin/add.c b/builtin/add.c
index fe4ac49..b3640c5 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -451,7 +451,7 @@ int cmd_add(int argc, const char **argv, const char *prefix)
 					if (excluded(&dir, pathspec[i], &dtype))
 						dir_add_ignored(&dir, pathspec[i], strlen(pathspec[i]));
 				} else
-					die("pathspec '%s' did not match any files",
+					die(_("pathspec '%s' did not match any files"),
 					    pathspec[i]);
 			}
 		}
diff --git a/t/t3700-add.sh b/t/t3700-add.sh
index d4fc563..9507191 100755
--- a/t/t3700-add.sh
+++ b/t/t3700-add.sh
@@ -269,7 +269,11 @@ test_expect_success 'git add --dry-run of existing changed file' "
 test_expect_success 'git add --dry-run of non-existing file' "
 	echo ignored-file >>.gitignore &&
 	test_must_fail git add --dry-run track-this ignored-file >actual 2>&1 &&
-	echo \"fatal: pathspec 'ignored-file' did not match any files\" | test_cmp - actual
+	echo \"fatal: pathspec 'ignored-file' did not match any files\" >expect
+"
+
+test_expect_success NO_GETTEXT_POISON 'git add --dry-run of an existing file output' "
+	test_cmp expect actual
 "
 
 cat >expect.err <<\EOF
-- 
1.7.2.3

[PATCH 10/72] gettextize: git-add "Use -f if you really want" message

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Gettextize the "Use -f if you really want to add them.\n"
message. Tests in t2204-add-ignored.sh and t3700-add.sh explicitly
checked for this message. Split the tests that did so up and skip
portion that calls grep on this message under
GETTEXT_POISON=YesPlease.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/add.c          |    2 +-
 t/t2204-add-ignored.sh |   37 +++++++++++++++++++++++++------------
 2 files changed, 26 insertions(+), 13 deletions(-)
diff --git a/builtin/add.c b/builtin/add.c
index df56429..fe4ac49 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -347,7 +347,7 @@ static int add_files(struct dir_struct *dir, int flags)
 		fprintf(stderr, ignore_error);
 		for (i = 0; i < dir->ignored_nr; i++)
 			fprintf(stderr, "%s\n", dir->ignored[i]->name);
-		fprintf(stderr, "Use -f if you really want to add them.\n");
+		fprintf(stderr, _("Use -f if you really want to add them.\n"));
 		die(_("no files added"));
 	}
 
diff --git a/t/t2204-add-ignored.sh b/t/t2204-add-ignored.sh
index 24afdab..be66e2d 100755
--- a/t/t2204-add-ignored.sh
+++ b/t/t2204-add-ignored.sh
@@ -31,18 +31,21 @@ do
 		rm -f .git/index &&
 		test_must_fail git add "$i" 2>err &&
 		git ls-files "$i" >out &&
-		! test -s out &&
-		grep -e "Use -f if" err &&
-		cat err
+		! test -s out
+	'
+
+	test_expect_success NO_GETTEXT_POISON "complaints for ignored $i output" '
+		grep -e "Use -f if" err
 	'
 
 	test_expect_success "complaints for ignored $i with unignored file" '
 		rm -f .git/index &&
 		test_must_fail git add "$i" file 2>err &&
 		git ls-files "$i" >out &&
-		! test -s out &&
-		grep -e "Use -f if" err &&
-		cat err
+		! test -s out
+	'
+	test_expect_success NO_GETTEXT_POISON "complaints for ignored $i with unignored file output" '
+		grep -e "Use -f if" err
 	'
 done
 
@@ -54,9 +57,14 @@ do
 			cd dir &&
 			test_must_fail git add "$i" 2>err &&
 			git ls-files "$i" >out &&
-			! test -s out &&
-			grep -e "Use -f if" err &&
-			cat err
+			! test -s out
+		)
+	'
+
+	test_expect_success NO_GETTEXT_POISON "complaints for ignored $i in dir output" '
+		(
+			cd dir &&
+			grep -e "Use -f if" err
 		)
 	'
 done
@@ -69,9 +77,14 @@ do
 			cd sub &&
 			test_must_fail git add "$i" 2>err &&
 			git ls-files "$i" >out &&
-			! test -s out &&
-			grep -e "Use -f if" err &&
-			cat err
+			! test -s out
+		)
+	'
+
+	test_expect_success NO_GETTEXT_POISON "complaints for ignored $i in sub output" '
+		(
+			cd sub &&
+			grep -e "Use -f if" err
 		)
 	'
 done
-- 
1.7.2.3

[PATCH 14/72] gettextize: git-branch basic messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/branch.c |   56 +++++++++++++++++++++++++++---------------------------
 1 files changed, 28 insertions(+), 28 deletions(-)
diff --git a/builtin/branch.c b/builtin/branch.c
index 9e546e4..6695db4 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -133,12 +133,12 @@ static int branch_merged(int kind, const char *name,
 	if ((head_rev != reference_rev) &&
 	    in_merge_bases(rev, &head_rev, 1) != merged) {
 		if (merged)
-			warning("deleting branch '%s' that has been merged to\n"
-				"         '%s', but it is not yet merged to HEAD.",
+			warning(_("deleting branch '%s' that has been merged to\n"
+				"         '%s', but it is not yet merged to HEAD."),
 				name, reference_name);
 		else
-			warning("not deleting branch '%s' that is not yet merged to\n"
-				"         '%s', even though it is merged to HEAD.",
+			warning(_("not deleting branch '%s' that is not yet merged to\n"
+				"         '%s', even though it is merged to HEAD."),
 				name, reference_name);
 	}
 	return merged;
@@ -165,19 +165,19 @@ static int delete_branches(int argc, const char **argv, int force, int kinds)
 		remote = "";
 		break;
 	default:
-		die("cannot use -a with -d");
+		die(_("cannot use -a with -d"));
 	}
 
 	if (!force) {
 		head_rev = lookup_commit_reference(head_sha1);
 		if (!head_rev)
-			die("Couldn't look up commit object for HEAD");
+			die(_("Couldn't look up commit object for HEAD"));
 	}
 	for (i = 0; i < argc; i++, strbuf_release(&bname)) {
 		strbuf_branchname(&bname, argv[i]);
 		if (kinds == REF_LOCAL_BRANCH && !strcmp(head, bname.buf)) {
-			error("Cannot delete the branch '%s' "
-			      "which you are currently on.", bname.buf);
+			error(_("Cannot delete the branch '%s' "
+			      "which you are currently on."), bname.buf);
 			ret = 1;
 			continue;
 		}
@@ -186,7 +186,7 @@ static int delete_branches(int argc, const char **argv, int force, int kinds)
 
 		name = xstrdup(mkpath(fmt, bname.buf));
 		if (!resolve_ref(name, sha1, 1, NULL)) {
-			error("%sbranch '%s' not found.",
+			error(_("%sbranch '%s' not found."),
 					remote, bname.buf);
 			ret = 1;
 			continue;
@@ -194,21 +194,21 @@ static int delete_branches(int argc, const char **argv, int force, int kinds)
 
 		rev = lookup_commit_reference(sha1);
 		if (!rev) {
-			error("Couldn't look up commit object for '%s'", name);
+			error(_("Couldn't look up commit object for '%s'"), name);
 			ret = 1;
 			continue;
 		}
 
 		if (!force && !branch_merged(kinds, bname.buf, rev, head_rev)) {
-			error("The branch '%s' is not fully merged.\n"
+			error(_("The branch '%s' is not fully merged.\n"
 			      "If you are sure you want to delete it, "
-			      "run 'git branch -D %s'.", bname.buf, bname.buf);
+			      "run 'git branch -D %s'."), bname.buf, bname.buf);
 			ret = 1;
 			continue;
 		}
 
 		if (delete_ref(name, sha1, 0)) {
-			error("Error deleting %sbranch '%s'", remote,
+			error(_("Error deleting %sbranch '%s'"), remote,
 			      bname.buf);
 			ret = 1;
 		} else {
@@ -218,7 +218,7 @@ static int delete_branches(int argc, const char **argv, int force, int kinds)
 			       find_unique_abbrev(sha1, DEFAULT_ABBREV));
 			strbuf_addf(&buf, "branch.%s", bname.buf);
 			if (git_config_rename_section(buf.buf, NULL) < 0)
-				warning("Update of config-file failed");
+				warning(_("Update of config-file failed"));
 			strbuf_release(&buf);
 		}
 	}
@@ -300,7 +300,7 @@ static int append_ref(const char *refname, const unsigned char *sha1, int flags,
 	if (ref_list->verbose || ref_list->with_commit || merge_filter != NO_FILTER) {
 		commit = lookup_commit_reference_gently(sha1, 1);
 		if (!commit) {
-			cb->ret = error("branch '%s' does not point at a commit", refname);
+			cb->ret = error(_("branch '%s' does not point at a commit"), refname);
 			return 0;
 		}
 
@@ -535,7 +535,7 @@ static int print_ref_list(int kinds, int detached, int verbose, int abbrev, stru
 	free_ref_list(&ref_list);
 
 	if (cb.ret)
-		error("some refs could not be read");
+		error(_("some refs could not be read"));
 
 	return cb.ret;
 }
@@ -548,7 +548,7 @@ static void rename_branch(const char *oldname, const char *newname, int force)
 	int recovery = 0;
 
 	if (!oldname)
-		die("cannot rename the current branch while not on any.");
+		die(_("cannot rename the current branch while not on any."));
 
 	if (strbuf_check_branch_ref(&oldref, oldname)) {
 		/*
@@ -558,35 +558,35 @@ static void rename_branch(const char *oldname, const char *newname, int force)
 		if (resolve_ref(oldref.buf, sha1, 1, NULL))
 			recovery = 1;
 		else
-			die("Invalid branch name: '%s'", oldname);
+			die(_("Invalid branch name: '%s'"), oldname);
 	}
 
 	if (strbuf_check_branch_ref(&newref, newname))
-		die("Invalid branch name: '%s'", newname);
+		die(_("Invalid branch name: '%s'"), newname);
 
 	if (resolve_ref(newref.buf, sha1, 1, NULL) && !force)
-		die("A branch named '%s' already exists.", newref.buf + 11);
+		die(_("A branch named '%s' already exists."), newref.buf + 11);
 
 	strbuf_addf(&logmsg, "Branch: renamed %s to %s",
 		 oldref.buf, newref.buf);
 
 	if (rename_ref(oldref.buf, newref.buf, logmsg.buf))
-		die("Branch rename failed");
+		die(_("Branch rename failed"));
 	strbuf_release(&logmsg);
 
 	if (recovery)
-		warning("Renamed a misnamed branch '%s' away", oldref.buf + 11);
+		warning(_("Renamed a misnamed branch '%s' away"), oldref.buf + 11);
 
 	/* no need to pass logmsg here as HEAD didn't really move */
 	if (!strcmp(oldname, head) && create_symref("HEAD", newref.buf, NULL))
-		die("Branch renamed to %s, but HEAD is not updated!", newname);
+		die(_("Branch renamed to %s, but HEAD is not updated!"), newname);
 
 	strbuf_addf(&oldsection, "branch.%s", oldref.buf + 11);
 	strbuf_release(&oldref);
 	strbuf_addf(&newsection, "branch.%s", newref.buf + 11);
 	strbuf_release(&newref);
 	if (git_config_rename_section(oldsection.buf, newsection.buf) < 0)
-		die("Branch is renamed, but update of config-file failed");
+		die(_("Branch is renamed, but update of config-file failed"));
 	strbuf_release(&oldsection);
 	strbuf_release(&newsection);
 }
@@ -601,7 +601,7 @@ static int opt_parse_merge_filter(const struct option *opt, const char *arg, int
 	if (!arg)
 		arg = "HEAD";
 	if (get_sha1(arg, merge_filter_ref))
-		die("malformed object name %s", arg);
+		die(_("malformed object name %s"), arg);
 	return 0;
 }
 
@@ -675,13 +675,13 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
 
 	head = resolve_ref("HEAD", head_sha1, 0, NULL);
 	if (!head)
-		die("Failed to resolve HEAD as a valid ref.");
+		die(_("Failed to resolve HEAD as a valid ref."));
 	head = xstrdup(head);
 	if (!strcmp(head, "HEAD")) {
 		detached = 1;
 	} else {
 		if (prefixcmp(head, "refs/heads/"))
-			die("HEAD not found below refs/heads!");
+			die(_("HEAD not found below refs/heads!"));
 		head += 11;
 	}
 	hashcpy(merge_filter_ref, head_sha1);
@@ -701,7 +701,7 @@ int cmd_branch(int argc, const char **argv, const char *prefix)
 		rename_branch(argv[0], argv[1], rename > 1);
 	else if (argc <= 2) {
 		if (kinds != REF_LOCAL_BRANCH)
-			die("-a and -r options to 'git branch' do not make sense with a branch name");
+			die(_("-a and -r options to 'git branch' do not make sense with a branch name"));
 		create_branch(head, argv[0], (argc == 2) ? argv[1] : head,
 			      force_create, reflog, track);
 	} else
-- 
1.7.2.3

[PATCH 12/72] gettextize: git-add "remove '%s'" message

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Gettextize the "remove '%s'\n" message. A test in t2200-add-update.sh
explicitly checked for this message. Change it to skip under
GETTEXT_POISON=YesPlease.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/add.c         |    2 +-
 t/t2200-add-update.sh |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin/add.c b/builtin/add.c
index b3640c5..e399d19 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -74,7 +74,7 @@ static void update_callback(struct diff_queue_struct *q,
 			if (!(data->flags & ADD_CACHE_PRETEND))
 				remove_file_from_index(&the_index, path);
 			if (data->flags & (ADD_CACHE_PRETEND|ADD_CACHE_VERBOSE))
-				printf("remove '%s'\n", path);
+				printf(_("remove '%s'\n"), path);
 			break;
 		}
 	}
diff --git a/t/t2200-add-update.sh b/t/t2200-add-update.sh
index 0692427..64182d9 100755
--- a/t/t2200-add-update.sh
+++ b/t/t2200-add-update.sh
@@ -111,7 +111,7 @@ test_expect_success 'touch and then add explicitly' '
 
 '
 
-test_expect_success 'add -n -u should not add but just report' '
+test_expect_success NO_GETTEXT_POISON 'add -n -u should not add but just report' '
 
 	(
 		echo "add '\''check'\''" &&
-- 
1.7.2.3

[PATCH 13/72] gettextize: git-add refresh_index message

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/add.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/builtin/add.c b/builtin/add.c
index e399d19..3e75460 100644
--- a/builtin/add.c
+++ b/builtin/add.c
@@ -188,7 +188,7 @@ static void refresh(int verbose, const char **pathspec)
 		/* nothing */;
 	seen = xcalloc(specs, 1);
 	refresh_index(&the_index, verbose ? REFRESH_IN_PORCELAIN : REFRESH_QUIET,
-		      pathspec, seen, "Unstaged changes after refreshing the index:");
+		      pathspec, seen, _("Unstaged changes after refreshing the index:"));
 	for (i = 0; i < specs; i++) {
 		if (!seen[i])
 			die(_("pathspec '%s' did not match any files"), pathspec[i]);
-- 
1.7.2.3

[PATCH 15/72] gettextize: git-branch "remote branch '%s' not found" message

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

This could be done better by splitting it up, but it would change too
much code, which I'm trying to avoid at this point. Instead add a
TRANSLATORS comment to explain what "remote " does.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/branch.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/builtin/branch.c b/builtin/branch.c
index 6695db4..e9d8a5a 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -157,7 +157,8 @@ static int delete_branches(int argc, const char **argv, int force, int kinds)
 	switch (kinds) {
 	case REF_REMOTE_BRANCH:
 		fmt = "refs/remotes/%s";
-		remote = "remote ";
+		/* TRANSLATORS: This is "remote " in "remote branch '%s' not found" */
+		remote = _("remote ");
 		force = 1;
 		break;
 	case REF_LOCAL_BRANCH:
-- 
1.7.2.3

[PATCH 17/72] gettextize: git-branch "git branch -v" messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Make the "git branch -v" messages translatable, e.g.:

    5054b57 [ahead 8] branch error fixup

This is possibly a plumbing message.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/branch.c         |    6 +++---
 t/t6040-tracking-info.sh |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/builtin/branch.c b/builtin/branch.c
index d276681..4c1a256 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -373,11 +373,11 @@ static void fill_tracking_info(struct strbuf *stat, const char *branch_name,
 		strbuf_addf(stat, "%s: ",
 			shorten_unambiguous_ref(branch->merge[0]->dst, 0));
 	if (!ours)
-		strbuf_addf(stat, "behind %d] ", theirs);
+		strbuf_addf(stat, _("behind %d] "), theirs);
 	else if (!theirs)
-		strbuf_addf(stat, "ahead %d] ", ours);
+		strbuf_addf(stat, _("ahead %d] "), ours);
 	else
-		strbuf_addf(stat, "ahead %d, behind %d] ", ours, theirs);
+		strbuf_addf(stat, _("ahead %d, behind %d] "), ours, theirs);
 }
 
 static int matches_merge_filter(struct commit *commit)
diff --git a/t/t6040-tracking-info.sh b/t/t6040-tracking-info.sh
index 1e0447f..d508a19 100755
--- a/t/t6040-tracking-info.sh
+++ b/t/t6040-tracking-info.sh
@@ -42,7 +42,7 @@ b3 behind 1
 b4 ahead 2
 EOF
 
-test_expect_success 'branch -v' '
+test_expect_success NO_GETTEXT_POISON 'branch -v' '
 	(
 		cd test &&
 		git branch -v
-- 
1.7.2.3

[PATCH 18/72] gettextize: git-branch "(no branch)" message

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Gettextize the "(no branch)" message that's shown by "git branch" when
you're in a detached HEAD.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/branch.c         |    2 +-
 t/t3203-branch-output.sh |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin/branch.c b/builtin/branch.c
index 4c1a256..244589e 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -476,7 +476,7 @@ static void show_detached(struct ref_list *ref_list)
 
 	if (head_commit && is_descendant_of(head_commit, ref_list->with_commit)) {
 		struct ref_item item;
-		item.name = xstrdup("(no branch)");
+		item.name = xstrdup(_("(no branch)"));
 		item.len = strlen(item.name);
 		item.kind = REF_LOCAL_BRANCH;
 		item.dest = NULL;
diff --git a/t/t3203-branch-output.sh b/t/t3203-branch-output.sh
index 6028748..cf04bb2 100755
--- a/t/t3203-branch-output.sh
+++ b/t/t3203-branch-output.sh
@@ -72,7 +72,7 @@ cat >expect <<'EOF'
   branch-two
   master
 EOF
-test_expect_success 'git branch shows detached HEAD properly' '
+test_expect_success NO_GETTEXT_POISON 'git branch shows detached HEAD properly' '
 	git checkout HEAD^0 &&
 	git branch >actual &&
 	test_cmp expect actual
-- 
1.7.2.3

[PATCH 16/72] gettextize: git-branch "Deleted branch [...]" message

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Gettextize the "Deleted %sbranch %s (was %s).\n" messages. test in
t3200-branch.sh explicitly checked for this message. Change it to skip
under GETTEXT_POISON=YesPlease.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/branch.c  |    2 +-
 t/t3200-branch.sh |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin/branch.c b/builtin/branch.c
index e9d8a5a..d276681 100644
--- a/builtin/branch.c
+++ b/builtin/branch.c
@@ -214,7 +214,7 @@ static int delete_branches(int argc, const char **argv, int force, int kinds)
 			ret = 1;
 		} else {
 			struct strbuf buf = STRBUF_INIT;
-			printf("Deleted %sbranch %s (was %s).\n", remote,
+			printf(_("Deleted %sbranch %s (was %s).\n"), remote,
 			       bname.buf,
 			       find_unique_abbrev(sha1, DEFAULT_ABBREV));
 			strbuf_addf(&buf, "branch.%s", bname.buf);
diff --git a/t/t3200-branch.sh b/t/t3200-branch.sh
index f308235..04997cf 100755
--- a/t/t3200-branch.sh
+++ b/t/t3200-branch.sh
@@ -203,7 +203,7 @@ test_expect_success 'test deleting branch deletes branch config' \
      test -z "$(git config branch.my7.remote)" &&
      test -z "$(git config branch.my7.merge)"'
 
-test_expect_success 'test deleting branch without config' \
+test_expect_success NO_GETTEXT_POISON 'test deleting branch without config' \
     'git branch my7 s &&
      sha1=$(git rev-parse my7 | cut -c 1-7) &&
      test "$(git branch -d my7 2>&1)" = "Deleted branch my7 (was $sha1)."'
-- 
1.7.2.3

[PATCH 20/72] gettextize: git-checkout: our/their version message

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Split up the "does not have our/their version" message to make it
easier to translate.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/checkout.c |   14 ++++++++------
 1 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/builtin/checkout.c b/builtin/checkout.c
index b5060ab..7ba0788 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -103,9 +103,10 @@ static int check_stage(int stage, struct cache_entry *ce, int pos)
 			return 0;
 		pos++;
 	}
-	return error("path '%s' does not have %s version",
-		     ce->name,
-		     (stage == 2) ? "our" : "their");
+	if (stage == 2)
+		return error(_("path '%s' does not have our version"), ce->name);
+	else
+		return error(_("path '%s' does not have their version"), ce->name);
 }
 
 static int check_all_stages(struct cache_entry *ce, int pos)
@@ -130,9 +131,10 @@ static int checkout_stage(int stage, struct cache_entry *ce, int pos,
 			return checkout_entry(active_cache[pos], state, NULL);
 		pos++;
 	}
-	return error("path '%s' does not have %s version",
-		     ce->name,
-		     (stage == 2) ? "our" : "their");
+	if (stage == 2)
+		return error(_("path '%s' does not have our version"), ce->name);
+	else
+		return error(_("path '%s' does not have their version"), ce->name);
 }
 
 static int checkout_merged(int pos, struct checkout *state)
-- 
1.7.2.3

[PATCH 21/72] gettextize: git-checkout describe_detached_head messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/checkout.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 7ba0788..698ac63 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -613,7 +613,7 @@ static int switch_branches(struct checkout_opts *opts, struct branch_info *new)
 	 * to remind the user that it might be lost.
 	 */
 	if (!opts->quiet && !old.path && old.commit && new->commit != old.commit)
-		describe_detached_head("Previous HEAD position was", old.commit);
+		describe_detached_head(_("Previous HEAD position was"), old.commit);
 
 	update_refs_for_switch(opts, &old, new);
 
-- 
1.7.2.3

[PATCH 22/72] gettextize: git-checkout "HEAD is now at" message

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Gettextize the "HEAD is now at" messages. Several tests in t7201-co.sh
explicitly checked for this message. Change them to skip under
GETTEXT_POISON=YesPlease.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/checkout.c |    2 +-
 t/t7201-co.sh      |   10 +++++-----
 2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/builtin/checkout.c b/builtin/checkout.c
index 698ac63..f833330 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -571,7 +571,7 @@ static void update_refs_for_switch(struct checkout_opts *opts,
 		if (!opts->quiet) {
 			if (old->path && advice_detached_head)
 				detach_advice(old->path, new->name);
-			describe_detached_head("HEAD is now at", new->commit);
+			describe_detached_head(_("HEAD is now at"), new->commit);
 		}
 	}
 	remove_branch_state();
diff --git a/t/t7201-co.sh b/t/t7201-co.sh
index 1337fa5..fe7536b 100755
--- a/t/t7201-co.sh
+++ b/t/t7201-co.sh
@@ -223,7 +223,7 @@ test_expect_success 'checkout --merge --conflict=diff3 <branch>' '
 	test_cmp two expect
 '
 
-test_expect_success 'checkout to detach HEAD (with advice declined)' '
+test_expect_success NO_GETTEXT_POISON 'checkout to detach HEAD (with advice declined)' '
 
 	git config advice.detachedHead false &&
 	git checkout -f renamer && git clean -f &&
@@ -242,7 +242,7 @@ test_expect_success 'checkout to detach HEAD (with advice declined)' '
 	fi
 '
 
-test_expect_success 'checkout to detach HEAD' '
+test_expect_success NO_GETTEXT_POISON 'checkout to detach HEAD' '
 	git config advice.detachedHead true &&
 	git checkout -f renamer && git clean -f &&
 	git checkout renamer^ 2>messages &&
@@ -260,7 +260,7 @@ test_expect_success 'checkout to detach HEAD' '
 	fi
 '
 
-test_expect_success 'checkout to detach HEAD with branchname^' '
+test_expect_success NO_GETTEXT_POISON 'checkout to detach HEAD with branchname^' '
 
 	git checkout -f master && git clean -f &&
 	git checkout renamer^ &&
@@ -276,7 +276,7 @@ test_expect_success 'checkout to detach HEAD with branchname^' '
 	fi
 '
 
-test_expect_success 'checkout to detach HEAD with :/message' '
+test_expect_success NO_GETTEXT_POISON 'checkout to detach HEAD with :/message' '
 
 	git checkout -f master && git clean -f &&
 	git checkout ":/Initial" &&
@@ -292,7 +292,7 @@ test_expect_success 'checkout to detach HEAD with :/message' '
 	fi
 '
 
-test_expect_success 'checkout to detach HEAD with HEAD^0' '
+test_expect_success NO_GETTEXT_POISON 'checkout to detach HEAD with HEAD^0' '
 
 	git checkout -f master && git clean -f &&
 	git checkout HEAD^0 &&
-- 
1.7.2.3

[PATCH 29/72] gettextize: git-commit advice messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/commit.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/builtin/commit.c b/builtin/commit.c
index ac8da45..df881d5 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -38,7 +38,7 @@ static const char * const builtin_status_usage[] = {
 };
 
 static const char implicit_ident_advice[] =
-"Your name and email address were configured automatically based\n"
+N_("Your name and email address were configured automatically based\n"
 "on your username and hostname. Please check that they are accurate.\n"
 "You can suppress this message by setting them explicitly:\n"
 "\n"
@@ -47,12 +47,12 @@ static const char implicit_ident_advice[] =
 "\n"
 "After doing this, you may fix the identity used for this commit with:\n"
 "\n"
-"    git commit --amend --reset-author\n";
+"    git commit --amend --reset-author\n");
 
 static const char empty_amend_advice[] =
-"You asked to amend the most recent commit, but doing so would make\n"
+N_("You asked to amend the most recent commit, but doing so would make\n"
 "it empty. You can repeat your command with --allow-empty, or you can\n"
-"remove the commit entirely with \"git reset HEAD^\".\n";
+"remove the commit entirely with \"git reset HEAD^\".\n");
 
 static unsigned char head_sha1[20];
 
@@ -770,7 +770,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 	    !(amend && is_a_merge(head_sha1))) {
 		run_status(stdout, index_file, prefix, 0, s);
 		if (amend)
-			fputs(empty_amend_advice, stderr);
+			fputs(_(empty_amend_advice), stderr);
 		return 0;
 	}
 
@@ -1197,7 +1197,7 @@ static void print_summary(const char *prefix, const unsigned char *sha1)
 		strbuf_addbuf_percentquote(&format, &committer_ident);
 		if (advice_implicit_identity) {
 			strbuf_addch(&format, '\n');
-			strbuf_addstr(&format, implicit_ident_advice);
+			strbuf_addstr(&format, _(implicit_ident_advice));
 		}
 	}
 	strbuf_release(&author_ident);
-- 
1.7.2.3

[PATCH 23/72] gettextize: git-checkout "Switched to a .. branch" message

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Split up the "Switched to and reset branch" and "Switched to a new
branch" messages to make them easier to translate.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/checkout.c |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/builtin/checkout.c b/builtin/checkout.c
index f833330..2bb7759 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -550,9 +550,10 @@ static void update_refs_for_switch(struct checkout_opts *opts,
 				fprintf(stderr, _("Already on '%s'\n"),
 					new->name);
 			else if (opts->new_branch)
-				fprintf(stderr, "Switched to%s branch '%s'\n",
-					opts->branch_exists ? " and reset" : " a new",
-					new->name);
+				if (opts->branch_exists)
+					fprintf(stderr, _("Switched to and reset branch '%s'\n"), new->name);
+				else
+					fprintf(stderr, _("Switched to a new branch '%s'\n"), new->name);
 			else
 				fprintf(stderr, _("Switched to branch '%s'\n"),
 					new->name);
-- 
1.7.2.3

[PATCH 30/72] gettextize: git-diff basic messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/diff.c |   18 +++++++++---------
 1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/builtin/diff.c b/builtin/diff.c
index 42822cd..0034273 100644
--- a/builtin/diff.c
+++ b/builtin/diff.c
@@ -71,9 +71,9 @@ static int builtin_diff_b_f(struct rev_info *revs,
 		usage(builtin_diff_usage);
 
 	if (lstat(path, &st))
-		die_errno("failed to stat '%s'", path);
+		die_errno(_("failed to stat '%s'"), path);
 	if (!(S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)))
-		die("'%s': not a regular file or symlink", path);
+		die(_("'%s': not a regular file or symlink"), path);
 
 	diff_set_mnemonic_prefix(&revs->diffopt, "o/", "w/");
 
@@ -222,7 +222,7 @@ static int builtin_diff_files(struct rev_info *revs, int argc, const char **argv
 		else if (!strcmp(argv[1], "-h"))
 			usage(builtin_diff_usage);
 		else
-			return error("invalid option: %s", argv[1]);
+			return error(_("invalid option: %s"), argv[1]);
 		argv++; argc--;
 	}
 
@@ -299,12 +299,12 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
 	DIFF_OPT_SET(&rev.diffopt, ALLOW_TEXTCONV);
 
 	if (nongit)
-		die("Not a git repository");
+		die(_("Not a git repository"));
 	argc = setup_revisions(argc, argv, &rev, NULL);
 	if (!rev.diffopt.output_format) {
 		rev.diffopt.output_format = DIFF_FORMAT_PATCH;
 		if (diff_setup_done(&rev.diffopt) < 0)
-			die("diff_setup_done failed");
+			die(_("diff_setup_done failed"));
 	}
 
 	DIFF_OPT_SET(&rev.diffopt, RECURSIVE);
@@ -349,12 +349,12 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
 			obj = parse_object(obj->sha1);
 		obj = deref_tag(obj, NULL, 0);
 		if (!obj)
-			die("invalid object '%s' given.", name);
+			die(_("invalid object '%s' given."), name);
 		if (obj->type == OBJ_COMMIT)
 			obj = &((struct commit *)obj)->tree->object;
 		if (obj->type == OBJ_TREE) {
 			if (ARRAY_SIZE(ent) <= ents)
-				die("more than %d trees given: '%s'",
+				die(_("more than %d trees given: '%s'"),
 				    (int) ARRAY_SIZE(ent), name);
 			obj->flags |= flags;
 			ent[ents].item = obj;
@@ -364,7 +364,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
 		}
 		if (obj->type == OBJ_BLOB) {
 			if (2 <= blobs)
-				die("more than two blobs given: '%s'", name);
+				die(_("more than two blobs given: '%s'"), name);
 			hashcpy(blob[blobs].sha1, obj->sha1);
 			blob[blobs].name = name;
 			blob[blobs].mode = list->mode;
@@ -372,7 +372,7 @@ int cmd_diff(int argc, const char **argv, const char *prefix)
 			continue;
 
 		}
-		die("unhandled object '%s' given.", name);
+		die(_("unhandled object '%s' given."), name);
 	}
 	if (rev.prune_data) {
 		const char **pathspec = rev.prune_data;
-- 
1.7.2.3

[PATCH 31/72] gettextize: git-fetch basic messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/fetch.c |   46 +++++++++++++++++++++++-----------------------
 1 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 357f3cd..c27c3e9 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -184,7 +184,7 @@ static struct ref *get_ref_map(struct transport *transport,
 		} else {
 			ref_map = get_remote_ref(remote_refs, "HEAD");
 			if (!ref_map)
-				die("Couldn't find remote ref HEAD");
+				die(_("Couldn't find remote ref HEAD"));
 			ref_map->merge = 1;
 			tail = &ref_map->next;
 		}
@@ -237,7 +237,7 @@ static int update_local_ref(struct ref *ref,
 	*display = 0;
 	type = sha1_object_info(ref->new_sha1, NULL);
 	if (type < 0)
-		die("object %s not found", sha1_to_hex(ref->new_sha1));
+		die(_("object %s not found"), sha1_to_hex(ref->new_sha1));
 
 	if (!hashcmp(ref->old_sha1, ref->new_sha1)) {
 		if (verbosity > 0)
@@ -337,7 +337,7 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
 
 	fp = fopen(filename, "a");
 	if (!fp)
-		return error("cannot open %s: %s\n", filename, strerror(errno));
+		return error(_("cannot open %s: %s\n"), filename, strerror(errno));
 
 	if (raw_url)
 		url = transport_anonymize_url(raw_url);
@@ -426,9 +426,9 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
 	free(url);
 	fclose(fp);
 	if (rc & STORE_REF_ERROR_DF_CONFLICT)
-		error("some local refs could not be updated; try running\n"
+		error(_("some local refs could not be updated; try running\n"
 		      " 'git remote prune %s' to remove any old, conflicting "
-		      "branches", remote_name);
+		      "branches"), remote_name);
 	return rc;
 }
 
@@ -476,7 +476,7 @@ static int quickfetch(struct ref *ref_map)
 
 	err = start_command(&revlist);
 	if (err) {
-		error("could not run rev-list");
+		error(_("could not run rev-list"));
 		return err;
 	}
 
@@ -490,14 +490,14 @@ static int quickfetch(struct ref *ref_map)
 		if (write_in_full(revlist.in, sha1_to_hex(ref->old_sha1), 40) < 0 ||
 		    write_str_in_full(revlist.in, "\n") < 0) {
 			if (errno != EPIPE && errno != EINVAL)
-				error("failed write to rev-list: %s", strerror(errno));
+				error(_("failed write to rev-list: %s"), strerror(errno));
 			err = -1;
 			break;
 		}
 	}
 
 	if (close(revlist.in)) {
-		error("failed to close rev-list's stdin: %s", strerror(errno));
+		error(_("failed to close rev-list's stdin: %s"), strerror(errno));
 		err = -1;
 	}
 
@@ -650,8 +650,8 @@ static void check_not_current_branch(struct ref *ref_map)
 	for (; ref_map; ref_map = ref_map->next)
 		if (ref_map->peer_ref && !strcmp(current_branch->refname,
 					ref_map->peer_ref->name))
-			die("Refusing to fetch into current branch %s "
-			    "of non-bare repository", current_branch->refname);
+			die(_("Refusing to fetch into current branch %s "
+			    "of non-bare repository"), current_branch->refname);
 }
 
 static int truncate_fetch_head(void)
@@ -660,7 +660,7 @@ static int truncate_fetch_head(void)
 	FILE *fp = fopen(filename, "w");
 
 	if (!fp)
-		return error("cannot open %s: %s\n", filename, strerror(errno));
+		return error(_("cannot open %s: %s\n"), filename, strerror(errno));
 	fclose(fp);
 	return 0;
 }
@@ -684,7 +684,7 @@ static int do_fetch(struct transport *transport,
 	}
 
 	if (!transport->get_refs_list || !transport->fetch)
-		die("Don't know how to fetch from %s", transport->url);
+		die(_("Don't know how to fetch from %s"), transport->url);
 
 	/* if not appending, truncate FETCH_HEAD */
 	if (!append && !dry_run) {
@@ -738,10 +738,10 @@ static void set_option(const char *name, const char *value)
 {
 	int r = transport_set_option(transport, name, value);
 	if (r < 0)
-		die("Option \"%s\" value \"%s\" is not valid for %s",
+		die(_("Option \"%s\" value \"%s\" is not valid for %s"),
 			name, value, transport->url);
 	if (r > 0)
-		warning("Option \"%s\" is ignored for %s\n",
+		warning(_("Option \"%s\" is ignored for %s\n"),
 			name, transport->url);
 }
 
@@ -838,9 +838,9 @@ static int fetch_multiple(struct string_list *list)
 		argv[argc] = name;
 		argv[argc + 1] = NULL;
 		if (verbosity >= 0)
-			printf("Fetching %s\n", name);
+			printf(_("Fetching %s\n"), name);
 		if (run_command_v_opt(argv, RUN_GIT_CMD)) {
-			error("Could not fetch %s", name);
+			error(_("Could not fetch %s"), name);
 			result = 1;
 		}
 	}
@@ -856,8 +856,8 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)
 	int exit_code;
 
 	if (!remote)
-		die("No remote repository specified.  Please, specify either a URL or a\n"
-		    "remote name from which new revisions should be fetched.");
+		die(_("No remote repository specified.  Please, specify either a URL or a\n"
+		    "remote name from which new revisions should be fetched."));
 
 	transport = transport_get(remote, NULL);
 	transport_set_verbosity(transport, verbosity, progress);
@@ -876,7 +876,7 @@ static int fetch_one(struct remote *remote, int argc, const char **argv)
 				char *ref;
 				i++;
 				if (i >= argc)
-					die("You need to specify a tag name.");
+					die(_("You need to specify a tag name."));
 				ref = xmalloc(strlen(argv[i]) * 2 + 22);
 				strcpy(ref, "refs/tags/");
 				strcat(ref, argv[i]);
@@ -916,9 +916,9 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
 
 	if (all) {
 		if (argc == 1)
-			die("fetch --all does not take a repository argument");
+			die(_("fetch --all does not take a repository argument"));
 		else if (argc > 1)
-			die("fetch --all does not make sense with refspecs");
+			die(_("fetch --all does not make sense with refspecs"));
 		(void) for_each_remote(get_one_remote_for_fetch, &list);
 		result = fetch_multiple(&list);
 	} else if (argc == 0) {
@@ -929,7 +929,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
 		/* All arguments are assumed to be remotes or groups */
 		for (i = 0; i < argc; i++)
 			if (!add_remote_or_group(argv[i], &list))
-				die("No such remote or remote group: %s", argv[i]);
+				die(_("No such remote or remote group: %s"), argv[i]);
 		result = fetch_multiple(&list);
 	} else {
 		/* Single remote or group */
@@ -937,7 +937,7 @@ int cmd_fetch(int argc, const char **argv, const char *prefix)
 		if (list.nr > 1) {
 			/* More than one remote */
 			if (argc > 1)
-				die("Fetching a group and specifying refspecs does not make sense");
+				die(_("Fetching a group and specifying refspecs does not make sense"));
 			result = fetch_multiple(&list);
 		} else {
 			/* Zero or one remotes */
-- 
1.7.2.3

[PATCH 34/72] gettextize: git-fetch split up "(non-fast-forward)" message

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Split up the "(non-fast-forward)" message from printf directives and
make it translatable.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/fetch.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 4f622fd..ee2c5f5 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -317,9 +317,9 @@ static int update_local_ref(struct ref *ref,
 			r ? _("unable to update local ref") : _("forced update"));
 		return r;
 	} else {
-		sprintf(display, "! %-*s %-*s -> %s  (non-fast-forward)",
-			TRANSPORT_SUMMARY_WIDTH, "[rejected]", REFCOL_WIDTH, remote,
-			pretty_ref);
+		sprintf(display, "! %-*s %-*s -> %s  %s",
+			TRANSPORT_SUMMARY_WIDTH, _("[rejected]"), REFCOL_WIDTH, remote,
+			pretty_ref, _("(non-fast-forward)"));
 		return 1;
 	}
 }
-- 
1.7.2.3

[PATCH 33/72] gettextize: git-fetch update_local_ref messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Translate a "[rejected]" message spotted by Jeff King, and other
things in update_local_ref along with it.

Reported-by: Jeff King <redacted>
Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/fetch.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/builtin/fetch.c b/builtin/fetch.c
index 0a73dff..4f622fd 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -279,17 +279,17 @@ static int update_local_ref(struct ref *ref,
 		int r;
 		if (!strncmp(ref->name, "refs/tags/", 10)) {
 			msg = "storing tag";
-			what = "[new tag]";
+			what = _("[new tag]");
 		}
 		else {
 			msg = "storing head";
-			what = "[new branch]";
+			what = _("[new branch]");
 		}
 
 		r = s_update_ref(msg, ref, 0);
 		sprintf(display, "%c %-*s %-*s -> %s%s", r ? '!' : '*',
 			TRANSPORT_SUMMARY_WIDTH, what, REFCOL_WIDTH, remote, pretty_ref,
-			r ? "  (unable to update local ref)" : "");
+			r ? _("  (unable to update local ref)") : "");
 		return r;
 	}
 
@@ -302,7 +302,7 @@ static int update_local_ref(struct ref *ref,
 		r = s_update_ref("fast-forward", ref, 1);
 		sprintf(display, "%c %-*s %-*s -> %s%s", r ? '!' : ' ',
 			TRANSPORT_SUMMARY_WIDTH, quickref, REFCOL_WIDTH, remote,
-			pretty_ref, r ? "  (unable to update local ref)" : "");
+			pretty_ref, r ? _("  (unable to update local ref)") : "");
 		return r;
 	} else if (force || ref->force) {
 		char quickref[84];
@@ -314,7 +314,7 @@ static int update_local_ref(struct ref *ref,
 		sprintf(display, "%c %-*s %-*s -> %s  (%s)", r ? '!' : '+',
 			TRANSPORT_SUMMARY_WIDTH, quickref, REFCOL_WIDTH, remote,
 			pretty_ref,
-			r ? "unable to update local ref" : "forced update");
+			r ? _("unable to update local ref") : _("forced update"));
 		return r;
 	} else {
 		sprintf(display, "! %-*s %-*s -> %s  (non-fast-forward)",
-- 
1.7.2.3

[PATCH 43/72] gettextize: git-mv basic messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/mv.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/builtin/mv.c b/builtin/mv.c
index 93e8995..18a2218 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -74,7 +74,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 
 	newfd = hold_locked_index(&lock_file, 1);
 	if (read_cache() < 0)
-		die("index file corrupt");
+		die(_("index file corrupt"));
 
 	source = copy_pathspec(prefix, argv, argc, 0);
 	modes = xcalloc(argc, sizeof(enum update_mode));
@@ -100,7 +100,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 		const char *bad = NULL;
 
 		if (show_only)
-			printf("Checking rename of '%s' to '%s'\n", src, dst);
+			printf(_("Checking rename of '%s' to '%s'\n"), src, dst);
 
 		length = strlen(src);
 		if (lstat(src, &st) < 0)
@@ -120,7 +120,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 
 			first = cache_name_pos(src_w_slash, len_w_slash);
 			if (first >= 0)
-				die ("Huh? %.*s is in index?",
+				die (_("Huh? %.*s is in index?"),
 						len_w_slash, src_w_slash);
 
 			first = -1 - first;
@@ -172,7 +172,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 				 * check both source and destination
 				 */
 				if (S_ISREG(st.st_mode) || S_ISLNK(st.st_mode)) {
-					warning("%s; will overwrite!", bad);
+					warning(_("%s; will overwrite!"), bad);
 					bad = NULL;
 				} else
 					bad = "Cannot overwrite";
@@ -193,7 +193,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 					i--;
 				}
 			} else
-				die ("%s, source=%s, destination=%s",
+				die (_("%s, source=%s, destination=%s"),
 				     bad, src, dst);
 		}
 	}
@@ -203,10 +203,10 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 		enum update_mode mode = modes[i];
 		int pos;
 		if (show_only || verbose)
-			printf("Renaming %s to %s\n", src, dst);
+			printf(_("Renaming %s to %s\n"), src, dst);
 		if (!show_only && mode != INDEX &&
 				rename(src, dst) < 0 && !ignore_errors)
-			die_errno ("renaming '%s' failed", src);
+			die_errno (_("renaming '%s' failed"), src);
 
 		if (mode == WORKING_DIRECTORY)
 			continue;
@@ -220,7 +220,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 	if (active_cache_changed) {
 		if (write_cache(newfd, active_cache, active_nr) ||
 		    commit_locked_index(&lock_file))
-			die("Unable to write new index file");
+			die(_("Unable to write new index file"));
 	}
 
 	return 0;
-- 
1.7.2.3

[PATCH 42/72] gettextize: git-merge "Wonderful" message

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Gettextize the "Wonderful" message. A test in t7600-merge.sh
explicitly checked for this message. Change it to skip under
GETTEXT_POISON=YesPlease.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/merge.c  |    2 +-
 t/t7600-merge.sh |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin/merge.c b/builtin/merge.c
index 4f6b34f..f998206 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -803,7 +803,7 @@ static int merge_trivial(void)
 	struct commit_list *parent = xmalloc(sizeof(*parent));
 
 	write_tree_trivial(result_tree);
-	printf("Wonderful.\n");
+	printf(_("Wonderful.\n"));
 	parent->item = lookup_commit(head);
 	parent->next = xmalloc(sizeof(*parent->next));
 	parent->next->item = remoteheads->item;
diff --git a/t/t7600-merge.sh b/t/t7600-merge.sh
index b147a1b..3aafdda 100755
--- a/t/t7600-merge.sh
+++ b/t/t7600-merge.sh
@@ -495,7 +495,7 @@ test_expect_success 'merge fast-forward in a dirty tree' '
 
 test_debug 'git log --graph --decorate --oneline --all'
 
-test_expect_success 'in-index merge' '
+test_expect_success NO_GETTEXT_POISON 'in-index merge' '
 	git reset --hard c0 &&
 	git merge --no-ff -s resolve c1 >out &&
 	grep "Wonderful." out &&
-- 
1.7.2.3

[PATCH 45/72] gettextize: git-rm basic messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Make the basic git-mv messages translatable, but skip things like "rm
'%s'\n" and "git rm '%s'\n" for now.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/rm.c |   22 +++++++++++-----------
 1 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/builtin/rm.c b/builtin/rm.c
index ff491d7..90c8a50 100644
--- a/builtin/rm.c
+++ b/builtin/rm.c
@@ -106,19 +106,19 @@ static int check_local_mod(unsigned char *head, int index_only)
 		 */
 		if (local_changes && staged_changes) {
 			if (!index_only || !(ce->ce_flags & CE_INTENT_TO_ADD))
-				errs = error("'%s' has staged content different "
+				errs = error(_("'%s' has staged content different "
 					     "from both the file and the HEAD\n"
-					     "(use -f to force removal)", name);
+					     "(use -f to force removal)"), name);
 		}
 		else if (!index_only) {
 			if (staged_changes)
-				errs = error("'%s' has changes staged in the index\n"
+				errs = error(_("'%s' has changes staged in the index\n"
 					     "(use --cached to keep the file, "
-					     "or -f to force removal)", name);
+					     "or -f to force removal)"), name);
 			if (local_changes)
-				errs = error("'%s' has local modifications\n"
+				errs = error(_("'%s' has local modifications\n"
 					     "(use --cached to keep the file, "
-					     "or -f to force removal)", name);
+					     "or -f to force removal)"), name);
 		}
 	}
 	return errs;
@@ -159,7 +159,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
 	newfd = hold_locked_index(&lock_file, 1);
 
 	if (read_cache() < 0)
-		die("index file corrupt");
+		die(_("index file corrupt"));
 
 	pathspec = get_pathspec(prefix, argv);
 	refresh_index(&the_index, REFRESH_QUIET, pathspec, NULL, NULL);
@@ -183,7 +183,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
 		for (i = 0; (match = pathspec[i]) != NULL ; i++) {
 			if (!seen[i]) {
 				if (!ignore_unmatch) {
-					die("pathspec '%s' did not match any files",
+					die(_("pathspec '%s' did not match any files"),
 					    match);
 				}
 			}
@@ -191,7 +191,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
 				seen_any = 1;
 			}
 			if (!recursive && seen[i] == MATCHED_RECURSIVELY)
-				die("not removing '%s' recursively without -r",
+				die(_("not removing '%s' recursively without -r"),
 				    *match ? match : ".");
 		}
 
@@ -227,7 +227,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
 			printf("rm '%s'\n", path);
 
 		if (remove_file_from_cache(path))
-			die("git rm: unable to remove %s", path);
+			die(_("git rm: unable to remove %s"), path);
 	}
 
 	if (show_only)
@@ -257,7 +257,7 @@ int cmd_rm(int argc, const char **argv, const char *prefix)
 	if (active_cache_changed) {
 		if (write_cache(newfd, active_cache, active_nr) ||
 		    commit_locked_index(&lock_file))
-			die("Unable to write new index file");
+			die(_("Unable to write new index file"));
 	}
 
 	return 0;
-- 
1.7.2.3

[PATCH 50/72] gettextize: git-tag tag_template message

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Mark the tag_template message as translatable with N_() and then use
it later with _(). We need to skip a test under GETTEXT_POISON that
relies on the output having a leading newline.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/tag.c  |    6 +++---
 t/t7004-tag.sh |    1 +
 2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/builtin/tag.c b/builtin/tag.c
index 4bed7c2..4242e27 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -213,10 +213,10 @@ static int do_sign(struct strbuf *buffer)
 }
 
 static const char tag_template[] =
-	"\n"
+	N_("\n"
 	"#\n"
 	"# Write a tag message\n"
-	"#\n";
+	"#\n");
 
 static void set_signingkey(const char *value)
 {
@@ -305,7 +305,7 @@ static void create_tag(const unsigned char *object, const char *tag,
 		if (!is_null_sha1(prev))
 			write_tag_body(fd, prev);
 		else
-			write_or_die(fd, tag_template, strlen(tag_template));
+			write_or_die(fd, _(tag_template), strlen(_(tag_template)));
 		close(fd);
 
 		if (launch_editor(path, buf, NULL)) {
diff --git a/t/t7004-tag.sh b/t/t7004-tag.sh
index 3e7baaf..99d1fbc 100755
--- a/t/t7004-tag.sh
+++ b/t/t7004-tag.sh
@@ -1121,6 +1121,7 @@ test_expect_success \
 '
 
 test_expect_success \
+	NO_GETTEXT_POISON \
 	'message in editor has initial comment: first line' '
 	# check the first line --- should be empty
 	echo >first.expect &&
-- 
1.7.2.3

[PATCH 52/72] gettextize: git-push "prevent you from losing" message

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Gettextize the "To prevent you from losing history" message. A test in
lib-httpd.sh and another in t5541-http-push.sh explicitly checked for
this message. Change them to skip under GETTEXT_POISON=YesPlease.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/push.c       |    4 ++--
 t/lib-httpd.sh       |    2 +-
 t/t5541-http-push.sh |    7 +++++--
 3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/builtin/push.c b/builtin/push.c
index 513bc57..8c8d8c7 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -129,9 +129,9 @@ static int push_with_options(struct transport *transport, int flags)
 		return 0;
 
 	if (nonfastforward && advice_push_nonfastforward) {
-		fprintf(stderr, "To prevent you from losing history, non-fast-forward updates were rejected\n"
+		fprintf(stderr, _("To prevent you from losing history, non-fast-forward updates were rejected\n"
 				"Merge the remote changes (e.g. 'git pull') before pushing again.  See the\n"
-				"'Note about fast-forwards' section of 'git push --help' for details.\n");
+				"'Note about fast-forwards' section of 'git push --help' for details.\n"));
 	}
 
 	return 1;
diff --git a/t/lib-httpd.sh b/t/lib-httpd.sh
index 3f24384..0f0b35a 100644
--- a/t/lib-httpd.sh
+++ b/t/lib-httpd.sh
@@ -157,7 +157,7 @@ test_http_push_nonff() {
 		grep "^ ! \[rejected\][ ]*$BRANCH -> $BRANCH (non-fast-forward)$" output
 	'
 
-	test_expect_success 'non-fast-forward push shows help message' '
+	test_expect_success NO_GETTEXT_POISON 'non-fast-forward push shows help message' '
 		grep "To prevent you from losing history, non-fast-forward updates were rejected" \
 			output
 	'
diff --git a/t/t5541-http-push.sh b/t/t5541-http-push.sh
index b0c2a2c..b341d8b 100755
--- a/t/t5541-http-push.sh
+++ b/t/t5541-http-push.sh
@@ -128,11 +128,14 @@ test_expect_success 'push fails for non-fast-forward refs unmatched by remote he
 
 	# push master too; this ensures there is at least one '"'push'"' command to
 	# the remote helper and triggers interaction with the helper.
-	test_must_fail git push -v origin +master master:retsam >output 2>&1 &&
+	test_must_fail git push -v origin +master master:retsam >output 2>&1'
 
+test_expect_success 'push fails for non-fast-forward refs unmatched by remote helper: remote output' '
 	grep "^ + [a-f0-9]*\.\.\.[a-f0-9]* *master -> master (forced update)$" output &&
-	grep "^ ! \[rejected\] *master -> retsam (non-fast-forward)$" output &&
+	grep "^ ! \[rejected\] *master -> retsam (non-fast-forward)$" output
+'
 
+test_expect_success NO_GETTEXT_POISON 'push fails for non-fast-forward refs unmatched by remote helper: our output' '
 	grep "To prevent you from losing history, non-fast-forward updates were rejected" \
 		output
 '
-- 
1.7.2.3

[PATCH 63/72] gettextize: git-describe basic messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/describe.c  |   36 ++++++++++++++++++------------------
 t/t6120-describe.sh |    2 +-
 2 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/builtin/describe.c b/builtin/describe.c
index 342129f..037691e 100644
--- a/builtin/describe.c
+++ b/builtin/describe.c
@@ -231,13 +231,13 @@ static void display_name(struct commit_name *n)
 	if (n->prio == 2 && !n->tag) {
 		n->tag = lookup_tag(n->sha1);
 		if (!n->tag || parse_tag(n->tag))
-			die("annotated tag %s not available", n->path);
+			die(_("annotated tag %s not available"), n->path);
 	}
 	if (n->tag && !n->name_checked) {
 		if (!n->tag->tag)
-			die("annotated tag %s has no embedded name", n->path);
+			die(_("annotated tag %s has no embedded name"), n->path);
 		if (strcmp(n->tag->tag, all ? n->path + 5 : n->path))
-			warning("tag '%s' is really '%s' here", n->tag->tag, n->path);
+			warning(_("tag '%s' is really '%s' here"), n->tag->tag, n->path);
 		n->name_checked = 1;
 	}
 
@@ -264,10 +264,10 @@ static void describe(const char *arg, int last_one)
 	unsigned int unannotated_cnt = 0;
 
 	if (get_sha1(arg, sha1))
-		die("Not a valid object name %s", arg);
+		die(_("Not a valid object name %s"), arg);
 	cmit = lookup_commit_reference(sha1);
 	if (!cmit)
-		die("%s is not a valid '%s' object", arg, commit_type);
+		die(_("%s is not a valid '%s' object"), arg, commit_type);
 
 	n = find_commit_name(cmit->object.sha1);
 	if (n && (tags || all || n->prio == 2)) {
@@ -284,9 +284,9 @@ static void describe(const char *arg, int last_one)
 	}
 
 	if (!max_candidates)
-		die("no tag exactly matches '%s'", sha1_to_hex(cmit->object.sha1));
+		die(_("no tag exactly matches '%s'"), sha1_to_hex(cmit->object.sha1));
 	if (debug)
-		fprintf(stderr, "searching to describe %s\n", arg);
+		fprintf(stderr, _("searching to describe %s\n"), arg);
 
 	if (!have_util) {
 		for_each_hash(&names, set_util);
@@ -326,7 +326,7 @@ static void describe(const char *arg, int last_one)
 		}
 		if (annotated_cnt && !list) {
 			if (debug)
-				fprintf(stderr, "finished search at %s\n",
+				fprintf(stderr, _("finished search at %s\n"),
 					sha1_to_hex(c->object.sha1));
 			break;
 		}
@@ -350,12 +350,12 @@ static void describe(const char *arg, int last_one)
 			return;
 		}
 		if (unannotated_cnt)
-			die("No annotated tags can describe '%s'.\n"
-			    "However, there were unannotated tags: try --tags.",
+			die(_("No annotated tags can describe '%s'.\n"
+			    "However, there were unannotated tags: try --tags."),
 			    sha1_to_hex(sha1));
 		else
-			die("No tags can describe '%s'.\n"
-			    "Try --always, or create some tags.",
+			die(_("No tags can describe '%s'.\n"
+			    "Try --always, or create some tags."),
 			    sha1_to_hex(sha1));
 	}
 
@@ -375,11 +375,11 @@ static void describe(const char *arg, int last_one)
 				prio_names[t->name->prio],
 				t->depth, t->name->path);
 		}
-		fprintf(stderr, "traversed %lu commits\n", seen_commits);
+		fprintf(stderr, _("traversed %lu commits\n"), seen_commits);
 		if (gave_up_on) {
 			fprintf(stderr,
-				"more than %i tags found; listed %i most recent\n"
-				"gave up search at %s\n",
+				_("more than %i tags found; listed %i most recent\n"
+				"gave up search at %s\n"),
 				max_candidates, max_candidates,
 				sha1_to_hex(gave_up_on->object.sha1));
 		}
@@ -429,7 +429,7 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
 	save_commit_buffer = 0;
 
 	if (longformat && abbrev == 0)
-		die("--long is incompatible with --abbrev=0");
+		die(_("--long is incompatible with --abbrev=0"));
 
 	if (contains) {
 		const char **args = xmalloc((7 + argc) * sizeof(char *));
@@ -455,14 +455,14 @@ int cmd_describe(int argc, const char **argv, const char *prefix)
 	init_hash(&names);
 	for_each_rawref(get_name, NULL);
 	if (!names.nr && !always)
-		die("No names found, cannot describe anything.");
+		die(_("No names found, cannot describe anything."));
 
 	if (argc == 0) {
 		if (dirty && !cmd_diff_index(ARRAY_SIZE(diff_index_args) - 1, diff_index_args, prefix))
 			dirty = NULL;
 		describe("HEAD", 1);
 	} else if (dirty) {
-		die("--dirty is incompatible with committishes");
+		die(_("--dirty is incompatible with committishes"));
 	} else {
 		while (argc-- > 0) {
 			describe(*argv++, argc == 0);
diff --git a/t/t6120-describe.sh b/t/t6120-describe.sh
index 876d1ab..210b9a2 100755
--- a/t/t6120-describe.sh
+++ b/t/t6120-describe.sh
@@ -123,7 +123,7 @@ cat - >err.expect <<EOF
 warning: tag 'A' is really 'Q' here
 EOF
 check_describe A-* HEAD
-test_expect_success 'warning was displayed for Q' '
+test_expect_success NO_GETTEXT_POISON 'warning was displayed for Q' '
 	test_cmp err.expect err.actual
 '
 test_expect_success 'rename tag Q back to A' '
-- 
1.7.2.3

[PATCH 49/72] gettextize: git-tag basic messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/tag.c |   60 ++++++++++++++++++++++++++++----------------------------
 1 files changed, 30 insertions(+), 30 deletions(-)
diff --git a/builtin/tag.c b/builtin/tag.c
index 246a2bc..4bed7c2 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -118,12 +118,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;
 		}
@@ -138,7 +138,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;
 }
 
@@ -150,7 +150,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;
 }
 
@@ -165,7 +165,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';
@@ -185,20 +185,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++)
@@ -221,7 +221,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)
@@ -261,9 +261,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;
 }
 
@@ -278,7 +278,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"
@@ -291,7 +291,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;
@@ -300,7 +300,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);
@@ -310,7 +310,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);
 		}
 	}
@@ -318,13 +318,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);
 	}
@@ -417,9 +417,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)
@@ -427,17 +427,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);
 			}
 		}
@@ -447,20 +447,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,
@@ -468,11 +468,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.3

[PATCH 46/72] gettextize: git-reset basic messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/reset.c |   26 +++++++++++++-------------
 1 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/builtin/reset.c b/builtin/reset.c
index 5de2bce..0823955 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -92,20 +92,20 @@ static int reset_index_file(const unsigned char *sha1, int reset_type, int quiet
 	if (reset_type == KEEP) {
 		unsigned char head_sha1[20];
 		if (get_sha1("HEAD", head_sha1))
-			return error("You do not have a valid HEAD.");
+			return error(_("You do not have a valid HEAD."));
 		if (!fill_tree_descriptor(desc, head_sha1))
-			return error("Failed to find tree of HEAD.");
+			return error(_("Failed to find tree of HEAD."));
 		nr++;
 		opts.fn = twoway_merge;
 	}
 
 	if (!fill_tree_descriptor(desc + nr - 1, sha1))
-		return error("Failed to find tree of %s.", sha1_to_hex(sha1));
+		return error(_("Failed to find tree of %s."), sha1_to_hex(sha1));
 	if (unpack_trees(nr, desc, &opts))
 		return -1;
 	if (write_cache(newfd, active_cache, active_nr) ||
 	    commit_locked_index(lock))
-		return error("Could not write new index file.");
+		return error(_("Could not write new index file."));
 
 	return 0;
 }
@@ -115,7 +115,7 @@ static void print_new_head_line(struct commit *commit)
 	const char *hex, *body;
 
 	hex = find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV);
-	printf("HEAD is now at %s", hex);
+	printf(_("HEAD is now at %s"), hex);
 	body = strstr(commit->buffer, "\n\n");
 	if (body) {
 		const char *eol;
@@ -139,7 +139,7 @@ static int update_index_refresh(int fd, struct lock_file *index_lock, int flags)
 	}
 
 	if (read_cache() < 0)
-		return error("Could not read index");
+		return error(_("Could not read index"));
 
 	result = refresh_index(&the_index, (flags), NULL, NULL,
 			       "Unstaged changes after reset:") ? 1 : 0;
@@ -167,7 +167,7 @@ static void update_index_from_diff(struct diff_queue_struct *q,
 			ce = make_cache_entry(one->mode, one->sha1, one->path,
 				0, 0);
 			if (!ce)
-				die("make_cache_entry failed for path '%s'",
+				die(_("make_cache_entry failed for path '%s'"),
 				    one->path);
 			add_cache_entry(ce, ADD_CACHE_OK_TO_ADD |
 				ADD_CACHE_OK_TO_REPLACE);
@@ -222,7 +222,7 @@ static void prepend_reflog_action(const char *action, char *buf, size_t size)
 	if (!rla)
 		rla = sep = "";
 	if (snprintf(buf, size, "%s%s%s", rla, sep, action) >= size)
-		warning("Reflog action message too long: %.*s...", 50, buf);
+		warning(_("Reflog action message too long: %.*s..."), 50, buf);
 }
 
 static void die_if_unmerged_cache(int reset_type)
@@ -300,16 +300,16 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
 	}
 
 	if (get_sha1(rev, sha1))
-		die("Failed to resolve '%s' as a valid ref.", rev);
+		die(_("Failed to resolve '%s' as a valid ref."), rev);
 
 	commit = lookup_commit_reference(sha1);
 	if (!commit)
-		die("Could not parse object '%s'.", rev);
+		die(_("Could not parse object '%s'."), rev);
 	hashcpy(sha1, commit->object.sha1);
 
 	if (patch_mode) {
 		if (reset_type != NONE)
-			die("--patch is incompatible with --{hard,mixed,soft}");
+			die(_("--patch is incompatible with --{hard,mixed,soft}"));
 		return interactive_reset(rev, argv + i, prefix);
 	}
 
@@ -318,7 +318,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
 	 * affecting the working tree nor HEAD. */
 	if (i < argc) {
 		if (reset_type == MIXED)
-			warning("--mixed with paths is deprecated; use 'git reset -- <paths>' instead.");
+			warning(_("--mixed with paths is deprecated; use 'git reset -- <paths>' instead."));
 		else if (reset_type != NONE)
 			die("Cannot do %s reset with paths.",
 					reset_type_names[reset_type]);
@@ -348,7 +348,7 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
 		if (reset_type == KEEP)
 			err = err || reset_index_file(sha1, MIXED, quiet);
 		if (err)
-			die("Could not reset index file to revision '%s'.", rev);
+			die(_("Could not reset index file to revision '%s'."), rev);
 	}
 
 	/* Any resets update HEAD to the head being switched to,
-- 
1.7.2.3

[PATCH 36/72] gettextize: git-grep "--open-files-in-pager" message

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Gettextize the "--open-files-in-pager only works on the worktree"
message. A test in t7811-grep-open.sh explicitly checked for this
message. Change it to skip under GETTEXT_POISON=YesPlease.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/grep.c       |    2 +-
 t/t7811-grep-open.sh |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin/grep.c b/builtin/grep.c
index d35b76c..dfc32fb 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -1061,7 +1061,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
 	}
 
 	if (show_in_pager && (cached || list.nr))
-		die("--open-files-in-pager only works on the worktree");
+		die(_("--open-files-in-pager only works on the worktree"));
 
 	if (show_in_pager && opt.pattern_list && !opt.pattern_list->next) {
 		const char *pager = path_list.items[0].string;
diff --git a/t/t7811-grep-open.sh b/t/t7811-grep-open.sh
index 568a6f2..3aa544c 100755
--- a/t/t7811-grep-open.sh
+++ b/t/t7811-grep-open.sh
@@ -61,7 +61,7 @@ test_expect_success SIMPLEPAGER 'git grep -O' '
 	test_cmp empty out
 '
 
-test_expect_success 'git grep -O --cached' '
+test_expect_success NO_GETTEXT_POISON 'git grep -O --cached' '
 	test_must_fail git grep --cached -O GREP_PATTERN >out 2>msg &&
 	grep open-files-in-pager msg
 '
-- 
1.7.2.3

[PATCH 35/72] gettextize: git-grep basic messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/grep.c |   32 ++++++++++++++++----------------
 1 files changed, 16 insertions(+), 16 deletions(-)
diff --git a/builtin/grep.c b/builtin/grep.c
index fdf7131..d35b76c 100644
--- a/builtin/grep.c
+++ b/builtin/grep.c
@@ -245,7 +245,7 @@ static void start_threads(struct grep_opt *opt)
 		err = pthread_create(&threads[i], NULL, run, o);
 
 		if (err)
-			die("grep: failed to create thread: %s",
+			die(_("grep: failed to create thread: %s"),
 			    strerror(err));
 	}
 }
@@ -450,7 +450,7 @@ static void *load_sha1(const unsigned char *sha1, unsigned long *size,
 	void *data = lock_and_read_sha1_file(sha1, &type, size);
 
 	if (!data)
-		error("'%s': unable to read %s", name, sha1_to_hex(sha1));
+		error(_("'%s': unable to read %s"), name, sha1_to_hex(sha1));
 
 	return data;
 }
@@ -501,7 +501,7 @@ static void *load_file(const char *filename, size_t *sz)
 	if (lstat(filename, &st) < 0) {
 	err_ret:
 		if (errno != ENOENT)
-			error("'%s': %s", filename, strerror(errno));
+			error(_("'%s': %s"), filename, strerror(errno));
 		return 0;
 	}
 	if (!S_ISREG(st.st_mode))
@@ -512,7 +512,7 @@ static void *load_file(const char *filename, size_t *sz)
 		goto err_ret;
 	data = xmalloc(*sz + 1);
 	if (st.st_size != read_in_full(i, data, *sz)) {
-		error("'%s': short read %s", filename, strerror(errno));
+		error(_("'%s': short read %s"), filename, strerror(errno));
 		close(i);
 		free(data);
 		return 0;
@@ -574,7 +574,7 @@ static void run_pager(struct grep_opt *opt, const char *prefix)
 	argv[path_list->nr] = NULL;
 
 	if (prefix && chdir(prefix))
-		die("Failed to chdir: %s", prefix);
+		die(_("Failed to chdir: %s"), prefix);
 	status = run_command_v_opt(argv, RUN_USING_SHELL);
 	if (status)
 		exit(status);
@@ -664,7 +664,7 @@ static int grep_tree(struct grep_opt *opt, const char **paths,
 
 			data = lock_and_read_sha1_file(entry.sha1, &type, &size);
 			if (!data)
-				die("unable to read tree (%s)",
+				die(_("unable to read tree (%s)"),
 				    sha1_to_hex(entry.sha1));
 			init_tree_desc(&sub, data, size);
 			hit |= grep_tree(opt, paths, &sub, tree_name, down);
@@ -690,13 +690,13 @@ static int grep_object(struct grep_opt *opt, const char **paths,
 		data = read_object_with_reference(obj->sha1, tree_type,
 						  &size, NULL);
 		if (!data)
-			die("unable to read tree (%s)", sha1_to_hex(obj->sha1));
+			die(_("unable to read tree (%s)"), sha1_to_hex(obj->sha1));
 		init_tree_desc(&tree, data, size);
 		hit = grep_tree(opt, paths, &tree, name, "");
 		free(data);
 		return hit;
 	}
-	die("unable to grep from object of type %s", typename(obj->type));
+	die(_("unable to grep from object of type %s"), typename(obj->type));
 }
 
 static int grep_objects(struct grep_opt *opt, const char **paths,
@@ -748,7 +748,7 @@ static int context_callback(const struct option *opt, const char *arg,
 	}
 	value = strtol(arg, (char **)&endp, 10);
 	if (*endp) {
-		return error("switch `%c' expects a numerical value",
+		return error(_("switch `%c' expects a numerical value"),
 			     opt->short_name);
 	}
 	grep_opt->pre_context = grep_opt->post_context = value;
@@ -764,7 +764,7 @@ static int file_callback(const struct option *opt, const char *arg, int unset)
 
 	patterns = fopen(arg, "r");
 	if (!patterns)
-		die_errno("cannot open '%s'", arg);
+		die_errno(_("cannot open '%s'"), arg);
 	while (strbuf_getline(&sb, patterns, '\n') == 0) {
 		char *s;
 		size_t len;
@@ -1005,11 +1005,11 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
 	}
 
 	if (!opt.pattern_list)
-		die("no pattern given.");
+		die(_("no pattern given."));
 	if (!opt.fixed && opt.ignore_case)
 		opt.regflags |= REG_ICASE;
 	if ((opt.regflags != REG_NEWLINE) && opt.fixed)
-		die("cannot mix --fixed-strings and regexp");
+		die(_("cannot mix --fixed-strings and regexp"));
 
 #ifndef NO_PTHREADS
 	if (online_cpus() == 1 || !grep_threads_ok(&opt))
@@ -1034,7 +1034,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
 		if (!get_sha1(arg, sha1)) {
 			struct object *object = parse_object(sha1);
 			if (!object)
-				die("bad object %s", arg);
+				die(_("bad object %s"), arg);
 			add_object_array(object, arg, &list);
 			continue;
 		}
@@ -1086,9 +1086,9 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
 
 	if (!use_index) {
 		if (cached)
-			die("--cached cannot be used with --no-index.");
+			die(_("--cached cannot be used with --no-index."));
 		if (list.nr)
-			die("--no-index cannot be used with revs.");
+			die(_("--no-index cannot be used with revs."));
 		hit = grep_directory(&opt, paths);
 	} else if (!list.nr) {
 		if (!cached)
@@ -1097,7 +1097,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix)
 		hit = grep_cache(&opt, paths, cached);
 	} else {
 		if (cached)
-			die("both --cached and trees are given.");
+			die(_("both --cached and trees are given."));
 		hit = grep_objects(&opt, paths, &list);
 	}
 
-- 
1.7.2.3

[PATCH 62/72] gettextize: git-clean clean.requireForce messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Split up the "clean.requireForce set/defaults to true..." die()
message to make it easier to translate.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/clean.c |   11 ++++++++---
 1 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/builtin/clean.c b/builtin/clean.c
index 2d0054b..75697f7 100644
--- a/builtin/clean.c
+++ b/builtin/clean.c
@@ -77,9 +77,14 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
 	if (ignored && ignored_only)
 		die(_("-x and -X cannot be used together"));
 
-	if (!show_only && !force)
-		die("clean.requireForce %s to true and neither -n nor -f given; "
-		    "refusing to clean", config_set ? "set" : "defaults");
+	if (!show_only && !force) {
+		if (config_set)
+			die(_("clean.requireForce set to true and neither -n nor -f given; "
+				  "refusing to clean"));
+		else
+			die(_("clean.requireForce defaults to true and neither -n nor -f given; "
+				  "refusing to clean"));
+	}
 
 	if (force > 1)
 		rm_flags = 0;
-- 
1.7.2.3

[PATCH 64/72] gettextize: git-gc basic messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/gc.c |   10 +++++-----
 1 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/builtin/gc.c b/builtin/gc.c
index 1a80702..a2be62a 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -60,7 +60,7 @@ static int gc_config(const char *var, const char *value, void *cb)
 		if (value && strcmp(value, "now")) {
 			unsigned long now = approxidate("now");
 			if (approxidate(value) >= now)
-				return error("Invalid %s: '%s'", var, value);
+				return error(_("Invalid %s: '%s'"), var, value);
 		}
 		return git_config_string(&prune_expire, var, value);
 	}
@@ -75,7 +75,7 @@ static void append_option(const char **cmd, const char *opt, int max_length)
 		;
 
 	if (i + 2 >= max_length)
-		die("Too many options specified");
+		die(_("Too many options specified"));
 	cmd[i++] = opt;
 	cmd[i] = NULL;
 }
@@ -100,7 +100,7 @@ static int too_many_loose_objects(void)
 		return 0;
 
 	if (sizeof(path) <= snprintf(path, sizeof(path), "%s/17", objdir)) {
-		warning("insanely long object directory %.*s", 50, objdir);
+		warning(_("insanely long object directory %.*s"), 50, objdir);
 		return 0;
 	}
 	dir = opendir(path);
@@ -251,8 +251,8 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
 		return error(FAILED_RUN, argv_rerere[0]);
 
 	if (auto_gc && too_many_loose_objects())
-		warning("There are too many unreachable loose objects; "
-			"run 'git prune' to remove them.");
+		warning(_("There are too many unreachable loose objects; "
+			"run 'git prune' to remove them."));
 
 	return 0;
 }
-- 
1.7.2.3

[PATCH 65/72] gettextize: git-gc "Auto packing the repository" message

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Split up the "Auto packing the repository" message into quiet and
verbose variants to make translation easier.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/gc.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/builtin/gc.c b/builtin/gc.c
index a2be62a..ff5f73b 100644
--- a/builtin/gc.c
+++ b/builtin/gc.c
@@ -219,13 +219,13 @@ int cmd_gc(int argc, const char **argv, const char *prefix)
 		 */
 		if (!need_to_gc())
 			return 0;
-		fprintf(stderr,
-			"Auto packing the repository for optimum performance.%s\n",
-			quiet
-			? ""
-			: (" You may also\n"
-			   "run \"git gc\" manually. See "
-			   "\"git help gc\" for more information."));
+		if (quiet)
+			fprintf(stderr, _("Auto packing the repository for optimum performance.\n"));
+		else
+			fprintf(stderr,
+					_("Auto packing the repository for optimum performance. You may also\n"
+					"run \"git gc\" manually. See "
+					"\"git help gc\" for more information."));
 	} else
 		append_option(argv_repack,
 			      prune_expire && !strcmp(prune_expire, "now")
-- 
1.7.2.3

[PATCH 72/72] gettextize: git-shortlog basic messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/shortlog.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/builtin/shortlog.c b/builtin/shortlog.c
index 1a21e4b..f5efc67 100644
--- a/builtin/shortlog.c
+++ b/builtin/shortlog.c
@@ -158,7 +158,7 @@ void shortlog_add_commit(struct shortlog *log, struct commit *commit)
 		buffer = eol;
 	}
 	if (!author)
-		die("Missing author: %s",
+		die(_("Missing author: %s"),
 		    sha1_to_hex(commit->object.sha1));
 	if (log->user_format) {
 		struct pretty_print_context ctx = {0};
@@ -181,7 +181,7 @@ static void get_from_rev(struct rev_info *rev, struct shortlog *log)
 	struct commit *commit;
 
 	if (prepare_revision_walk(rev))
-		die("revision walk setup failed");
+		die(_("revision walk setup failed"));
 	while ((commit = get_revision(rev)) != NULL)
 		shortlog_add_commit(log, commit);
 }
@@ -284,7 +284,7 @@ parse_done:
 	argc = parse_options_end(&ctx);
 
 	if (setup_revisions(argc, argv, &rev, NULL) != 1) {
-		error("unrecognized argument: %s", argv[1]);
+		error(_("unrecognized argument: %s"), argv[1]);
 		usage_with_options(shortlog_usage, options);
 	}
 
@@ -296,7 +296,7 @@ parse_done:
 		add_head_to_pending(&rev);
 	if (rev.pending.nr == 0) {
 		if (isatty(0))
-			fprintf(stderr, "(reading log message from standard input)\n");
+			fprintf(stderr, _("(reading log message from standard input)\n"));
 		read_from_stdin(&log);
 	}
 	else
-- 
1.7.2.3

[PATCH 69/72] gettextize: git-revert "Your local changes" message

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Translate the "Your local changes [...]" message without using the
`me' variable, instead split up the two messages so translators can
translate the whole messages as-is.

Reported-by: Jonathan Nieder <redacted>
Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/revert.c              |   18 +++++++++++++-----
 t/t3501-revert-cherry-pick.sh |    2 +-
 2 files changed, 14 insertions(+), 6 deletions(-)
diff --git a/builtin/revert.c b/builtin/revert.c
index 1ca08da..02c23c9 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -302,11 +302,19 @@ static NORETURN void die_dirty_index(const char *me)
 	if (read_cache_unmerged()) {
 		die_resolve_conflict(me);
 	} else {
-		if (advice_commit_before_merge)
-			die("Your local changes would be overwritten by %s.\n"
-			    "Please, commit your changes or stash them to proceed.", me);
-		else
-			die("Your local changes would be overwritten by %s.\n", me);
+		if (advice_commit_before_merge) {
+			if (action == REVERT)
+				die(_("Your local changes would be overwritten by revert.\n"
+					  "Please, commit your changes or stash them to proceed."));
+			else
+				die(_("Your local changes would be overwritten by cherry-pick.\n"
+					  "Please, commit your changes or stash them to proceed."));
+		} else {
+			if (action == REVERT)
+				die(_("Your local changes would be overwritten by revert.\n"));
+			else
+				die(_("Your local changes would be overwritten by cherry-pick.\n"));
+		}
 	}
 }
 
diff --git a/t/t3501-revert-cherry-pick.sh b/t/t3501-revert-cherry-pick.sh
index 0439544..76d3252 100755
--- a/t/t3501-revert-cherry-pick.sh
+++ b/t/t3501-revert-cherry-pick.sh
@@ -91,7 +91,7 @@ test_expect_success 'cherry-pick on stat-dirty working tree' '
 	)
 '
 
-test_expect_success 'revert forbidden on dirty working tree' '
+test_expect_success NO_GETTEXT_POISON 'revert forbidden on dirty working tree' '
 
 	echo content >extra_file &&
 	git add extra_file &&
-- 
1.7.2.3

[PATCH 70/72] gettextize: git-revert literal "me" messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Translate messages that use the `me' variable. These are all error
messages referencing the command name, so the name shouldn't be
translated.

Reported-by: Jonathan Nieder <redacted>
Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/revert.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/builtin/revert.c b/builtin/revert.c
index 02c23c9..b0a5ffb 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -362,7 +362,8 @@ static int do_recursive_merge(struct commit *base, struct commit *next,
 	if (active_cache_changed &&
 	    (write_cache(index_fd, active_cache, active_nr) ||
 	     commit_locked_index(&index_lock)))
-		die("%s: Unable to write new index file", me);
+		/* TRANSLATORS: %s will be "revert" or "cherry-pick" */
+		die(_("%s: Unable to write new index file"), me);
 	rollback_lock_file(&index_lock);
 
 	if (!clean) {
@@ -469,7 +470,9 @@ static int do_pick_commit(void)
 		return fast_forward_to(commit->object.sha1, head);
 
 	if (parent && parse_commit(parent) < 0)
-		die("%s: cannot parse parent commit %s",
+		/* TRANSLATORS: The first %s will be "revert" or
+		   "cherry-pick", the second %s a SHA1 */
+		die(_("%s: cannot parse parent commit %s"),
 		    me, sha1_to_hex(parent->object.sha1));
 
 	if (get_message(commit->buffer, &msg) != 0)
-- 
1.7.2.3

[PATCH 67/72] gettextize: git-notes GIT_NOTES_REWRITE_MODE error message

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Use sprintf format for the error message that's displayed if
GIT_NOTES_REWRITE_MODE is invalid, and leave a note in a TRANSLATORS
comment indicating what the message means.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/notes.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/builtin/notes.c b/builtin/notes.c
index 4c6cf85..a0aa995 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -382,8 +382,10 @@ struct notes_rewrite_cfg *init_copy_notes_for_rewrite(const char *cmd)
 		c->mode_from_env = 1;
 		c->combine = parse_combine_notes_fn(rewrite_mode_env);
 		if (!c->combine)
-			error("Bad " GIT_NOTES_REWRITE_MODE_ENVIRONMENT
-			      " value: '%s'", rewrite_mode_env);
+			/* TRANSLATORS: The first %s is the name of the
+			   environment variable, the second %s is its value */
+			error(_("Bad %s value: '%s'"), GIT_NOTES_REWRITE_MODE_ENVIRONMENT,
+					rewrite_mode_env);
 	}
 	if (rewrite_refs_env) {
 		c->refs_from_env = 1;
-- 
1.7.2.3

[PATCH 68/72] gettextize: git-revert basic messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/revert.c |   46 +++++++++++++++++++++++-----------------------
 1 files changed, 23 insertions(+), 23 deletions(-)
diff --git a/builtin/revert.c b/builtin/revert.c
index dc1b702..1ca08da 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -96,7 +96,7 @@ static void parse_args(int argc, const char **argv)
 			OPT_END(),
 		};
 		if (parse_options_concat(options, ARRAY_SIZE(options), cp_extra))
-			die("program error");
+			die(_("program error"));
 	}
 
 	commit_argc = parse_options(argc, argv, NULL, options, usage_str,
@@ -168,7 +168,7 @@ static char *get_encoding(const char *message)
 	const char *p = message, *eol;
 
 	if (!p)
-		die ("Could not read commit message of %s",
+		die (_("Could not read commit message of %s"),
 				sha1_to_hex(commit->object.sha1));
 	while (*p && *p != '\n') {
 		for (eol = p + 1; *eol && *eol != '\n'; eol++)
@@ -202,7 +202,7 @@ static void set_author_ident_env(const char *message)
 {
 	const char *p = message;
 	if (!p)
-		die ("Could not read commit message of %s",
+		die (_("Could not read commit message of %s"),
 				sha1_to_hex(commit->object.sha1));
 	while (*p && *p != '\n') {
 		const char *eol;
@@ -216,7 +216,7 @@ static void set_author_ident_env(const char *message)
 			line = xmemdupz(p, eol - p);
 			email = strchr(line, '<');
 			if (!email)
-				die ("Could not extract author email from %s",
+				die (_("Could not extract author email from %s"),
 					sha1_to_hex(commit->object.sha1));
 			if (email == line)
 				pend = line;
@@ -228,7 +228,7 @@ static void set_author_ident_env(const char *message)
 			email++;
 			timestamp = strchr(email, '>');
 			if (!timestamp)
-				die ("Could not extract author time from %s",
+				die (_("Could not extract author time from %s"),
 					sha1_to_hex(commit->object.sha1));
 			*timestamp = '\0';
 			for (timestamp++; *timestamp && isspace(*timestamp);
@@ -244,7 +244,7 @@ static void set_author_ident_env(const char *message)
 		if (*p == '\n')
 			p++;
 	}
-	die ("No author information found in %s",
+	die (_("No author information found in %s"),
 			sha1_to_hex(commit->object.sha1));
 }
 
@@ -281,10 +281,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)
@@ -420,10 +420,10 @@ static int do_pick_commit(void)
 		 * to work on.
 		 */
 		if (write_cache_as_tree(head, 0, NULL))
-			die ("Your index file is unmerged.");
+			die (_("Your index file is unmerged."));
 	} else {
 		if (get_sha1("HEAD", head))
-			die ("You do not have a valid HEAD");
+			die (_("You do not have a valid HEAD"));
 		if (index_differs_from("HEAD", 0))
 			die_dirty_index(me);
 	}
@@ -431,7 +431,7 @@ static int do_pick_commit(void)
 
 	if (!commit->parents) {
 		if (action == REVERT)
-			die ("Cannot revert a root commit");
+			die (_("Cannot revert a root commit"));
 		parent = NULL;
 	}
 	else if (commit->parents->next) {
@@ -440,7 +440,7 @@ static int do_pick_commit(void)
 		struct commit_list *p;
 
 		if (!mainline)
-			die("Commit %s is a merge but no -m option was given.",
+			die(_("Commit %s is a merge but no -m option was given."),
 			    sha1_to_hex(commit->object.sha1));
 
 		for (cnt = 1, p = commit->parents;
@@ -448,11 +448,11 @@ static int do_pick_commit(void)
 		     cnt++)
 			p = p->next;
 		if (cnt != mainline || !p)
-			die("Commit %s does not have parent %d",
+			die(_("Commit %s does not have parent %d"),
 			    sha1_to_hex(commit->object.sha1), mainline);
 		parent = p->item;
 	} else if (0 < mainline)
-		die("Mainline was specified but commit %s is not a merge.",
+		die(_("Mainline was specified but commit %s is not a merge."),
 		    sha1_to_hex(commit->object.sha1));
 	else
 		parent = commit->parents->item;
@@ -465,7 +465,7 @@ static int do_pick_commit(void)
 		    me, sha1_to_hex(parent->object.sha1));
 
 	if (get_message(commit->buffer, &msg) != 0)
-		die("Cannot get commit message for %s",
+		die(_("Cannot get commit message for %s"),
 				sha1_to_hex(commit->object.sha1));
 
 	/*
@@ -556,10 +556,10 @@ static void prepare_revs(struct rev_info *revs)
 		usage(*revert_or_cherry_pick_usage());
 
 	if (prepare_revision_walk(revs))
-		die("revision walk setup failed");
+		die(_("revision walk setup failed"));
 
 	if (!revs->commits)
-		die("empty commit set passed");
+		die(_("empty commit set passed"));
 }
 
 static void read_and_refresh_cache(const char *me)
@@ -567,12 +567,12 @@ static void read_and_refresh_cache(const char *me)
 	static struct lock_file index_lock;
 	int index_fd = hold_locked_index(&index_lock, 0);
 	if (read_index_preload(&the_index, NULL) < 0)
-		die("git %s: failed to read the index", me);
+		die(_("git %s: failed to read the index"), me);
 	refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, NULL, NULL, NULL);
 	if (the_index.cache_changed) {
 		if (write_index(&the_index, index_fd) ||
 		    commit_locked_index(&index_lock))
-			die("git %s: failed to refresh the index", me);
+			die(_("git %s: failed to refresh the index"), me);
 	}
 	rollback_lock_file(&index_lock);
 }
@@ -588,13 +588,13 @@ static int revert_or_cherry_pick(int argc, const char **argv)
 
 	if (allow_ff) {
 		if (signoff)
-			die("cherry-pick --ff cannot be used with --signoff");
+			die(_("cherry-pick --ff cannot be used with --signoff"));
 		if (no_commit)
-			die("cherry-pick --ff cannot be used with --no-commit");
+			die(_("cherry-pick --ff cannot be used with --no-commit"));
 		if (no_replay)
-			die("cherry-pick --ff cannot be used with -x");
+			die(_("cherry-pick --ff cannot be used with -x"));
 		if (edit)
-			die("cherry-pick --ff cannot be used with --edit");
+			die(_("cherry-pick --ff cannot be used with --edit"));
 	}
 
 	read_and_refresh_cache(me);
-- 
1.7.2.3

[PATCH 58/72] gettextize: git-status "renamed: " message

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Gettextize the "renamed: %s -> %s" message which appears as part of
git-status(1) output. Two tests in t4001-diff-rename.sh explicitly
checked for this message. Change them to skip under
GETTEXT_POISON=YesPlease.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 t/t4001-diff-rename.sh |    4 ++--
 wt-status.c            |    2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/t/t4001-diff-rename.sh b/t/t4001-diff-rename.sh
index 71bac83..d42c077 100755
--- a/t/t4001-diff-rename.sh
+++ b/t/t4001-diff-rename.sh
@@ -64,7 +64,7 @@ test_expect_success \
     'validate the output.' \
     'compare_diff_patch current expected'
 
-test_expect_success 'favour same basenames over different ones' '
+test_expect_success NO_GETTEXT_POISON 'favour same basenames over different ones' '
 	cp path1 another-path &&
 	git add another-path &&
 	git commit -m 1 &&
@@ -73,7 +73,7 @@ test_expect_success 'favour same basenames over different ones' '
 	git mv another-path subdir/path1 &&
 	git status | grep "renamed: .*path1 -> subdir/path1"'
 
-test_expect_success  'favour same basenames even with minor differences' '
+test_expect_success NO_GETTEXT_POISON  'favour same basenames even with minor differences' '
 	git show HEAD:path1 | sed "s/15/16/" > subdir/path1 &&
 	git status | grep "renamed: .*path1 -> subdir/path1"'
 
diff --git a/wt-status.c b/wt-status.c
index ad6ef7a..ed6bedd 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -201,7 +201,7 @@ static void wt_status_print_change_data(struct wt_status *s,
 		color_fprintf(s->fp, c, _("modified:   %s"), one);
 		break;
 	case DIFF_STATUS_RENAMED:
-		color_fprintf(s->fp, c, "renamed:    %s -> %s", one, two);
+		color_fprintf(s->fp, c, _("renamed:    %s -> %s"), one, two);
 		break;
 	case DIFF_STATUS_TYPE_CHANGED:
 		color_fprintf(s->fp, c, _("typechange: %s"), one);
-- 
1.7.2.3

[PATCH 60/72] gettextize: git-bundle basic messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/bundle.c |    6 +++---
 1 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/builtin/bundle.c b/builtin/bundle.c
index 9b87fb9..81046a9 100644
--- a/builtin/bundle.c
+++ b/builtin/bundle.c
@@ -44,7 +44,7 @@ int cmd_bundle(int argc, const char **argv, const char *prefix)
 		close(bundle_fd);
 		if (verify_bundle(&header, 1))
 			return 1;
-		fprintf(stderr, "%s is okay\n", bundle_file);
+		fprintf(stderr, _("%s is okay\n"), bundle_file);
 		return 0;
 	}
 	if (!strcmp(cmd, "list-heads")) {
@@ -53,11 +53,11 @@ int cmd_bundle(int argc, const char **argv, const char *prefix)
 	}
 	if (!strcmp(cmd, "create")) {
 		if (!startup_info->have_repository)
-			die("Need a repository to create a bundle.");
+			die(_("Need a repository to create a bundle."));
 		return !!create_bundle(&header, bundle_file, argc, argv);
 	} else if (!strcmp(cmd, "unbundle")) {
 		if (!startup_info->have_repository)
-			die("Need a repository to unbundle.");
+			die(_("Need a repository to unbundle."));
 		return !!unbundle(&header, bundle_fd) ||
 			list_bundle_refs(&header, argc, argv);
 	} else
-- 
1.7.2.3

[PATCH 61/72] gettextize: git-clean basic messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/clean.c                  |   20 ++++++++++----------
 t/t7012-skip-worktree-writing.sh |    4 ++--
 t/t7300-clean.sh                 |    6 +++---
 3 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/builtin/clean.c b/builtin/clean.c
index 4a312ab..2d0054b 100644
--- a/builtin/clean.c
+++ b/builtin/clean.c
@@ -75,7 +75,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
 		dir.flags |= DIR_SHOW_IGNORED;
 
 	if (ignored && ignored_only)
-		die("-x and -X cannot be used together");
+		die(_("-x and -X cannot be used together"));
 
 	if (!show_only && !force)
 		die("clean.requireForce %s to true and neither -n nor -f given; "
@@ -87,7 +87,7 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
 	dir.flags |= DIR_SHOW_OTHER_DIRECTORIES;
 
 	if (read_cache() < 0)
-		die("index file corrupt");
+		die(_("index file corrupt"));
 
 	if (!ignored)
 		setup_standard_excludes(&dir);
@@ -146,20 +146,20 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
 			qname = quote_path_relative(directory.buf, directory.len, &buf, prefix);
 			if (show_only && (remove_directories ||
 			    (matches == MATCHED_EXACTLY))) {
-				printf("Would remove %s\n", qname);
+				printf(_("Would remove %s\n"), qname);
 			} else if (remove_directories ||
 				   (matches == MATCHED_EXACTLY)) {
 				if (!quiet)
-					printf("Removing %s\n", qname);
+					printf(_("Removing %s\n"), qname);
 				if (remove_dir_recursively(&directory,
 							   rm_flags) != 0) {
-					warning("failed to remove %s", qname);
+					warning(_("failed to remove %s"), qname);
 					errors++;
 				}
 			} else if (show_only) {
-				printf("Would not remove %s\n", qname);
+				printf(_("Would not remove %s\n"), qname);
 			} else {
-				printf("Not removing %s\n", qname);
+				printf(_("Not removing %s\n"), qname);
 			}
 			strbuf_reset(&directory);
 		} else {
@@ -167,13 +167,13 @@ int cmd_clean(int argc, const char **argv, const char *prefix)
 				continue;
 			qname = quote_path_relative(ent->name, -1, &buf, prefix);
 			if (show_only) {
-				printf("Would remove %s\n", qname);
+				printf(_("Would remove %s\n"), qname);
 				continue;
 			} else if (!quiet) {
-				printf("Removing %s\n", qname);
+				printf(_("Removing %s\n"), qname);
 			}
 			if (unlink(ent->name) != 0) {
-				warning("failed to remove %s", qname);
+				warning(_("failed to remove %s"), qname);
 				errors++;
 			}
 		}
diff --git a/t/t7012-skip-worktree-writing.sh b/t/t7012-skip-worktree-writing.sh
index 582d0b5..6fccd91 100755
--- a/t/t7012-skip-worktree-writing.sh
+++ b/t/t7012-skip-worktree-writing.sh
@@ -124,13 +124,13 @@ cat >expected <<EOF
 Would remove expected
 Would remove result
 EOF
-test_expect_success 'git-clean, absent case' '
+test_expect_success NO_GETTEXT_POISON 'git-clean, absent case' '
 	setup_absent &&
 	git clean -n > result &&
 	test_cmp expected result
 '
 
-test_expect_success 'git-clean, dirty case' '
+test_expect_success NO_GETTEXT_POISON 'git-clean, dirty case' '
 	setup_dirty &&
 	git clean -n > result &&
 	test_cmp expected result
diff --git a/t/t7300-clean.sh b/t/t7300-clean.sh
index 02f67b7..70d8168 100755
--- a/t/t7300-clean.sh
+++ b/t/t7300-clean.sh
@@ -110,7 +110,7 @@ test_expect_success 'git clean with prefix' '
 
 '
 
-test_expect_success 'git clean with relative prefix' '
+test_expect_success NO_GETTEXT_POISON 'git clean with relative prefix' '
 
 	mkdir -p build docs &&
 	touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
@@ -125,7 +125,7 @@ test_expect_success 'git clean with relative prefix' '
 	}
 '
 
-test_expect_success 'git clean with absolute path' '
+test_expect_success NO_GETTEXT_POISON 'git clean with absolute path' '
 
 	mkdir -p build docs &&
 	touch a.out src/part3.c docs/manual.txt obj.o build/lib.so &&
@@ -377,7 +377,7 @@ test_expect_success 'clean.requireForce and -f' '
 
 '
 
-test_expect_success 'core.excludesfile' '
+test_expect_success NO_GETTEXT_POISON 'core.excludesfile' '
 
 	echo excludes >excludes &&
 	echo included >included &&
-- 
1.7.2.3

[PATCH 57/72] gettextize: git-status "Initial commit" message

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Gettextize the "# Initial commit" message. A test in t7501-commit.sh
explicitly checked for this message. Change it to skip under
GETTEXT_POISON=YesPlease.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 t/t7501-commit.sh |    7 +++++--
 wt-status.c       |    2 +-
 2 files changed, 6 insertions(+), 3 deletions(-)
diff --git a/t/t7501-commit.sh b/t/t7501-commit.sh
index 8980738..9f6e852 100755
--- a/t/t7501-commit.sh
+++ b/t/t7501-commit.sh
@@ -14,8 +14,11 @@ test_tick
 test_expect_success \
 	"initial status" \
 	"echo 'bongo bongo' >file &&
-	 git add file && \
-	 git status | grep 'Initial commit'"
+	 git add file"
+
+test_expect_success NO_GETTEXT_POISON \
+	"Constructing initial commit" \
+	"git status | grep 'Initial commit'"
 
 test_expect_success \
 	"fail initial amend" \
diff --git a/wt-status.c b/wt-status.c
index c6295f9..ad6ef7a 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -651,7 +651,7 @@ void wt_status_print(struct wt_status *s)
 
 	if (s->is_initial) {
 		color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "#");
-		color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "# Initial commit");
+		color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), _("# Initial commit"));
 		color_fprintf_ln(s->fp, color(WT_STATUS_HEADER, s), "#");
 	}
 
-- 
1.7.2.3

[PATCH 71/72] gettextize: git-revert split up "could not revert/apply" message

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Split up the "could not %s %s... %s" message into "could not revert
%s... %s" and "could not apply %s... %s". This makes it easier for
translators to understand the message.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/revert.c                |    5 +++--
 t/t3507-cherry-pick-conflict.sh |    2 +-
 2 files changed, 4 insertions(+), 3 deletions(-)
diff --git a/builtin/revert.c b/builtin/revert.c
index b0a5ffb..98dfd4d 100644
--- a/builtin/revert.c
+++ b/builtin/revert.c
@@ -536,8 +536,9 @@ static int do_pick_commit(void)
 	}
 
 	if (res) {
-		error("could not %s %s... %s",
-		      action == REVERT ? "revert" : "apply",
+		error(action == REVERT
+		      ? _("could not revert %s... %s")
+		      : _("could not apply %s... %s"),
 		      find_unique_abbrev(commit->object.sha1, DEFAULT_ABBREV),
 		      msg.subject);
 		print_advice();
diff --git a/t/t3507-cherry-pick-conflict.sh b/t/t3507-cherry-pick-conflict.sh
index 607bf25..bf664ec 100755
--- a/t/t3507-cherry-pick-conflict.sh
+++ b/t/t3507-cherry-pick-conflict.sh
@@ -38,7 +38,7 @@ test_expect_success 'failed cherry-pick does not advance HEAD' '
 	test "$head" = "$newhead"
 '
 
-test_expect_success 'advice from failed cherry-pick' "
+test_expect_success NO_GETTEXT_POISON 'advice from failed cherry-pick' "
 	git checkout -f initial^0 &&
 	git read-tree -u --reset HEAD &&
 	git clean -d -f -f -q -x &&
-- 
1.7.2.3

[PATCH 66/72] gettextize: git-notes basic commands

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/notes.c |  106 +++++++++++++++++++++++++++---------------------------
 1 files changed, 53 insertions(+), 53 deletions(-)
diff --git a/builtin/notes.c b/builtin/notes.c
index 4d5556e..4c6cf85 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -146,13 +146,13 @@ static void write_commented_object(int fd, const unsigned char *object)
 	show.err = 0;
 	show.git_cmd = 1;
 	if (start_command(&show))
-		die("unable to start 'show' for object '%s'",
+		die(_("unable to start 'show' for object '%s'"),
 		    sha1_to_hex(object));
 
 	/* Open the output as FILE* so strbuf_getline() can be used. */
 	show_out = xfdopen(show.out, "r");
 	if (show_out == NULL)
-		die_errno("can't fdopen 'show' output fd");
+		die_errno(_("can't fdopen 'show' output fd"));
 
 	/* Prepend "# " to each output line and write result to 'fd' */
 	while (strbuf_getline(&buf, show_out, '\n') != EOF) {
@@ -162,10 +162,10 @@ static void write_commented_object(int fd, const unsigned char *object)
 	}
 	strbuf_release(&buf);
 	if (fclose(show_out))
-		die_errno("failed to close pipe to 'show' for object '%s'",
+		die_errno(_("failed to close pipe to 'show' for object '%s'"),
 			  sha1_to_hex(object));
 	if (finish_command(&show))
-		die("failed to finish 'show' for object '%s'",
+		die(_("failed to finish 'show' for object '%s'"),
 		    sha1_to_hex(object));
 }
 
@@ -182,7 +182,7 @@ static void create_note(const unsigned char *object, struct msg_arg *msg,
 		path = git_pathdup("NOTES_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 (msg->given)
 			write_or_die(fd, msg->buf.buf, msg->buf.len);
@@ -196,8 +196,8 @@ static void create_note(const unsigned char *object, struct msg_arg *msg,
 		strbuf_reset(&(msg->buf));
 
 		if (launch_editor(path, &(msg->buf), NULL)) {
-			die("Please supply the note contents using either -m" \
-			    " or -F option");
+			die(_("Please supply the note contents using either -m" \
+			    " or -F option"));
 		}
 		stripspace(&(msg->buf), 1);
 	}
@@ -217,14 +217,14 @@ static void create_note(const unsigned char *object, struct msg_arg *msg,
 	}
 
 	if (!msg->buf.len) {
-		fprintf(stderr, "Removing note for object %s\n",
+		fprintf(stderr, _("Removing note for object %s\n"),
 			sha1_to_hex(object));
 		hashclr(result);
 	} else {
 		if (write_sha1_file(msg->buf.buf, msg->buf.len, blob_type, result)) {
-			error("unable to write note object");
+			error(_("unable to write note object"));
 			if (path)
-				error("The note contents has been left in %s",
+				error(_("The note contents has been left in %s"),
 				      path);
 			exit(128);
 		}
@@ -258,9 +258,9 @@ static int parse_file_arg(const struct option *opt, const char *arg, int unset)
 		strbuf_addch(&(msg->buf), '\n');
 	if (!strcmp(arg, "-")) {
 		if (strbuf_read(&(msg->buf), 0, 1024) < 0)
-			die_errno("cannot read '%s'", arg);
+			die_errno(_("cannot read '%s'"), arg);
 	} else if (strbuf_read_file(&(msg->buf), arg, 1024) < 0)
-		die_errno("could not open or read '%s'", arg);
+		die_errno(_("could not open or read '%s'"), arg);
 	stripspace(&(msg->buf), 0);
 
 	msg->given = 1;
@@ -279,10 +279,10 @@ static int parse_reuse_arg(const struct option *opt, const char *arg, int unset)
 		strbuf_addch(&(msg->buf), '\n');
 
 	if (get_sha1(arg, object))
-		die("Failed to resolve '%s' as a valid ref.", arg);
+		die(_("Failed to resolve '%s' as a valid ref."), arg);
 	if (!(buf = read_sha1_file(object, &type, &len)) || !len) {
 		free(buf);
-		die("Failed to read object '%s'.", arg);;
+		die(_("Failed to read object '%s'."), arg);;
 	}
 	strbuf_add(&(msg->buf), buf, len);
 	free(buf);
@@ -306,7 +306,7 @@ void commit_notes(struct notes_tree *t, const char *msg)
 	if (!t)
 		t = &default_notes_tree;
 	if (!t->initialized || !t->ref || !*t->ref)
-		die("Cannot commit uninitialized/unreferenced notes tree");
+		die(_("Cannot commit uninitialized/unreferenced notes tree"));
 	if (!t->dirty)
 		return; /* don't have to commit an unchanged tree */
 
@@ -347,7 +347,7 @@ static int notes_rewrite_config(const char *k, const char *v, void *cb)
 			config_error_nonbool(k);
 		c->combine = parse_combine_notes_fn(v);
 		if (!c->combine) {
-			error("Bad notes.rewriteMode value: '%s'", v);
+			error(_("Bad notes.rewriteMode value: '%s'"), v);
 			return 1;
 		}
 		return 0;
@@ -357,8 +357,8 @@ static int notes_rewrite_config(const char *k, const char *v, void *cb)
 		if (!prefixcmp(v, "refs/notes/"))
 			string_list_add_refs_by_glob(c->refs, v);
 		else
-			warning("Refusing to rewrite notes in %s"
-				" (outside of refs/notes/)", v);
+			warning(_("Refusing to rewrite notes in %s"
+				" (outside of refs/notes/)"), v);
 		return 0;
 	}
 
@@ -446,13 +446,13 @@ int notes_copy_from_stdin(int force, const char *rewrite_cmd)
 
 		split = strbuf_split(&buf, ' ');
 		if (!split[0] || !split[1])
-			die("Malformed input line: '%s'.", buf.buf);
+			die(_("Malformed input line: '%s'."), buf.buf);
 		strbuf_rtrim(split[0]);
 		strbuf_rtrim(split[1]);
 		if (get_sha1(split[0]->buf, from_obj))
-			die("Failed to resolve '%s' as a valid ref.", split[0]->buf);
+			die(_("Failed to resolve '%s' as a valid ref."), split[0]->buf);
 		if (get_sha1(split[1]->buf, to_obj))
-			die("Failed to resolve '%s' as a valid ref.", split[1]->buf);
+			die(_("Failed to resolve '%s' as a valid ref."), split[1]->buf);
 
 		if (rewrite_cmd)
 			err = copy_note_for_rewrite(c, from_obj, to_obj);
@@ -461,7 +461,7 @@ int notes_copy_from_stdin(int force, const char *rewrite_cmd)
 					combine_notes_overwrite);
 
 		if (err) {
-			error("Failed to copy notes from '%s' to '%s'",
+			error(_("Failed to copy notes from '%s' to '%s'"),
 			      split[0]->buf, split[1]->buf);
 			ret = 1;
 		}
@@ -505,20 +505,20 @@ static int list(int argc, const char **argv, const char *prefix)
 				     git_notes_list_usage, 0);
 
 	if (1 < argc) {
-		error("too many parameters");
+		error(_("too many parameters"));
 		usage_with_options(git_notes_list_usage, options);
 	}
 
 	t = init_notes_check("list");
 	if (argc) {
 		if (get_sha1(argv[0], object))
-			die("Failed to resolve '%s' as a valid ref.", argv[0]);
+			die(_("Failed to resolve '%s' as a valid ref."), argv[0]);
 		note = get_note(t, object);
 		if (note) {
 			puts(sha1_to_hex(note));
 			retval = 0;
 		} else
-			retval = error("No note found for object %s.",
+			retval = error(_("No note found for object %s."),
 				       sha1_to_hex(object));
 	} else
 		retval = for_each_note(t, 0, list_each_note, NULL);
@@ -557,26 +557,26 @@ static int add(int argc, const char **argv, const char *prefix)
 			     0);
 
 	if (1 < argc) {
-		error("too many parameters");
+		error(_("too many parameters"));
 		usage_with_options(git_notes_add_usage, options);
 	}
 
 	object_ref = argc ? argv[0] : "HEAD";
 
 	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);
 
 	t = init_notes_check("add");
 	note = get_note(t, object);
 
 	if (note) {
 		if (!force) {
-			retval = error("Cannot add notes. Found existing notes "
+			retval = error(_("Cannot add notes. Found existing notes "
 				       "for object %s. Use '-f' to overwrite "
-				       "existing notes", sha1_to_hex(object));
+				       "existing notes"), sha1_to_hex(object));
 			goto out;
 		}
-		fprintf(stderr, "Overwriting existing notes for object %s\n",
+		fprintf(stderr, _("Overwriting existing notes for object %s\n"),
 			sha1_to_hex(object));
 	}
 
@@ -618,7 +618,7 @@ static int copy(int argc, const char **argv, const char *prefix)
 
 	if (from_stdin || rewrite_cmd) {
 		if (argc) {
-			error("too many parameters");
+			error(_("too many parameters"));
 			usage_with_options(git_notes_copy_usage, options);
 		} else {
 			return notes_copy_from_stdin(force, rewrite_cmd);
@@ -626,41 +626,41 @@ static int copy(int argc, const char **argv, const char *prefix)
 	}
 
 	if (argc < 2) {
-		error("too few parameters");
+		error(_("too few parameters"));
 		usage_with_options(git_notes_copy_usage, options);
 	}
 	if (2 < argc) {
-		error("too many parameters");
+		error(_("too many parameters"));
 		usage_with_options(git_notes_copy_usage, options);
 	}
 
 	if (get_sha1(argv[0], from_obj))
-		die("Failed to resolve '%s' as a valid ref.", argv[0]);
+		die(_("Failed to resolve '%s' as a valid ref."), argv[0]);
 
 	object_ref = 1 < argc ? argv[1] : "HEAD";
 
 	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);
 
 	t = init_notes_check("copy");
 	note = get_note(t, object);
 
 	if (note) {
 		if (!force) {
-			retval = error("Cannot copy notes. Found existing "
+			retval = error(_("Cannot copy notes. Found existing "
 				       "notes for object %s. Use '-f' to "
-				       "overwrite existing notes",
+				       "overwrite existing notes"),
 				       sha1_to_hex(object));
 			goto out;
 		}
-		fprintf(stderr, "Overwriting existing notes for object %s\n",
+		fprintf(stderr, _("Overwriting existing notes for object %s\n"),
 			sha1_to_hex(object));
 	}
 
 	from_note = get_note(t, from_obj);
 	if (!from_note) {
-		retval = error("Missing notes on source object %s. Cannot "
-			       "copy.", sha1_to_hex(from_obj));
+		retval = error(_("Missing notes on source object %s. Cannot "
+			       "copy."), sha1_to_hex(from_obj));
 		goto out;
 	}
 
@@ -703,19 +703,19 @@ static int append_edit(int argc, const char **argv, const char *prefix)
 			     PARSE_OPT_KEEP_ARGV0);
 
 	if (2 < argc) {
-		error("too many parameters");
+		error(_("too many parameters"));
 		usage_with_options(usage, options);
 	}
 
 	if (msg.given && edit)
-		fprintf(stderr, "The -m/-F/-c/-C options have been deprecated "
+		fprintf(stderr, _("The -m/-F/-c/-C options have been deprecated "
 			"for the 'edit' subcommand.\n"
-			"Please use 'git notes add -f -m/-F/-c/-C' instead.\n");
+			"Please use 'git notes add -f -m/-F/-c/-C' instead.\n"));
 
 	object_ref = 1 < argc ? argv[1] : "HEAD";
 
 	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);
 
 	t = init_notes_check(argv[0]);
 	note = get_note(t, object);
@@ -750,20 +750,20 @@ static int show(int argc, const char **argv, const char *prefix)
 			     0);
 
 	if (1 < argc) {
-		error("too many parameters");
+		error(_("too many parameters"));
 		usage_with_options(git_notes_show_usage, options);
 	}
 
 	object_ref = argc ? argv[0] : "HEAD";
 
 	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);
 
 	t = init_notes_check("show");
 	note = get_note(t, object);
 
 	if (!note)
-		retval = error("No note found for object %s.",
+		retval = error(_("No note found for object %s."),
 			       sha1_to_hex(object));
 	else {
 		const char *show_args[3] = {"show", sha1_to_hex(note), NULL};
@@ -961,22 +961,22 @@ static int remove_cmd(int argc, const char **argv, const char *prefix)
 			     git_notes_remove_usage, 0);
 
 	if (1 < argc) {
-		error("too many parameters");
+		error(_("too many parameters"));
 		usage_with_options(git_notes_remove_usage, options);
 	}
 
 	object_ref = argc ? argv[0] : "HEAD";
 
 	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);
 
 	t = init_notes_check("remove");
 
 	retval = remove_note(t, object);
 	if (retval)
-		fprintf(stderr, "Object %s has no note\n", sha1_to_hex(object));
+		fprintf(stderr, _("Object %s has no note\n"), sha1_to_hex(object));
 	else {
-		fprintf(stderr, "Removing note for object %s\n",
+		fprintf(stderr, _("Removing note for object %s\n"),
 			sha1_to_hex(object));
 
 		commit_notes(t, "Notes removed by 'git notes remove'");
@@ -999,7 +999,7 @@ static int prune(int argc, const char **argv, const char *prefix)
 			     0);
 
 	if (argc) {
-		error("too many parameters");
+		error(_("too many parameters"));
 		usage_with_options(git_notes_prune_usage, options);
 	}
 
@@ -1069,7 +1069,7 @@ int cmd_notes(int argc, const char **argv, const char *prefix)
 	else if (!strcmp(argv[0], "get-ref"))
 		result = get_ref(argc, argv, prefix);
 	else {
-		result = error("Unknown subcommand: %s", argv[0]);
+		result = error(_("Unknown subcommand: %s"), argv[0]);
 		usage_with_options(git_notes_usage, options);
 	}
 
-- 
1.7.2.3

[PATCH 53/72] gettextize: git-status basic messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Gettextize the most common git-status messages. Many tests checked for
these explicitly. Change them to skip under GETTEXT_POISON=YesPlease.

Some of the tests in t7508-status.sh needed to be split up when I
added NO_GETTEXT_POISON to them, since parts of them affected later
tests (some of which aren't being skipped) indirectly.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 t/t7060-wtstatus.sh         |    2 +-
 t/t7506-status-submodule.sh |   20 ++++----
 t/t7508-status.sh           |  115 ++++++++++++++++++++++++-------------------
 wt-status.c                 |   86 ++++++++++++++++----------------
 4 files changed, 119 insertions(+), 104 deletions(-)
diff --git a/t/t7060-wtstatus.sh b/t/t7060-wtstatus.sh
index fcac472..7205154 100755
--- a/t/t7060-wtstatus.sh
+++ b/t/t7060-wtstatus.sh
@@ -38,7 +38,7 @@ cat >expect <<EOF
 no changes added to commit (use "git add" and/or "git commit -a")
 EOF
 
-test_expect_success 'M/D conflict does not segfault' '
+test_expect_success NO_GETTEXT_POISON 'M/D conflict does not segfault' '
 	mkdir mdconflict &&
 	(
 		cd mdconflict &&
diff --git a/t/t7506-status-submodule.sh b/t/t7506-status-submodule.sh
index 3d4f85d..74e0f6f 100755
--- a/t/t7506-status-submodule.sh
+++ b/t/t7506-status-submodule.sh
@@ -30,7 +30,7 @@ test_expect_success 'commit --dry-run -a clean' '
 	grep "nothing to commit" output
 '
 
-test_expect_success 'status with modified file in submodule' '
+test_expect_success NO_GETTEXT_POISON 'status with modified file in submodule' '
 	(cd sub && git reset --hard) &&
 	echo "changed" >sub/foo &&
 	git status >output &&
@@ -46,7 +46,7 @@ test_expect_success 'status with modified file in submodule (porcelain)' '
 	EOF
 '
 
-test_expect_success 'status with added file in submodule' '
+test_expect_success NO_GETTEXT_POISON 'status with added file in submodule' '
 	(cd sub && git reset --hard && echo >foo && git add foo) &&
 	git status >output &&
 	grep "modified:   sub (modified content)" output
@@ -60,14 +60,14 @@ test_expect_success 'status with added file in submodule (porcelain)' '
 	EOF
 '
 
-test_expect_success 'status with untracked file in submodule' '
+test_expect_success NO_GETTEXT_POISON 'status with untracked file in submodule' '
 	(cd sub && git reset --hard) &&
 	echo "content" >sub/new-file &&
 	git status >output &&
 	grep "modified:   sub (untracked content)" output
 '
 
-test_expect_success 'status -uno with untracked file in submodule' '
+test_expect_success NO_GETTEXT_POISON 'status -uno with untracked file in submodule' '
 	git status -uno >output &&
 	grep "^nothing to commit" output
 '
@@ -79,7 +79,7 @@ test_expect_success 'status with untracked file in submodule (porcelain)' '
 	EOF
 '
 
-test_expect_success 'status with added and untracked file in submodule' '
+test_expect_success NO_GETTEXT_POISON 'status with added and untracked file in submodule' '
 	(cd sub && git reset --hard && echo >foo && git add foo) &&
 	echo "content" >sub/new-file &&
 	git status >output &&
@@ -95,7 +95,7 @@ test_expect_success 'status with added and untracked file in submodule (porcelai
 	EOF
 '
 
-test_expect_success 'status with modified file in modified submodule' '
+test_expect_success NO_GETTEXT_POISON 'status with modified file in modified submodule' '
 	(cd sub && git reset --hard) &&
 	rm sub/new-file &&
 	(cd sub && echo "next change" >foo && git commit -m "next change" foo) &&
@@ -113,7 +113,7 @@ test_expect_success 'status with modified file in modified submodule (porcelain)
 	EOF
 '
 
-test_expect_success 'status with added file in modified submodule' '
+test_expect_success NO_GETTEXT_POISON 'status with added file in modified submodule' '
 	(cd sub && git reset --hard && echo >foo && git add foo) &&
 	git status >output &&
 	grep "modified:   sub (new commits, modified content)" output
@@ -127,7 +127,7 @@ test_expect_success 'status with added file in modified submodule (porcelain)' '
 	EOF
 '
 
-test_expect_success 'status with untracked file in modified submodule' '
+test_expect_success NO_GETTEXT_POISON 'status with untracked file in modified submodule' '
 	(cd sub && git reset --hard) &&
 	echo "content" >sub/new-file &&
 	git status >output &&
@@ -141,7 +141,7 @@ test_expect_success 'status with untracked file in modified submodule (porcelain
 	EOF
 '
 
-test_expect_success 'status with added and untracked file in modified submodule' '
+test_expect_success NO_GETTEXT_POISON 'status with added and untracked file in modified submodule' '
 	(cd sub && git reset --hard && echo >foo && git add foo) &&
 	echo "content" >sub/new-file &&
 	git status >output &&
@@ -167,7 +167,7 @@ test_expect_success 'setup .git file for sub' '
 	 git commit -m "added .real to .gitignore" .gitignore
 '
 
-test_expect_success 'status with added file in modified submodule with .git file' '
+test_expect_success NO_GETTEXT_POISON 'status with added file in modified submodule with .git file' '
 	(cd sub && git reset --hard && echo >foo && git add foo) &&
 	git status >output &&
 	grep "modified:   sub (new commits, modified content)" output
diff --git a/t/t7508-status.sh b/t/t7508-status.sh
index f1dc5c3..d79737f 100755
--- a/t/t7508-status.sh
+++ b/t/t7508-status.sh
@@ -55,7 +55,7 @@ test_expect_success 'setup' '
 	git add dir2/added
 '
 
-test_expect_success 'status (1)' '
+test_expect_success NO_GETTEXT_POISON 'status (1)' '
 
 	grep "use \"git rm --cached <file>\.\.\.\" to unstage" output
 
@@ -85,7 +85,7 @@ cat >expect <<\EOF
 #	untracked
 EOF
 
-test_expect_success 'status (2)' '
+test_expect_success NO_GETTEXT_POISON 'status (2)' '
 
 	git status >output &&
 	test_cmp expect output
@@ -111,7 +111,7 @@ EOF
 
 git config advice.statusHints false
 
-test_expect_success 'status (advice.statusHints false)' '
+test_expect_success NO_GETTEXT_POISON 'status (advice.statusHints false)' '
 
 	git status >output &&
 	test_cmp expect output
@@ -157,6 +157,12 @@ test_expect_success 'status -s -b' '
 
 '
 
+test_expect_success 'setup dir3' '
+	mkdir dir3 &&
+	: >dir3/untracked1 &&
+	: >dir3/untracked2
+'
+
 cat >expect <<EOF
 # On branch master
 # Changes to be committed:
@@ -172,16 +178,14 @@ cat >expect <<EOF
 #
 # Untracked files not listed (use -u option to show untracked files)
 EOF
-test_expect_success 'status -uno' '
-	mkdir dir3 &&
-	: >dir3/untracked1 &&
-	: >dir3/untracked2 &&
+test_expect_success NO_GETTEXT_POISON 'status -uno' '
 	git status -uno >output &&
 	test_cmp expect output
 '
 
-test_expect_success 'status (status.showUntrackedFiles no)' '
+test_expect_success NO_GETTEXT_POISON 'status (status.showUntrackedFiles no)' '
 	git config status.showuntrackedfiles no
+	test_when_finished "git config --unset status.showuntrackedfiles" &&
 	git status >output &&
 	test_cmp expect output
 '
@@ -197,7 +201,7 @@ cat >expect <<EOF
 # Untracked files not listed
 EOF
 git config advice.statusHints false
-test_expect_success 'status -uno (advice.statusHints false)' '
+test_expect_success NO_GETTEXT_POISON 'status -uno (advice.statusHints false)' '
 	git status -uno >output &&
 	test_cmp expect output
 '
@@ -208,7 +212,6 @@ cat >expect << EOF
 A  dir2/added
 EOF
 test_expect_success 'status -s -uno' '
-	git config --unset status.showuntrackedfiles
 	git status -s -uno >output &&
 	test_cmp expect output
 '
@@ -243,13 +246,14 @@ cat >expect <<EOF
 #	output
 #	untracked
 EOF
-test_expect_success 'status -unormal' '
+test_expect_success NO_GETTEXT_POISON 'status -unormal' '
 	git status -unormal >output &&
 	test_cmp expect output
 '
 
-test_expect_success 'status (status.showUntrackedFiles normal)' '
+test_expect_success NO_GETTEXT_POISON 'status (status.showUntrackedFiles normal)' '
 	git config status.showuntrackedfiles normal
+	test_when_finished "git config --unset status.showuntrackedfiles" &&
 	git status >output &&
 	test_cmp expect output
 '
@@ -266,7 +270,6 @@ A  dir2/added
 ?? untracked
 EOF
 test_expect_success 'status -s -unormal' '
-	git config --unset status.showuntrackedfiles
 	git status -s -unormal >output &&
 	test_cmp expect output
 '
@@ -302,18 +305,21 @@ cat >expect <<EOF
 #	output
 #	untracked
 EOF
-test_expect_success 'status -uall' '
+test_expect_success NO_GETTEXT_POISON 'status -uall' '
 	git status -uall >output &&
 	test_cmp expect output
 '
-test_expect_success 'status (status.showUntrackedFiles all)' '
+test_expect_success NO_GETTEXT_POISON 'status (status.showUntrackedFiles all)' '
 	git config status.showuntrackedfiles all
+	test_when_finished "git config --unset status.showuntrackedfiles" &&
 	git status >output &&
-	rm -rf dir3 &&
-	git config --unset status.showuntrackedfiles &&
 	test_cmp expect output
 '
 
+test_expect_success 'teardown dir3' '
+	rm -rf dir3
+'
+
 cat >expect <<EOF
  M dir1/modified
 A  dir2/added
@@ -361,7 +367,7 @@ cat >expect <<\EOF
 #	../untracked
 EOF
 
-test_expect_success 'status with relative paths' '
+test_expect_success NO_GETTEXT_POISON 'status with relative paths' '
 
 	(cd dir1 && git status) >output &&
 	test_cmp expect output
@@ -434,18 +440,19 @@ cat >expect <<\EOF
 #	<BLUE>untracked<RESET>
 EOF
 
-test_expect_success 'status with color.ui' '
+test_expect_success NO_GETTEXT_POISON 'status with color.ui' '
 
 	git config color.ui always &&
+	test_when_finished "git config --unset color.ui" &&
 	git status | test_decode_color >output &&
 	test_cmp expect output
 
 '
 
-test_expect_success 'status with color.status' '
+test_expect_success NO_GETTEXT_POISON 'status with color.status' '
 
-	git config --unset color.ui &&
 	git config color.status always &&
+	test_when_finished "git config --unset color.status" &&
 	git status | test_decode_color >output &&
 	test_cmp expect output
 
@@ -464,7 +471,6 @@ EOF
 
 test_expect_success 'status -s with color.ui' '
 
-	git config --unset color.status &&
 	git config color.ui always &&
 	git status -s | test_decode_color >output &&
 	test_cmp expect output
@@ -564,9 +570,10 @@ cat >expect <<\EOF
 EOF
 
 
-test_expect_success 'status without relative paths' '
+test_expect_success NO_GETTEXT_POISON 'status without relative paths' '
 
-	git config status.relativePaths false
+	git config status.relativePaths false &&
+	test_when_finished "git config --unset status.relativePaths" &&
 	(cd dir1 && git status) >output &&
 	test_cmp expect output
 
@@ -585,6 +592,8 @@ EOF
 
 test_expect_success 'status -s without relative paths' '
 
+	git config status.relativePaths false &&
+	test_when_finished "git config --unset status.relativePaths" &&
 	(cd dir1 && git status -s) >output &&
 	test_cmp expect output
 
@@ -607,7 +616,10 @@ cat <<EOF >expect
 #	untracked
 EOF
 test_expect_success 'dry-run of partial commit excluding new file in index' '
-	git commit --dry-run dir1/modified >output &&
+	git commit --dry-run dir1/modified >output
+'
+
+test_expect_success NO_GETTEXT_POISON 'dry-run of partial commit excluding new file in index: output' '
 	test_cmp expect output
 '
 
@@ -655,13 +667,13 @@ cat >expect <<EOF
 #	output
 #	untracked
 EOF
-test_expect_success 'status submodule summary is disabled by default' '
+test_expect_success NO_GETTEXT_POISON 'status submodule summary is disabled by default' '
 	git status >output &&
 	test_cmp expect output
 '
 
 # we expect the same as the previous test
-test_expect_success 'status --untracked-files=all does not show submodule' '
+test_expect_success NO_GETTEXT_POISON 'status --untracked-files=all does not show submodule' '
 	git status --untracked-files=all >output &&
 	test_cmp expect output
 '
@@ -719,7 +731,7 @@ cat >expect <<EOF
 #	output
 #	untracked
 EOF
-test_expect_success 'status submodule summary' '
+test_expect_success NO_GETTEXT_POISON 'status submodule summary' '
 	git config status.submodulesummary 10 &&
 	git status >output &&
 	test_cmp expect output
@@ -760,8 +772,11 @@ cat >expect <<EOF
 #	untracked
 no changes added to commit (use "git add" and/or "git commit -a")
 EOF
-test_expect_success 'status submodule summary (clean submodule)' '
-	git commit -m "commit submodule" &&
+test_expect_success 'status submodule summary (clean submodule): commit' '
+	git commit -m "commit submodule"
+'
+
+test_expect_success NO_GETTEXT_POISON 'status submodule summary (clean submodule): output' '
 	git config status.submodulesummary 10 &&
 	test_must_fail git commit --dry-run >output &&
 	test_cmp expect output &&
@@ -812,7 +827,7 @@ cat >expect <<EOF
 #	output
 #	untracked
 EOF
-test_expect_success 'commit --dry-run submodule summary (--amend)' '
+test_expect_success NO_GETTEXT_POISON 'commit --dry-run submodule summary (--amend)' '
 	git config status.submodulesummary 10 &&
 	git commit --dry-run --amend >output &&
 	test_cmp expect output
@@ -867,13 +882,13 @@ cat > expect << EOF
 #	untracked
 EOF
 
-test_expect_success '--ignore-submodules=untracked suppresses submodules with untracked content' '
+test_expect_success NO_GETTEXT_POISON '--ignore-submodules=untracked suppresses submodules with untracked content' '
 	echo modified > sm/untracked &&
 	git status --ignore-submodules=untracked > output &&
 	test_cmp expect output
 '
 
-test_expect_success '.gitmodules ignore=untracked suppresses submodules with untracked content' '
+test_expect_success NO_GETTEXT_POISON '.gitmodules ignore=untracked suppresses submodules with untracked content' '
 	git config diff.ignoreSubmodules dirty &&
 	git status >output &&
 	test_cmp expect output &&
@@ -885,7 +900,7 @@ test_expect_success '.gitmodules ignore=untracked suppresses submodules with unt
 	git config --unset diff.ignoreSubmodules
 '
 
-test_expect_success '.git/config ignore=untracked suppresses submodules with untracked content' '
+test_expect_success NO_GETTEXT_POISON '.git/config ignore=untracked suppresses submodules with untracked content' '
 	git config --add -f .gitmodules submodule.subname.ignore none &&
 	git config --add -f .gitmodules submodule.subname.path sm &&
 	git config --add submodule.subname.ignore untracked &&
@@ -896,12 +911,12 @@ test_expect_success '.git/config ignore=untracked suppresses submodules with unt
 	git config --remove-section -f .gitmodules submodule.subname
 '
 
-test_expect_success '--ignore-submodules=dirty suppresses submodules with untracked content' '
+test_expect_success NO_GETTEXT_POISON '--ignore-submodules=dirty suppresses submodules with untracked content' '
 	git status --ignore-submodules=dirty > output &&
 	test_cmp expect output
 '
 
-test_expect_success '.gitmodules ignore=dirty suppresses submodules with untracked content' '
+test_expect_success NO_GETTEXT_POISON '.gitmodules ignore=dirty suppresses submodules with untracked content' '
 	git config diff.ignoreSubmodules dirty &&
 	git status >output &&
 	! test -s actual &&
@@ -913,7 +928,7 @@ test_expect_success '.gitmodules ignore=dirty suppresses submodules with untrack
 	git config --unset diff.ignoreSubmodules
 '
 
-test_expect_success '.git/config ignore=dirty suppresses submodules with untracked content' '
+test_expect_success NO_GETTEXT_POISON '.git/config ignore=dirty suppresses submodules with untracked content' '
 	git config --add -f .gitmodules submodule.subname.ignore none &&
 	git config --add -f .gitmodules submodule.subname.path sm &&
 	git config --add submodule.subname.ignore dirty &&
@@ -924,13 +939,13 @@ test_expect_success '.git/config ignore=dirty suppresses submodules with untrack
 	git config -f .gitmodules  --remove-section submodule.subname
 '
 
-test_expect_success '--ignore-submodules=dirty suppresses submodules with modified content' '
+test_expect_success NO_GETTEXT_POISON '--ignore-submodules=dirty suppresses submodules with modified content' '
 	echo modified > sm/foo &&
 	git status --ignore-submodules=dirty > output &&
 	test_cmp expect output
 '
 
-test_expect_success '.gitmodules ignore=dirty suppresses submodules with modified content' '
+test_expect_success NO_GETTEXT_POISON '.gitmodules ignore=dirty suppresses submodules with modified content' '
 	git config --add -f .gitmodules submodule.subname.ignore dirty &&
 	git config --add -f .gitmodules submodule.subname.path sm &&
 	git status > output &&
@@ -938,7 +953,7 @@ test_expect_success '.gitmodules ignore=dirty suppresses submodules with modifie
 	git config -f .gitmodules  --remove-section submodule.subname
 '
 
-test_expect_success '.git/config ignore=dirty suppresses submodules with modified content' '
+test_expect_success NO_GETTEXT_POISON '.git/config ignore=dirty suppresses submodules with modified content' '
 	git config --add -f .gitmodules submodule.subname.ignore none &&
 	git config --add -f .gitmodules submodule.subname.path sm &&
 	git config --add submodule.subname.ignore dirty &&
@@ -981,12 +996,12 @@ cat > expect << EOF
 #	untracked
 EOF
 
-test_expect_success "--ignore-submodules=untracked doesn't suppress submodules with modified content" '
+test_expect_success NO_GETTEXT_POISON "--ignore-submodules=untracked doesn't suppress submodules with modified content" '
 	git status --ignore-submodules=untracked > output &&
 	test_cmp expect output
 '
 
-test_expect_success ".gitmodules ignore=untracked doesn't suppress submodules with modified content" '
+test_expect_success NO_GETTEXT_POISON ".gitmodules ignore=untracked doesn't suppress submodules with modified content" '
 	git config --add -f .gitmodules submodule.subname.ignore untracked &&
 	git config --add -f .gitmodules submodule.subname.path sm &&
 	git status > output &&
@@ -994,7 +1009,7 @@ test_expect_success ".gitmodules ignore=untracked doesn't suppress submodules wi
 	git config -f .gitmodules  --remove-section submodule.subname
 '
 
-test_expect_success ".git/config ignore=untracked doesn't suppress submodules with modified content" '
+test_expect_success NO_GETTEXT_POISON ".git/config ignore=untracked doesn't suppress submodules with modified content" '
 	git config --add -f .gitmodules submodule.subname.ignore none &&
 	git config --add -f .gitmodules submodule.subname.path sm &&
 	git config --add submodule.subname.ignore untracked &&
@@ -1043,12 +1058,12 @@ cat > expect << EOF
 #	untracked
 EOF
 
-test_expect_success "--ignore-submodules=untracked doesn't suppress submodule summary" '
+test_expect_success NO_GETTEXT_POISON "--ignore-submodules=untracked doesn't suppress submodule summary" '
 	git status --ignore-submodules=untracked > output &&
 	test_cmp expect output
 '
 
-test_expect_success ".gitmodules ignore=untracked doesn't suppress submodule summary" '
+test_expect_success NO_GETTEXT_POISON ".gitmodules ignore=untracked doesn't suppress submodule summary" '
 	git config --add -f .gitmodules submodule.subname.ignore untracked &&
 	git config --add -f .gitmodules submodule.subname.path sm &&
 	git status > output &&
@@ -1056,7 +1071,7 @@ test_expect_success ".gitmodules ignore=untracked doesn't suppress submodule sum
 	git config -f .gitmodules  --remove-section submodule.subname
 '
 
-test_expect_success ".git/config ignore=untracked doesn't suppress submodule summary" '
+test_expect_success NO_GETTEXT_POISON ".git/config ignore=untracked doesn't suppress submodule summary" '
 	git config --add -f .gitmodules submodule.subname.ignore none &&
 	git config --add -f .gitmodules submodule.subname.path sm &&
 	git config --add submodule.subname.ignore untracked &&
@@ -1067,11 +1082,11 @@ test_expect_success ".git/config ignore=untracked doesn't suppress submodule sum
 	git config -f .gitmodules  --remove-section submodule.subname
 '
 
-test_expect_success "--ignore-submodules=dirty doesn't suppress submodule summary" '
+test_expect_success NO_GETTEXT_POISON "--ignore-submodules=dirty doesn't suppress submodule summary" '
 	git status --ignore-submodules=dirty > output &&
 	test_cmp expect output
 '
-test_expect_success ".gitmodules ignore=dirty doesn't suppress submodule summary" '
+test_expect_success NO_GETTEXT_POISON ".gitmodules ignore=dirty doesn't suppress submodule summary" '
 	git config --add -f .gitmodules submodule.subname.ignore dirty &&
 	git config --add -f .gitmodules submodule.subname.path sm &&
 	git status > output &&
@@ -1079,7 +1094,7 @@ test_expect_success ".gitmodules ignore=dirty doesn't suppress submodule summary
 	git config -f .gitmodules  --remove-section submodule.subname
 '
 
-test_expect_success ".git/config ignore=dirty doesn't suppress submodule summary" '
+test_expect_success NO_GETTEXT_POISON ".git/config ignore=dirty doesn't suppress submodule summary" '
 	git config --add -f .gitmodules submodule.subname.ignore none &&
 	git config --add -f .gitmodules submodule.subname.path sm &&
 	git config --add submodule.subname.ignore dirty &&
@@ -1111,7 +1126,7 @@ cat > expect << EOF
 no changes added to commit (use "git add" and/or "git commit -a")
 EOF
 
-test_expect_success "--ignore-submodules=all suppresses submodule summary" '
+test_expect_success NO_GETTEXT_POISON "--ignore-submodules=all suppresses submodule summary" '
 	git status --ignore-submodules=all > output &&
 	test_cmp expect output
 '
diff --git a/wt-status.c b/wt-status.c
index 123582b..f369eba 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -57,16 +57,16 @@ static void wt_status_print_unmerged_header(struct wt_status *s)
 {
 	const char *c = color(WT_STATUS_HEADER, s);
 
-	color_fprintf_ln(s->fp, c, "# Unmerged paths:");
+	color_fprintf_ln(s->fp, c, _("# Unmerged paths:"));
 	if (!advice_status_hints)
 		return;
 	if (s->in_merge)
 		;
 	else if (!s->is_initial)
-		color_fprintf_ln(s->fp, c, "#   (use \"git reset %s <file>...\" to unstage)", s->reference);
+		color_fprintf_ln(s->fp, c, _("#   (use \"git reset %s <file>...\" to unstage)"), s->reference);
 	else
-		color_fprintf_ln(s->fp, c, "#   (use \"git rm --cached <file>...\" to unstage)");
-	color_fprintf_ln(s->fp, c, "#   (use \"git add/rm <file>...\" as appropriate to mark resolution)");
+		color_fprintf_ln(s->fp, c, _("#   (use \"git rm --cached <file>...\" to unstage)"));
+	color_fprintf_ln(s->fp, c, _("#   (use \"git add/rm <file>...\" as appropriate to mark resolution)"));
 	color_fprintf_ln(s->fp, c, "#");
 }
 
@@ -80,9 +80,9 @@ static void wt_status_print_cached_header(struct wt_status *s)
 	if (s->in_merge)
 		; /* NEEDSWORK: use "git reset --unresolve"??? */
 	else if (!s->is_initial)
-		color_fprintf_ln(s->fp, c, "#   (use \"git reset %s <file>...\" to unstage)", s->reference);
+		color_fprintf_ln(s->fp, c, _("#   (use \"git reset %s <file>...\" to unstage)"), s->reference);
 	else
-		color_fprintf_ln(s->fp, c, "#   (use \"git rm --cached <file>...\" to unstage)");
+		color_fprintf_ln(s->fp, c, _("#   (use \"git rm --cached <file>...\" to unstage)"));
 	color_fprintf_ln(s->fp, c, "#");
 }
 
@@ -92,16 +92,16 @@ static void wt_status_print_dirty_header(struct wt_status *s,
 {
 	const char *c = color(WT_STATUS_HEADER, s);
 
-	color_fprintf_ln(s->fp, c, "# Changes not staged for commit:");
+	color_fprintf_ln(s->fp, c, _("# Changes not staged for commit:"));
 	if (!advice_status_hints)
 		return;
 	if (!has_deleted)
-		color_fprintf_ln(s->fp, c, "#   (use \"git add <file>...\" to update what will be committed)");
+		color_fprintf_ln(s->fp, c, _("#   (use \"git add <file>...\" to update what will be committed)"));
 	else
-		color_fprintf_ln(s->fp, c, "#   (use \"git add/rm <file>...\" to update what will be committed)");
-	color_fprintf_ln(s->fp, c, "#   (use \"git checkout -- <file>...\" to discard changes in working directory)");
+		color_fprintf_ln(s->fp, c, _("#   (use \"git add/rm <file>...\" to update what will be committed)"));
+	color_fprintf_ln(s->fp, c, _("#   (use \"git checkout -- <file>...\" to discard changes in working directory)"));
 	if (has_dirty_submodules)
-		color_fprintf_ln(s->fp, c, "#   (commit or discard the untracked or modified content in submodules)");
+		color_fprintf_ln(s->fp, c, _("#   (commit or discard the untracked or modified content in submodules)"));
 	color_fprintf_ln(s->fp, c, "#");
 }
 
@@ -110,10 +110,10 @@ static void wt_status_print_other_header(struct wt_status *s,
 					 const char *how)
 {
 	const char *c = color(WT_STATUS_HEADER, s);
-	color_fprintf_ln(s->fp, c, "# %s files:", what);
+	color_fprintf_ln(s->fp, c, _("# %s files:"), what);
 	if (!advice_status_hints)
 		return;
-	color_fprintf_ln(s->fp, c, "#   (use \"git %s <file>...\" to include in what will be committed)", how);
+	color_fprintf_ln(s->fp, c, _("#   (use \"git %s <file>...\" to include in what will be committed)"), how);
 	color_fprintf_ln(s->fp, c, "#");
 }
 
@@ -130,18 +130,18 @@ static void wt_status_print_unmerged_data(struct wt_status *s,
 	const char *c = color(WT_STATUS_UNMERGED, s);
 	struct wt_status_change_data *d = it->util;
 	struct strbuf onebuf = STRBUF_INIT;
-	const char *one, *how = "bug";
+	const char *one, *how = _("bug");
 
 	one = quote_path(it->string, -1, &onebuf, s->prefix);
 	color_fprintf(s->fp, color(WT_STATUS_HEADER, s), "#\t");
 	switch (d->stagemask) {
-	case 1: how = "both deleted:"; break;
-	case 2: how = "added by us:"; break;
-	case 3: how = "deleted by them:"; break;
-	case 4: how = "added by them:"; break;
-	case 5: how = "deleted by us:"; break;
-	case 6: how = "both added:"; break;
-	case 7: how = "both modified:"; break;
+	case 1: how = _("both deleted:"); break;
+	case 2: how = _("added by us:"); break;
+	case 3: how = _("deleted by them:"); break;
+	case 4: how = _("added by them:"); break;
+	case 5: how = _("deleted by us:"); break;
+	case 6: how = _("both added:"); break;
+	case 7: how = _("both modified:"); break;
 	}
 	color_fprintf(s->fp, c, "%-20s%s\n", how, one);
 	strbuf_release(&onebuf);
@@ -171,11 +171,11 @@ static void wt_status_print_change_data(struct wt_status *s,
 		if (d->new_submodule_commits || d->dirty_submodule) {
 			strbuf_addstr(&extra, " (");
 			if (d->new_submodule_commits)
-				strbuf_addf(&extra, "new commits, ");
+				strbuf_addf(&extra, _("new commits, "));
 			if (d->dirty_submodule & DIRTY_SUBMODULE_MODIFIED)
-				strbuf_addf(&extra, "modified content, ");
+				strbuf_addf(&extra, _("modified content, "));
 			if (d->dirty_submodule & DIRTY_SUBMODULE_UNTRACKED)
-				strbuf_addf(&extra, "untracked content, ");
+				strbuf_addf(&extra, _("untracked content, "));
 			strbuf_setlen(&extra, extra.len - 2);
 			strbuf_addch(&extra, ')');
 		}
@@ -189,31 +189,31 @@ static void wt_status_print_change_data(struct wt_status *s,
 	color_fprintf(s->fp, color(WT_STATUS_HEADER, s), "#\t");
 	switch (status) {
 	case DIFF_STATUS_ADDED:
-		color_fprintf(s->fp, c, "new file:   %s", one);
+		color_fprintf(s->fp, c, _("new file:   %s"), one);
 		break;
 	case DIFF_STATUS_COPIED:
-		color_fprintf(s->fp, c, "copied:     %s -> %s", one, two);
+		color_fprintf(s->fp, c, _("copied:     %s -> %s"), one, two);
 		break;
 	case DIFF_STATUS_DELETED:
-		color_fprintf(s->fp, c, "deleted:    %s", one);
+		color_fprintf(s->fp, c, _("deleted:    %s"), one);
 		break;
 	case DIFF_STATUS_MODIFIED:
-		color_fprintf(s->fp, c, "modified:   %s", one);
+		color_fprintf(s->fp, c, _("modified:   %s"), one);
 		break;
 	case DIFF_STATUS_RENAMED:
 		color_fprintf(s->fp, c, "renamed:    %s -> %s", one, two);
 		break;
 	case DIFF_STATUS_TYPE_CHANGED:
-		color_fprintf(s->fp, c, "typechange: %s", one);
+		color_fprintf(s->fp, c, _("typechange: %s"), one);
 		break;
 	case DIFF_STATUS_UNKNOWN:
-		color_fprintf(s->fp, c, "unknown:    %s", one);
+		color_fprintf(s->fp, c, _("unknown:    %s"), one);
 		break;
 	case DIFF_STATUS_UNMERGED:
-		color_fprintf(s->fp, c, "unmerged:   %s", one);
+		color_fprintf(s->fp, c, _("unmerged:   %s"), one);
 		break;
 	default:
-		die("bug: unhandled diff status %c", status);
+		die(_("bug: unhandled diff status %c"), status);
 	}
 	if (extra.len) {
 		color_fprintf(s->fp, color(WT_STATUS_HEADER, s), "%s", extra.buf);
@@ -633,14 +633,14 @@ void wt_status_print(struct wt_status *s)
 	const char *branch_status_color = color(WT_STATUS_HEADER, s);
 
 	if (s->branch) {
-		const char *on_what = "On branch ";
+		const char *on_what = _("On branch ");
 		const char *branch_name = s->branch;
 		if (!prefixcmp(branch_name, "refs/heads/"))
 			branch_name += 11;
 		else if (!strcmp(branch_name, "HEAD")) {
 			branch_name = "";
 			branch_status_color = color(WT_STATUS_NOBRANCH, s);
-			on_what = "Not currently on any branch.";
+			on_what = _("Not currently on any branch.");
 		}
 		color_fprintf(s->fp, color(WT_STATUS_HEADER, s), "# ");
 		color_fprintf(s->fp, branch_status_color, "%s", on_what);
@@ -665,29 +665,29 @@ void wt_status_print(struct wt_status *s)
 		wt_status_print_submodule_summary(s, 1);  /* unstaged */
 	}
 	if (s->show_untracked_files) {
-		wt_status_print_other(s, &s->untracked, "Untracked", "add");
+		wt_status_print_other(s, &s->untracked, _("Untracked"), "add");
 		if (s->show_ignored_files)
-			wt_status_print_other(s, &s->ignored, "Ignored", "add -f");
+			wt_status_print_other(s, &s->ignored, _("Ignored"), "add -f");
 	} else if (s->commitable)
-		fprintf(s->fp, "# Untracked files not listed%s\n",
+		fprintf(s->fp, _("# Untracked files not listed%s\n"),
 			advice_status_hints
-			? " (use -u option to show untracked files)" : "");
+			? _(" (use -u option to show untracked files)") : "");
 
 	if (s->verbose)
 		wt_status_print_verbose(s);
 	if (!s->commitable) {
 		if (s->amend)
-			fprintf(s->fp, "# No changes\n");
+			fprintf(s->fp, _("# No changes\n"));
 		else if (s->nowarn)
 			; /* nothing */
 		else if (s->workdir_dirty)
-			printf("no changes added to commit%s\n",
+			printf(_("no changes added to commit%s\n"),
 				advice_status_hints
-				? " (use \"git add\" and/or \"git commit -a\")" : "");
+				? _(" (use \"git add\" and/or \"git commit -a\")") : "");
 		else if (s->untracked.nr)
-			printf("nothing added to commit but untracked files present%s\n",
+			printf(_("nothing added to commit but untracked files present%s\n"),
 				advice_status_hints
-				? " (use \"git add\" to track)" : "");
+				? _(" (use \"git add\" to track)") : "");
 		else if (s->is_initial)
 			printf("nothing to commit%s\n", advice_status_hints
 				? " (create/copy files and use \"git add\" to track)" : "");
-- 
1.7.2.3

[PATCH 59/72] gettextize: git-archive basic messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/archive.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/builtin/archive.c b/builtin/archive.c
index 6a887f5..b14eaba 100644
--- a/builtin/archive.c
+++ b/builtin/archive.c
@@ -14,10 +14,10 @@ static void create_output_file(const char *output_file)
 {
 	int output_fd = open(output_file, O_CREAT | O_WRONLY | O_TRUNC, 0666);
 	if (output_fd < 0)
-		die_errno("could not create archive file '%s'", output_file);
+		die_errno(_("could not create archive file '%s'"), output_file);
 	if (output_fd != 1) {
 		if (dup2(output_fd, 1) < 0)
-			die_errno("could not redirect output");
+			die_errno(_("could not redirect output"));
 		else
 			close(output_fd);
 	}
@@ -33,7 +33,7 @@ static int run_remote_archiver(int argc, const char **argv,
 
 	_remote = remote_get(remote);
 	if (!_remote->url[0])
-		die("git archive: Remote with no URL");
+		die(_("git archive: Remote with no URL"));
 	transport = transport_get(_remote, _remote->url[0]);
 	transport_connect(transport, "git-upload-archive", exec, fd);
 
@@ -43,18 +43,18 @@ static int run_remote_archiver(int argc, const char **argv,
 
 	len = packet_read_line(fd[0], buf, sizeof(buf));
 	if (!len)
-		die("git archive: expected ACK/NAK, got EOF");
+		die(_("git archive: expected ACK/NAK, got EOF"));
 	if (buf[len-1] == '\n')
 		buf[--len] = 0;
 	if (strcmp(buf, "ACK")) {
 		if (len > 5 && !prefixcmp(buf, "NACK "))
-			die("git archive: NACK %s", buf + 5);
-		die("git archive: protocol error");
+			die(_("git archive: NACK %s"), buf + 5);
+		die(_("git archive: protocol error"));
 	}
 
 	len = packet_read_line(fd[0], buf, sizeof(buf));
 	if (len)
-		die("git archive: expected a flush");
+		die(_("git archive: expected a flush"));
 
 	/* Now, start reading from fd[0] and spit it out to stdout */
 	rv = recv_sideband("archive", fd[0], 1);
-- 
1.7.2.3

[PATCH 56/72] gettextize: git-status "Changes to be committed" message

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Gettextize the "# Changes to be committed:" messages. Several tests
explicitly checked for this message. Change them to skip under
GETTEXT_POISON=YesPlease.

Since these tests didn't check for the rest of the git-status(1)
output this change has been split up from the "git-status basic
messages" patch.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 t/t7502-commit.sh |   20 ++++++++++----------
 wt-status.c       |    2 +-
 2 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/t/t7502-commit.sh b/t/t7502-commit.sh
index 6586355..d7c4280 100755
--- a/t/t7502-commit.sh
+++ b/t/t7502-commit.sh
@@ -384,66 +384,66 @@ try_commit () {
 
 try_commit_status_combo () {
 
-	test_expect_success 'commit' '
+	test_expect_success NO_GETTEXT_POISON 'commit' '
 		clear_config commit.status &&
 		try_commit "" &&
 		grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
 	'
 
-	test_expect_success 'commit' '
+	test_expect_success NO_GETTEXT_POISON 'commit' '
 		clear_config commit.status &&
 		try_commit "" &&
 		grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
 	'
 
-	test_expect_success 'commit --status' '
+	test_expect_success NO_GETTEXT_POISON 'commit --status' '
 		clear_config commit.status &&
 		try_commit --status &&
 		grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
 	'
 
-	test_expect_success 'commit --no-status' '
+	test_expect_success NO_GETTEXT_POISON 'commit --no-status' '
 		clear_config commit.status &&
 		try_commit --no-status &&
 		! grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
 	'
 
-	test_expect_success 'commit with commit.status = yes' '
+	test_expect_success NO_GETTEXT_POISON 'commit with commit.status = yes' '
 		clear_config commit.status &&
 		git config commit.status yes &&
 		try_commit "" &&
 		grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
 	'
 
-	test_expect_success 'commit with commit.status = no' '
+	test_expect_success NO_GETTEXT_POISON 'commit with commit.status = no' '
 		clear_config commit.status &&
 		git config commit.status no &&
 		try_commit "" &&
 		! grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
 	'
 
-	test_expect_success 'commit --status with commit.status = yes' '
+	test_expect_success NO_GETTEXT_POISON 'commit --status with commit.status = yes' '
 		clear_config commit.status &&
 		git config commit.status yes &&
 		try_commit --status &&
 		grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
 	'
 
-	test_expect_success 'commit --no-status with commit.status = yes' '
+	test_expect_success NO_GETTEXT_POISON 'commit --no-status with commit.status = yes' '
 		clear_config commit.status &&
 		git config commit.status yes &&
 		try_commit --no-status &&
 		! grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
 	'
 
-	test_expect_success 'commit --status with commit.status = no' '
+	test_expect_success NO_GETTEXT_POISON 'commit --status with commit.status = no' '
 		clear_config commit.status &&
 		git config commit.status no &&
 		try_commit --status &&
 		grep "^# Changes to be committed:" .git/COMMIT_EDITMSG
 	'
 
-	test_expect_success 'commit --no-status with commit.status = no' '
+	test_expect_success NO_GETTEXT_POISON 'commit --no-status with commit.status = no' '
 		clear_config commit.status &&
 		git config commit.status no &&
 		try_commit --no-status &&
diff --git a/wt-status.c b/wt-status.c
index fc38ac2..c6295f9 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -74,7 +74,7 @@ static void wt_status_print_cached_header(struct wt_status *s)
 {
 	const char *c = color(WT_STATUS_HEADER, s);
 
-	color_fprintf_ln(s->fp, c, "# Changes to be committed:");
+	color_fprintf_ln(s->fp, c, _("# Changes to be committed:"));
 	if (!advice_status_hints)
 		return;
 	if (s->in_merge)
-- 
1.7.2.3

[PATCH 55/72] gettextize: git-status shortstatus messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Make the messages added in v1.7.2-rc0~54^2~1 translatable. Some of
these could use the to be implemented plural support in the gettext
library.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 wt-status.c |   12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/wt-status.c b/wt-status.c
index a975d07..fc38ac2 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -804,13 +804,13 @@ static void wt_shortstatus_print_tracking(struct wt_status *s)
 	if (!prefixcmp(branch_name, "refs/heads/"))
 		branch_name += 11;
 	else if (!strcmp(branch_name, "HEAD")) {
-		branch_name = "HEAD (no branch)";
+		branch_name = _("HEAD (no branch)");
 		branch_color_local = color(WT_STATUS_NOBRANCH, s);
 	}
 
 	branch = branch_get(s->branch + 11);
 	if (s->is_initial)
-		color_fprintf(s->fp, header_color, "Initial commit on ");
+		color_fprintf(s->fp, header_color, _("Initial commit on "));
 	if (!stat_tracking_info(branch, &num_ours, &num_theirs)) {
 		color_fprintf_ln(s->fp, branch_color_local,
 			"%s", branch_name);
@@ -825,15 +825,15 @@ static void wt_shortstatus_print_tracking(struct wt_status *s)
 
 	color_fprintf(s->fp, header_color, " [");
 	if (!num_ours) {
-		color_fprintf(s->fp, header_color, "behind ");
+		color_fprintf(s->fp, header_color, _("behind "));
 		color_fprintf(s->fp, branch_color_remote, "%d", num_theirs);
 	} else if (!num_theirs) {
-		color_fprintf(s->fp, header_color, "ahead ");
+		color_fprintf(s->fp, header_color, _("ahead "));
 		color_fprintf(s->fp, branch_color_local, "%d", num_ours);
 	} else {
-		color_fprintf(s->fp, header_color, "ahead ");
+		color_fprintf(s->fp, header_color, _("ahead "));
 		color_fprintf(s->fp, branch_color_local, "%d", num_ours);
-		color_fprintf(s->fp, header_color, ", behind ");
+		color_fprintf(s->fp, header_color, _(", behind "));
 		color_fprintf(s->fp, branch_color_remote, "%d", num_theirs);
 	}
 
-- 
1.7.2.3

[PATCH 54/72] gettextize: git-status "nothing to commit" messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Gettextize the "nothing to commit" messages. Many tests explicitly
checked for this message. Change them to skip under
GETTEXT_POISON=YesPlease.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 t/t7506-status-submodule.sh |    8 ++++----
 wt-status.c                 |   12 ++++++------
 2 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/t/t7506-status-submodule.sh b/t/t7506-status-submodule.sh
index 74e0f6f..2347451 100755
--- a/t/t7506-status-submodule.sh
+++ b/t/t7506-status-submodule.sh
@@ -20,12 +20,12 @@ test_expect_success 'setup' '
 	git commit -m "Add submodule sub"
 '
 
-test_expect_success 'status clean' '
+test_expect_success NO_GETTEXT_POISON 'status clean' '
 	git status >output &&
 	grep "nothing to commit" output
 '
 
-test_expect_success 'commit --dry-run -a clean' '
+test_expect_success NO_GETTEXT_POISON 'commit --dry-run -a clean' '
 	test_must_fail git commit --dry-run -a >output &&
 	grep "nothing to commit" output
 '
@@ -177,12 +177,12 @@ test_expect_success 'rm submodule contents' '
 	rm -rf sub/* sub/.git
 '
 
-test_expect_success 'status clean (empty submodule dir)' '
+test_expect_success NO_GETTEXT_POISON 'status clean (empty submodule dir)' '
 	git status >output &&
 	grep "nothing to commit" output
 '
 
-test_expect_success 'status -a clean (empty submodule dir)' '
+test_expect_success NO_GETTEXT_POISON 'status -a clean (empty submodule dir)' '
 	test_must_fail git commit --dry-run -a >output &&
 	grep "nothing to commit" output
 '
diff --git a/wt-status.c b/wt-status.c
index f369eba..a975d07 100644
--- a/wt-status.c
+++ b/wt-status.c
@@ -689,14 +689,14 @@ void wt_status_print(struct wt_status *s)
 				advice_status_hints
 				? _(" (use \"git add\" to track)") : "");
 		else if (s->is_initial)
-			printf("nothing to commit%s\n", advice_status_hints
-				? " (create/copy files and use \"git add\" to track)" : "");
+			printf(_("nothing to commit%s\n"), advice_status_hints
+				? _(" (create/copy files and use \"git add\" to track)") : "");
 		else if (!s->show_untracked_files)
-			printf("nothing to commit%s\n", advice_status_hints
-				? " (use -u to show untracked files)" : "");
+			printf(_("nothing to commit%s\n"), advice_status_hints
+				? _(" (use -u to show untracked files)") : "");
 		else
-			printf("nothing to commit%s\n", advice_status_hints
-				? " (working directory clean)" : "");
+			printf(_("nothing to commit%s\n"), advice_status_hints
+				? _(" (working directory clean)") : "");
 	}
 }
 
-- 
1.7.2.3

[PATCH 51/72] gettextize: git-push basic messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/push.c |   38 +++++++++++++++++++-------------------
 1 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/builtin/push.c b/builtin/push.c
index e655eb7..513bc57 100644
--- a/builtin/push.c
+++ b/builtin/push.c
@@ -40,7 +40,7 @@ static void set_refspecs(const char **refs, int nr)
 			char *tag;
 			int len;
 			if (nr <= ++i)
-				die("tag shorthand without <tag>");
+				die(_("tag shorthand without <tag>"));
 			len = strlen(refs[i]) + 11;
 			if (deleterefs) {
 				tag = xmalloc(len+1);
@@ -59,7 +59,7 @@ static void set_refspecs(const char **refs, int nr)
 			strcat(delref, ref);
 			ref = delref;
 		} else if (deleterefs)
-			die("--delete only accepts plain target ref names");
+			die(_("--delete only accepts plain target ref names"));
 		add_refspec(ref);
 	}
 }
@@ -69,13 +69,13 @@ static void setup_push_tracking(void)
 	struct strbuf refspec = STRBUF_INIT;
 	struct branch *branch = branch_get(NULL);
 	if (!branch)
-		die("You are not currently on a branch.");
+		die(_("You are not currently on a branch."));
 	if (!branch->merge_nr || !branch->merge)
-		die("The current branch %s is not tracking anything.",
+		die(_("The current branch %s is not tracking anything."),
 		    branch->name);
 	if (branch->merge_nr != 1)
-		die("The current branch %s is tracking multiple branches, "
-		    "refusing to push.", branch->name);
+		die(_("The current branch %s is tracking multiple branches, "
+		    "refusing to push."), branch->name);
 	strbuf_addf(&refspec, "%s:%s", branch->name, branch->merge[0]->src);
 	add_refspec(refspec.buf);
 }
@@ -97,8 +97,8 @@ static void setup_default_push_refspecs(void)
 		break;
 
 	case PUSH_DEFAULT_NOTHING:
-		die("You didn't specify any refspecs to push, and "
-		    "push.default is \"nothing\".");
+		die(_("You didn't specify any refspecs to push, and "
+		    "push.default is \"nothing\"."));
 		break;
 	}
 }
@@ -117,11 +117,11 @@ static int push_with_options(struct transport *transport, int flags)
 		transport_set_option(transport, TRANS_OPT_THIN, "yes");
 
 	if (verbosity > 0)
-		fprintf(stderr, "Pushing to %s\n", transport->url);
+		fprintf(stderr, _("Pushing to %s\n"), transport->url);
 	err = transport_push(transport, refspec_nr, refspec, flags,
 			     &nonfastforward);
 	if (err != 0)
-		error("failed to push some refs to '%s'", transport->url);
+		error(_("failed to push some refs to '%s'"), transport->url);
 
 	err |= transport_disconnect(transport);
 
@@ -146,8 +146,8 @@ static int do_push(const char *repo, int flags)
 
 	if (!remote) {
 		if (repo)
-			die("bad repository '%s'", repo);
-		die("No destination configured to push to.");
+			die(_("bad repository '%s'"), repo);
+		die(_("No destination configured to push to."));
 	}
 
 	if (remote->mirror)
@@ -155,19 +155,19 @@ static int do_push(const char *repo, int flags)
 
 	if ((flags & TRANSPORT_PUSH_ALL) && refspec) {
 		if (!strcmp(*refspec, "refs/tags/*"))
-			return error("--all and --tags are incompatible");
-		return error("--all can't be combined with refspecs");
+			return error(_("--all and --tags are incompatible"));
+		return error(_("--all can't be combined with refspecs"));
 	}
 
 	if ((flags & TRANSPORT_PUSH_MIRROR) && refspec) {
 		if (!strcmp(*refspec, "refs/tags/*"))
-			return error("--mirror and --tags are incompatible");
-		return error("--mirror can't be combined with refspecs");
+			return error(_("--mirror and --tags are incompatible"));
+		return error(_("--mirror can't be combined with refspecs"));
 	}
 
 	if ((flags & (TRANSPORT_PUSH_ALL|TRANSPORT_PUSH_MIRROR)) ==
 				(TRANSPORT_PUSH_ALL|TRANSPORT_PUSH_MIRROR)) {
-		return error("--all and --mirror are incompatible");
+		return error(_("--all and --mirror are incompatible"));
 	}
 
 	if (!refspec && !(flags & TRANSPORT_PUSH_ALL)) {
@@ -232,9 +232,9 @@ int cmd_push(int argc, const char **argv, const char *prefix)
 	argc = parse_options(argc, argv, prefix, options, push_usage, 0);
 
 	if (deleterefs && (tags || (flags & (TRANSPORT_PUSH_ALL | TRANSPORT_PUSH_MIRROR))))
-		die("--delete is incompatible with --all, --mirror and --tags");
+		die(_("--delete is incompatible with --all, --mirror and --tags"));
 	if (deleterefs && argc < 2)
-		die("--delete doesn't make sense without any refs");
+		die(_("--delete doesn't make sense without any refs"));
 
 	if (tags)
 		add_refspec("refs/tags/*");
-- 
1.7.2.3

[PATCH 40/72] gettextize: git-merge "Updating %s..%s" message

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Gettextize the "Updating %s..%s\n" message. A test in
t1200-tutorial.sh explicitly checked for this message. Split it into
two tests to skip the test_cmp test under GETTEXT_POISON=YesPlease.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/merge.c     |    2 +-
 t/t1200-tutorial.sh |    5 ++++-
 2 files changed, 5 insertions(+), 2 deletions(-)
diff --git a/builtin/merge.c b/builtin/merge.c
index 0be4dfa..4f6b34f 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -1124,7 +1124,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 		strcpy(hex, find_unique_abbrev(head, DEFAULT_ABBREV));
 
 		if (verbosity >= 0)
-			printf("Updating %s..%s\n",
+			printf(_("Updating %s..%s\n"),
 				hex,
 				find_unique_abbrev(remoteheads->item->object.sha1,
 				DEFAULT_ABBREV));
diff --git a/t/t1200-tutorial.sh b/t/t1200-tutorial.sh
index bfa2c21..fb02cac 100755
--- a/t/t1200-tutorial.sh
+++ b/t/t1200-tutorial.sh
@@ -163,7 +163,10 @@ test_expect_success 'git resolve' '
 	git checkout mybranch &&
 	git merge -m "Merge upstream changes." master |
 		sed -e "1s/[0-9a-f]\{7\}/VARIABLE/g" \
-		-e "s/^Fast[- ]forward /FASTFORWARD /" >resolve.output &&
+		-e "s/^Fast[- ]forward /FASTFORWARD /" >resolve.output
+'
+
+test_expect_success NO_GETTEXT_POISON 'git resolve output' '
 	test_cmp resolve.expect resolve.output
 '
 
-- 
1.7.2.3

[PATCH 44/72] gettextize: git-mv "bad" messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Gettextize messages made by assigning to the "bad" char* variable.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/mv.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/builtin/mv.c b/builtin/mv.c
index 18a2218..40f33ca 100644
--- a/builtin/mv.c
+++ b/builtin/mv.c
@@ -104,13 +104,13 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 
 		length = strlen(src);
 		if (lstat(src, &st) < 0)
-			bad = "bad source";
+			bad = _("bad source");
 		else if (!strncmp(src, dst, length) &&
 				(dst[length] == 0 || dst[length] == '/')) {
-			bad = "can not move directory into itself";
+			bad = _("can not move directory into itself");
 		} else if ((src_is_dir = S_ISDIR(st.st_mode))
 				&& lstat(dst, &st) == 0)
-			bad = "cannot move directory over file";
+			bad = _("cannot move directory over file");
 		else if (src_is_dir) {
 			const char *src_w_slash = add_slash(src);
 			int len_w_slash = length + 1;
@@ -132,7 +132,7 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 			free((char *)src_w_slash);
 
 			if (last - first < 1)
-				bad = "source directory is empty";
+				bad = _("source directory is empty");
 			else {
 				int j, dst_len;
 
@@ -163,9 +163,9 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 				argc += last - first;
 			}
 		} else if (cache_name_pos(src, length) < 0)
-			bad = "not under version control";
+			bad = _("not under version control");
 		else if (lstat(dst, &st) == 0) {
-			bad = "destination exists";
+			bad = _("destination exists");
 			if (force) {
 				/*
 				 * only files can overwrite each other:
@@ -175,10 +175,10 @@ int cmd_mv(int argc, const char **argv, const char *prefix)
 					warning(_("%s; will overwrite!"), bad);
 					bad = NULL;
 				} else
-					bad = "Cannot overwrite";
+					bad = _("Cannot overwrite");
 			}
 		} else if (string_list_has_string(&src_for_dst, dst))
-			bad = "multiple sources for the same target";
+			bad = _("multiple sources for the same target");
 		else
 			string_list_insert(&src_for_dst, dst);
 
-- 
1.7.2.3

[PATCH 48/72] gettextize: git-reset "Unstaged changes after reset" message

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Gettextize the ""Unstaged changes after reset:" message. A test in
t7102-reset.sh explicitly checked for this message. Change it to skip
under GETTEXT_POISON=YesPlease.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/reset.c  |    2 +-
 t/t7102-reset.sh |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/builtin/reset.c b/builtin/reset.c
index 1465174..1fe5b0f 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -142,7 +142,7 @@ static int update_index_refresh(int fd, struct lock_file *index_lock, int flags)
 		return error(_("Could not read index"));
 
 	result = refresh_index(&the_index, (flags), NULL, NULL,
-			       "Unstaged changes after reset:") ? 1 : 0;
+			       _("Unstaged changes after reset:")) ? 1 : 0;
 	if (write_cache(fd, active_cache, active_nr) ||
 			commit_locked_index(index_lock))
 		return error ("Could not refresh index");
diff --git a/t/t7102-reset.sh b/t/t7102-reset.sh
index b8cf260..1370949 100755
--- a/t/t7102-reset.sh
+++ b/t/t7102-reset.sh
@@ -423,7 +423,7 @@ Unstaged changes after reset:
 M	file2
 EOF
 
-test_expect_success '--mixed refreshes the index' '
+test_expect_success NO_GETTEXT_POISON '--mixed refreshes the index' '
 	echo 123 >> file2 &&
 	git reset --mixed HEAD > output &&
 	test_cmp expect output
-- 
1.7.2.3

[PATCH 47/72] gettextize: git-reset reset_type_names messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Make the messages in git-reset that use the reset_type_names static
array to be translatable by marking the array items with N_() and
using _() later.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/reset.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/builtin/reset.c b/builtin/reset.c
index 0823955..1465174 100644
--- a/builtin/reset.c
+++ b/builtin/reset.c
@@ -30,7 +30,7 @@ static const char * const git_reset_usage[] = {
 
 enum reset_type { MIXED, SOFT, HARD, MERGE, KEEP, NONE };
 static const char *reset_type_names[] = {
-	"mixed", "soft", "hard", "merge", "keep", NULL
+	N_("mixed"), N_("soft"), N_("hard"), N_("merge"), N_("keep"), NULL
 };
 
 static char *args_to_str(const char **argv)
@@ -228,8 +228,8 @@ static void prepend_reflog_action(const char *action, char *buf, size_t size)
 static void die_if_unmerged_cache(int reset_type)
 {
 	if (is_merge() || read_cache() < 0 || unmerged_cache())
-		die("Cannot do a %s reset in the middle of a merge.",
-		    reset_type_names[reset_type]);
+		die(_("Cannot do a %s reset in the middle of a merge."),
+		    _(reset_type_names[reset_type]));
 
 }
 
@@ -320,8 +320,8 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
 		if (reset_type == MIXED)
 			warning(_("--mixed with paths is deprecated; use 'git reset -- <paths>' instead."));
 		else if (reset_type != NONE)
-			die("Cannot do %s reset with paths.",
-					reset_type_names[reset_type]);
+			die(_("Cannot do %s reset with paths."),
+					_(reset_type_names[reset_type]));
 		return read_from_tree(prefix, argv + i, sha1,
 				quiet ? REFRESH_QUIET : REFRESH_IN_PORCELAIN);
 	}
@@ -332,8 +332,8 @@ int cmd_reset(int argc, const char **argv, const char *prefix)
 		setup_work_tree();
 
 	if (reset_type == MIXED && is_bare_repository())
-		die("%s reset is not allowed in a bare repository",
-		    reset_type_names[reset_type]);
+		die(_("%s reset is not allowed in a bare repository"),
+		    _(reset_type_names[reset_type]));
 
 	/* Soft reset does not touch the index file nor the working tree
 	 * at all, but requires them in a good order.  Other resets reset
-- 
1.7.2.3

[PATCH 39/72] gettextize: git-merge basic messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/merge.c            |  124 ++++++++++++++++++++++----------------------
 t/t7607-merge-overwrite.sh |   10 +++-
 t/t7611-merge-abort.sh     |   20 ++++++--
 3 files changed, 86 insertions(+), 68 deletions(-)
diff --git a/builtin/merge.c b/builtin/merge.c
index 8c58c3c..0be4dfa 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -80,7 +80,7 @@ static int option_parse_message(const struct option *opt,
 		strbuf_addf(buf, "%s%s", buf->len ? "\n\n" : "", arg);
 		have_message = 1;
 	} else
-		return error("switch `m' requires a value");
+		return error(_("switch `m' requires a value"));
 	return 0;
 }
 
@@ -117,13 +117,13 @@ static struct strategy *get_strategy(const char *name)
 		exclude_cmds(&main_cmds, &not_strategies);
 	}
 	if (!is_in_cmdlist(&main_cmds, name) && !is_in_cmdlist(&other_cmds, name)) {
-		fprintf(stderr, "Could not find merge strategy '%s'.\n", name);
-		fprintf(stderr, "Available strategies are:");
+		fprintf(stderr, _("Could not find merge strategy '%s'.\n"), name);
+		fprintf(stderr, _("Available strategies are:"));
 		for (i = 0; i < main_cmds.cnt; i++)
 			fprintf(stderr, " %s", main_cmds.names[i]->name);
 		fprintf(stderr, ".\n");
 		if (other_cmds.cnt) {
-			fprintf(stderr, "Available custom strategies are:");
+			fprintf(stderr, _("Available custom strategies are:"));
 			for (i = 0; i < other_cmds.cnt; i++)
 				fprintf(stderr, " %s", other_cmds.names[i]->name);
 			fprintf(stderr, ".\n");
@@ -224,17 +224,17 @@ static void save_state(void)
 	cp.git_cmd = 1;
 
 	if (start_command(&cp))
-		die("could not run stash.");
+		die(_("could not run stash."));
 	len = strbuf_read(&buffer, cp.out, 1024);
 	close(cp.out);
 
 	if (finish_command(&cp) || len < 0)
-		die("stash failed");
+		die(_("stash failed"));
 	else if (!len)
 		return;
 	strbuf_setlen(&buffer, buffer.len-1);
 	if (get_sha1(buffer.buf, stash))
-		die("not a valid object: %s", buffer.buf);
+		die(_("not a valid object: %s"), buffer.buf);
 }
 
 static void read_empty(unsigned const char *sha1, int verbose)
@@ -252,7 +252,7 @@ static void read_empty(unsigned const char *sha1, int verbose)
 	args[i] = NULL;
 
 	if (run_command_v_opt(args, RUN_GIT_CMD))
-		die("read-tree failed");
+		die(_("read-tree failed"));
 }
 
 static void reset_hard(unsigned const char *sha1, int verbose)
@@ -269,7 +269,7 @@ static void reset_hard(unsigned const char *sha1, int verbose)
 	args[i] = NULL;
 
 	if (run_command_v_opt(args, RUN_GIT_CMD))
-		die("read-tree failed");
+		die(_("read-tree failed"));
 }
 
 static void restore_state(void)
@@ -298,7 +298,7 @@ static void restore_state(void)
 static void finish_up_to_date(const char *msg)
 {
 	if (verbosity >= 0)
-		printf("%s%s\n", squash ? " (nothing to squash)" : "", msg);
+		printf("%s%s\n", squash ? _(" (nothing to squash)") : "", msg);
 	drop_save();
 }
 
@@ -311,10 +311,10 @@ static void squash_message(void)
 	int fd;
 	struct pretty_print_context ctx = {0};
 
-	printf("Squash commit -- not updating HEAD\n");
+	printf(_("Squash commit -- not updating HEAD\n"));
 	fd = open(git_path("SQUASH_MSG"), O_WRONLY | O_CREAT, 0666);
 	if (fd < 0)
-		die_errno("Could not write to '%s'", git_path("SQUASH_MSG"));
+		die_errno(_("Could not write to '%s'"), git_path("SQUASH_MSG"));
 
 	init_revisions(&rev, NULL);
 	rev.ignore_merges = 1;
@@ -329,7 +329,7 @@ static void squash_message(void)
 
 	setup_revisions(0, NULL, &rev, NULL);
 	if (prepare_revision_walk(&rev))
-		die("revision walk setup failed");
+		die(_("revision walk setup failed"));
 
 	ctx.abbrev = rev.abbrev;
 	ctx.date_mode = rev.date_mode;
@@ -342,9 +342,9 @@ static void squash_message(void)
 		pretty_print_commit(rev.commit_format, commit, &out, &ctx);
 	}
 	if (write(fd, out.buf, out.len) < 0)
-		die_errno("Writing SQUASH_MSG");
+		die_errno(_("Writing SQUASH_MSG"));
 	if (close(fd))
-		die_errno("Finishing SQUASH_MSG");
+		die_errno(_("Finishing SQUASH_MSG"));
 	strbuf_release(&out);
 }
 
@@ -364,7 +364,7 @@ static void finish(const unsigned char *new_head, const char *msg)
 		squash_message();
 	} else {
 		if (verbosity >= 0 && !merge_msg.len)
-			printf("No merge message -- not updating HEAD\n");
+			printf(_("No merge message -- not updating HEAD\n"));
 		else {
 			const char *argv_gc_auto[] = { "gc", "--auto", NULL };
 			update_ref(reflog_message.buf, "HEAD",
@@ -386,7 +386,7 @@ static void finish(const unsigned char *new_head, const char *msg)
 		if (diff_use_color_default > 0)
 			DIFF_OPT_SET(&opts, COLOR_DIFF);
 		if (diff_setup_done(&opts) < 0)
-			die("diff_setup_done failed");
+			die(_("diff_setup_done failed"));
 		diff_tree_sha1(head, new_head, "", &opts);
 		diffcore_std(&opts);
 		diff_flush(&opts);
@@ -415,7 +415,7 @@ static void merge_name(const char *remote, struct strbuf *msg)
 	memset(branch_head, 0, sizeof(branch_head));
 	remote_head = peel_to_type(remote, 0, NULL, OBJ_COMMIT);
 	if (!remote_head)
-		die("'%s' does not point to a commit", remote);
+		die(_("'%s' does not point to a commit"), remote);
 
 	if (dwim_ref(remote, strlen(remote), branch_head, &found_ref) > 0) {
 		if (!prefixcmp(found_ref, "refs/heads/")) {
@@ -480,7 +480,7 @@ static void merge_name(const char *remote, struct strbuf *msg)
 
 		fp = fopen(git_path("FETCH_HEAD"), "r");
 		if (!fp)
-			die_errno("could not open '%s' for reading",
+			die_errno(_("could not open '%s' for reading"),
 				  git_path("FETCH_HEAD"));
 		strbuf_getline(&line, fp, '\n');
 		fclose(fp);
@@ -510,7 +510,7 @@ static int git_merge_config(const char *k, const char *v, void *cb)
 		buf = xstrdup(v);
 		argc = split_cmdline(buf, &argv);
 		if (argc < 0)
-			die("Bad branch.%s.mergeoptions string: %s", branch,
+			die(_("Bad branch.%s.mergeoptions string: %s"), branch,
 			    split_cmdline_strerror(argc));
 		argv = xrealloc(argv, sizeof(*argv) * (argc + 2));
 		memmove(argv + 1, argv, sizeof(*argv) * (argc + 1));
@@ -532,7 +532,7 @@ static int git_merge_config(const char *k, const char *v, void *cb)
 		int is_bool;
 		shortlog_len = git_config_bool_or_int(k, v, &is_bool);
 		if (!is_bool && shortlog_len < 0)
-			return error("%s: negative length %s", k, v);
+			return error(_("%s: negative length %s"), k, v);
 		if (is_bool && shortlog_len)
 			shortlog_len = DEFAULT_MERGE_LOG_LEN;
 		return 0;
@@ -579,7 +579,7 @@ static int read_tree_trivial(unsigned char *common, unsigned char *head,
 static void write_tree_trivial(unsigned char *sha1)
 {
 	if (write_cache_as_tree(sha1, 0, NULL))
-		die("git write-tree failed to write a tree");
+		die(_("git write-tree failed to write a tree"));
 }
 
 int try_merge_command(const char *strategy, size_t xopts_nr,
@@ -621,7 +621,7 @@ int try_merge_command(const char *strategy, size_t xopts_nr,
 	free(args);
 	discard_cache();
 	if (read_cache() < 0)
-		die("failed to read the cache");
+		die(_("failed to read the cache"));
 	resolve_undo_clear();
 
 	return ret;
@@ -638,7 +638,7 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
 	if (active_cache_changed &&
 			(write_cache(index_fd, active_cache, active_nr) ||
 			 commit_locked_index(lock)))
-		return error("Unable to write index.");
+		return error(_("Unable to write index."));
 	rollback_lock_file(lock);
 
 	if (!strcmp(strategy, "recursive") || !strcmp(strategy, "subtree")) {
@@ -651,7 +651,7 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
 		struct commit_list *j;
 
 		if (remoteheads->next) {
-			error("Not handling anything other than two heads merge.");
+			error(_("Not handling anything other than two heads merge."));
 			return 2;
 		}
 
@@ -663,7 +663,7 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
 
 		for (x = 0; x < xopts_nr; x++)
 			if (parse_merge_opt(&o, xopts[x]))
-				die("Unknown option for merge-recursive: -X%s", xopts[x]);
+				die(_("Unknown option for merge-recursive: -X%s"), xopts[x]);
 
 		o.branch1 = head_arg;
 		o.branch2 = remoteheads->item->util;
@@ -677,7 +677,7 @@ static int try_merge_strategy(const char *strategy, struct commit_list *common,
 		if (active_cache_changed &&
 				(write_cache(index_fd, active_cache, active_nr) ||
 				 commit_locked_index(lock)))
-			die ("unable to write %s", get_index_file());
+			die (_("unable to write %s"), get_index_file());
 		rollback_lock_file(lock);
 		return clean ? 0 : 1;
 	} else {
@@ -749,7 +749,7 @@ int checkout_fast_forward(const unsigned char *head, const unsigned char *remote
 		return -1;
 	if (write_cache(fd, active_cache, active_nr) ||
 		commit_locked_index(lock_file))
-		die("unable to write new index file");
+		die(_("unable to write new index file"));
 	return 0;
 }
 
@@ -852,7 +852,7 @@ static int suggest_conflicts(int renormalizing)
 
 	fp = fopen(git_path("MERGE_MSG"), "a");
 	if (!fp)
-		die_errno("Could not open '%s' for writing",
+		die_errno(_("Could not open '%s' for writing"),
 			  git_path("MERGE_MSG"));
 	fprintf(fp, "\nConflicts:\n");
 	for (pos = 0; pos < active_nr; pos++) {
@@ -868,8 +868,8 @@ static int suggest_conflicts(int renormalizing)
 	}
 	fclose(fp);
 	rerere(allow_rerere_auto);
-	printf("Automatic merge failed; "
-			"fix conflicts and then commit the result.\n");
+	printf(_("Automatic merge failed; "
+			"fix conflicts and then commit the result.\n"));
 	return 1;
 }
 
@@ -883,7 +883,7 @@ static struct commit *is_old_style_invocation(int argc, const char **argv)
 			return NULL;
 		second_token = lookup_commit_reference_gently(second_sha1, 0);
 		if (!second_token)
-			die("'%s' is not a commit", argv[1]);
+			die(_("'%s' is not a commit"), argv[1]);
 		if (hashcmp(second_token->object.sha1, head))
 			return NULL;
 	}
@@ -951,7 +951,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 		const char *nargv[] = {"reset", "--merge", NULL};
 
 		if (!file_exists(git_path("MERGE_HEAD")))
-			die("There is no merge to abort (MERGE_HEAD missing).");
+			die(_("There is no merge to abort (MERGE_HEAD missing)."));
 
 		/* Invoke 'git reset --merge' */
 		return cmd_reset(nargc, nargv, prefix);
@@ -966,10 +966,10 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 		 * add/rm <file>', just 'git commit'.
 		 */
 		if (advice_resolve_conflict)
-			die("You have not concluded your merge (MERGE_HEAD exists).\n"
-			    "Please, commit your changes before you can merge.");
+			die(_("You have not concluded your merge (MERGE_HEAD exists).\n"
+				  "Please, commit your changes before you can merge."));
 		else
-			die("You have not concluded your merge (MERGE_HEAD exists).");
+			die(_("You have not concluded your merge (MERGE_HEAD exists)."));
 	}
 	resolve_undo_clear();
 
@@ -978,12 +978,12 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 
 	if (squash) {
 		if (!allow_fast_forward)
-			die("You cannot combine --squash with --no-ff.");
+			die(_("You cannot combine --squash with --no-ff."));
 		option_commit = 0;
 	}
 
 	if (!allow_fast_forward && fast_forward_only)
-		die("You cannot combine --no-ff with --ff-only.");
+		die(_("You cannot combine --no-ff with --ff-only."));
 
 	if (!argc)
 		usage_with_options(builtin_merge_usage,
@@ -1011,16 +1011,16 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 		 * We do the same for "git pull".
 		 */
 		if (argc != 1)
-			die("Can merge only exactly one commit into "
-				"empty head");
+			die(_("Can merge only exactly one commit into "
+				"empty head"));
 		if (squash)
-			die("Squash commit into empty head not supported yet");
+			die(_("Squash commit into empty head not supported yet"));
 		if (!allow_fast_forward)
-			die("Non-fast-forward commit does not make sense into "
-			    "an empty head");
+			die(_("Non-fast-forward commit does not make sense into "
+			    "an empty head"));
 		remote_head = peel_to_type(argv[0], 0, NULL, OBJ_COMMIT);
 		if (!remote_head)
-			die("%s - not something we can merge", argv[0]);
+			die(_("%s - not something we can merge"), argv[0]);
 		update_ref("initial pull", "HEAD", remote_head->sha1, NULL, 0,
 				DIE_ON_ERR);
 		read_empty(remote_head->sha1, 0);
@@ -1066,7 +1066,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 
 		o = peel_to_type(argv[i], 0, NULL, OBJ_COMMIT);
 		if (!o)
-			die("%s - not something we can merge", argv[i]);
+			die(_("%s - not something we can merge"), argv[i]);
 		commit = lookup_commit(o->sha1);
 		commit->util = (void *)argv[i];
 		remotes = &commit_list_insert(commit, remotes)->next;
@@ -1158,11 +1158,11 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 		if (allow_trivial && !fast_forward_only) {
 			/* See if it is really trivial. */
 			git_committer_info(IDENT_ERROR_ON_NO_NAME);
-			printf("Trying really trivial in-index merge...\n");
+			printf(_("Trying really trivial in-index merge...\n"));
 			if (!read_tree_trivial(common->item->object.sha1,
 					head, remoteheads->item->object.sha1))
 				return merge_trivial();
-			printf("Nope.\n");
+			printf(_("Nope.\n"));
 		}
 	} else {
 		/*
@@ -1195,7 +1195,7 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 	}
 
 	if (fast_forward_only)
-		die("Not possible to fast-forward, aborting.");
+		die(_("Not possible to fast-forward, aborting."));
 
 	/* We are going to make a new commit. */
 	git_committer_info(IDENT_ERROR_ON_NO_NAME);
@@ -1221,11 +1221,11 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 	for (i = 0; i < use_strategies_nr; i++) {
 		int ret;
 		if (i) {
-			printf("Rewinding the tree to pristine...\n");
+			printf(_("Rewinding the tree to pristine...\n"));
 			restore_state();
 		}
 		if (use_strategies_nr != 1)
-			printf("Trying merge strategy %s...\n",
+			printf(_("Trying merge strategy %s...\n"),
 				use_strategies[i]->name);
 		/*
 		 * Remember which strategy left the state in the working
@@ -1286,17 +1286,17 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 		restore_state();
 		if (use_strategies_nr > 1)
 			fprintf(stderr,
-				"No merge strategy handled the merge.\n");
+				_("No merge strategy handled the merge.\n"));
 		else
-			fprintf(stderr, "Merge with strategy %s failed.\n",
+			fprintf(stderr, _("Merge with strategy %s failed.\n"),
 				use_strategies[0]->name);
 		return 2;
 	} else if (best_strategy == wt_strategy)
 		; /* We already have its result in the working tree. */
 	else {
-		printf("Rewinding the tree to pristine...\n");
+		printf(_("Rewinding the tree to pristine...\n"));
 		restore_state();
-		printf("Using the %s to prepare resolving by hand.\n",
+		printf(_("Using the %s to prepare resolving by hand.\n"),
 			best_strategy);
 		try_merge_strategy(best_strategy, common, head_arg);
 	}
@@ -1312,35 +1312,35 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
 				sha1_to_hex(j->item->object.sha1));
 		fd = open(git_path("MERGE_HEAD"), O_WRONLY | O_CREAT, 0666);
 		if (fd < 0)
-			die_errno("Could not open '%s' for writing",
+			die_errno(_("Could not open '%s' for writing"),
 				  git_path("MERGE_HEAD"));
 		if (write_in_full(fd, buf.buf, buf.len) != buf.len)
-			die_errno("Could not write to '%s'", git_path("MERGE_HEAD"));
+			die_errno(_("Could not write to '%s'"), git_path("MERGE_HEAD"));
 		close(fd);
 		strbuf_addch(&merge_msg, '\n');
 		fd = open(git_path("MERGE_MSG"), O_WRONLY | O_CREAT, 0666);
 		if (fd < 0)
-			die_errno("Could not open '%s' for writing",
+			die_errno(_("Could not open '%s' for writing"),
 				  git_path("MERGE_MSG"));
 		if (write_in_full(fd, merge_msg.buf, merge_msg.len) !=
 			merge_msg.len)
-			die_errno("Could not write to '%s'", git_path("MERGE_MSG"));
+			die_errno(_("Could not write to '%s'"), git_path("MERGE_MSG"));
 		close(fd);
 		fd = open(git_path("MERGE_MODE"), O_WRONLY | O_CREAT | O_TRUNC, 0666);
 		if (fd < 0)
-			die_errno("Could not open '%s' for writing",
+			die_errno(_("Could not open '%s' for writing"),
 				  git_path("MERGE_MODE"));
 		strbuf_reset(&buf);
 		if (!allow_fast_forward)
 			strbuf_addf(&buf, "no-ff");
 		if (write_in_full(fd, buf.buf, buf.len) != buf.len)
-			die_errno("Could not write to '%s'", git_path("MERGE_MODE"));
+			die_errno(_("Could not write to '%s'"), git_path("MERGE_MODE"));
 		close(fd);
 	}
 
 	if (merge_was_ok) {
-		fprintf(stderr, "Automatic merge went well; "
-			"stopped before committing as requested\n");
+		fprintf(stderr, _("Automatic merge went well; "
+			"stopped before committing as requested\n"));
 		return 0;
 	} else
 		return suggest_conflicts(option_renormalize);
diff --git a/t/t7607-merge-overwrite.sh b/t/t7607-merge-overwrite.sh
index 5f731a1..ccd5a56 100755
--- a/t/t7607-merge-overwrite.sh
+++ b/t/t7607-merge-overwrite.sh
@@ -150,8 +150,14 @@ test_expect_success 'will not overwrite untracked file on unborn branch' '
 	git rm -fr . &&
 	git checkout --orphan new &&
 	cp important c0.c &&
-	test_must_fail git merge c0 2>out &&
-	test_cmp out expect &&
+	test_must_fail git merge c0 2>out
+'
+
+test_expect_success NO_GETTEXT_POISON 'will not overwrite untracked file on unborn branch: output' '
+	test_cmp out expect
+'
+
+test_expect_success 'will not overwrite untracked file on unborn branch .git/MERGE_HEAD sanity etc.' '
 	test_path_is_missing .git/MERGE_HEAD &&
 	test_cmp important c0.c
 '
diff --git a/t/t7611-merge-abort.sh b/t/t7611-merge-abort.sh
index 61890bc..760271c 100755
--- a/t/t7611-merge-abort.sh
+++ b/t/t7611-merge-abort.sh
@@ -46,8 +46,14 @@ test_expect_success 'setup' '
 pre_merge_head="$(git rev-parse HEAD)"
 
 test_expect_success 'fails without MERGE_HEAD (unstarted merge)' '
-	test_must_fail git merge --abort 2>output &&
-	grep -q MERGE_HEAD output &&
+	test_must_fail git merge --abort 2>output
+'
+
+test_expect_success NO_GETTEXT_POISON 'fails without MERGE_HEAD (unstarted merge): fatal output' '
+	grep -q MERGE_HEAD output
+'
+
+test_expect_success 'fails without MERGE_HEAD (unstarted merge): .git/MERGE_HEAD sanity' '
 	test ! -f .git/MERGE_HEAD &&
 	test "$pre_merge_head" = "$(git rev-parse HEAD)"
 '
@@ -57,8 +63,14 @@ test_expect_success 'fails without MERGE_HEAD (completed merge)' '
 	test ! -f .git/MERGE_HEAD &&
 	# Merge successfully completed
 	post_merge_head="$(git rev-parse HEAD)" &&
-	test_must_fail git merge --abort 2>output &&
-	grep -q MERGE_HEAD output &&
+	test_must_fail git merge --abort 2>output
+'
+
+test_expect_success NO_GETTEXT_POISON 'fails without MERGE_HEAD (completed merge): output' '
+	grep -q MERGE_HEAD output
+'
+
+test_expect_success 'fails without MERGE_HEAD (completed merge): .git/MERGE_HEAD sanity' '
 	test ! -f .git/MERGE_HEAD &&
 	test "$post_merge_head" = "$(git rev-parse HEAD)"
 '
-- 
1.7.2.3

[PATCH 41/72] gettextize: git-merge "You have not concluded your merge" messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Gettextize the "You have not concluded your merge messages. A test in
t3030-merge-recursive.sh explicitly checked for this message. Change
it to skip the test under GETTEXT_POISON=YesPlease.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 t/t3030-merge-recursive.sh |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/t/t3030-merge-recursive.sh b/t/t3030-merge-recursive.sh
index 34794f8..d441036 100755
--- a/t/t3030-merge-recursive.sh
+++ b/t/t3030-merge-recursive.sh
@@ -312,7 +312,7 @@ test_expect_success 'merge-recursive result' '
 
 '
 
-test_expect_success 'fail if the index has unresolved entries' '
+test_expect_success NO_GETTEXT_POISON 'fail if the index has unresolved entries' '
 
 	rm -fr [abcd] &&
 	git checkout -f "$c1" &&
-- 
1.7.2.3

[PATCH 38/72] gettextize: git-log "--OPT does not make sense" messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Gettextize the "--name-only/--name-status/--check does not make sense"
messages. A test in t4014-format-patch.sh explicitly checked for these
messages. Change them to skip under GETTEXT_POISON=YesPlease.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/log.c           |    6 +++---
 t/t4014-format-patch.sh |    2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/builtin/log.c b/builtin/log.c
index b36a01e..853f5d0 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -1136,11 +1136,11 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 		die (_("unrecognized argument: %s"), argv[1]);
 
 	if (rev.diffopt.output_format & DIFF_FORMAT_NAME)
-		die("--name-only does not make sense");
+		die(_("--name-only does not make sense"));
 	if (rev.diffopt.output_format & DIFF_FORMAT_NAME_STATUS)
-		die("--name-status does not make sense");
+		die(_("--name-status does not make sense"));
 	if (rev.diffopt.output_format & DIFF_FORMAT_CHECKDIFF)
-		die("--check does not make sense");
+		die(_("--check does not make sense"));
 
 	if (!use_patch_format &&
 		(!rev.diffopt.output_format ||
diff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh
index 027c13d..3b182f5 100755
--- a/t/t4014-format-patch.sh
+++ b/t/t4014-format-patch.sh
@@ -614,7 +614,7 @@ echo "fatal: --name-only does not make sense" > expect.name-only
 echo "fatal: --name-status does not make sense" > expect.name-status
 echo "fatal: --check does not make sense" > expect.check
 
-test_expect_success 'options no longer allowed for format-patch' '
+test_expect_success NO_GETTEXT_POISON 'options no longer allowed for format-patch' '
 	test_must_fail git format-patch --name-only 2> output &&
 	test_cmp expect.name-only output &&
 	test_must_fail git format-patch --name-status 2> output &&
-- 
1.7.2.3

[PATCH 25/72] gettextize: git-commit "middle of a merge" message

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Gettextize the "You are in the middle of a merge -- cannot amend."
message. Several tests in t7110-reset-merge.sh explicitly checked for
this message. Change them to skip under GETTEXT_POISON=YesPlease.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/commit.c       |    4 ++--
 t/t7110-reset-merge.sh |    6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/builtin/commit.c b/builtin/commit.c
index c57f603..0198e90 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -928,9 +928,9 @@ static int parse_and_validate_options(int argc, const char *argv[],
 	if (amend && initial_commit)
 		die(_("You have nothing to amend."));
 	if (amend && in_merge)
-		die("You are in the middle of a merge -- cannot amend.");
+		die(_("You are in the middle of a merge -- cannot amend."));
 	if (fixup_message && squash_message)
-		die("Options --squash and --fixup cannot be used together");
+		die(_("Options --squash and --fixup cannot be used together"));
 	if (use_message)
 		f++;
 	if (edit_message)
diff --git a/t/t7110-reset-merge.sh b/t/t7110-reset-merge.sh
index 70cdd8e..8e54f0c 100755
--- a/t/t7110-reset-merge.sh
+++ b/t/t7110-reset-merge.sh
@@ -233,7 +233,7 @@ test_expect_success '"reset --merge HEAD^" is ok with pending merge' '
 #           working index HEAD target         working index HEAD
 #           ----------------------------------------------------
 # file1:     X       U     B    C     --keep   (disallowed)
-test_expect_success '"reset --keep HEAD^" fails with pending merge' '
+test_expect_success NO_GETTEXT_POISON '"reset --keep HEAD^" fails with pending merge' '
     git reset --hard third &&
     test_must_fail git merge branch1 &&
     test_must_fail git reset --keep HEAD^ 2>err.log &&
@@ -259,7 +259,7 @@ test_expect_success '"reset --merge HEAD" is ok with pending merge' '
 #           working index HEAD target         working index HEAD
 #           ----------------------------------------------------
 # file1:     X       U     B    B     --keep   (disallowed)
-test_expect_success '"reset --keep HEAD" fails with pending merge' '
+test_expect_success NO_GETTEXT_POISON '"reset --keep HEAD" fails with pending merge' '
     git reset --hard third &&
     test_must_fail git merge branch1 &&
     test_must_fail git reset --keep HEAD 2>err.log &&
@@ -280,7 +280,7 @@ test_expect_success '--merge is ok with added/deleted merge' '
     git diff --exit-code --cached
 '
 
-test_expect_success '--keep fails with added/deleted merge' '
+test_expect_success NO_GETTEXT_POISON '--keep fails with added/deleted merge' '
     git reset --hard third &&
     rm -f file2 &&
     test_must_fail git merge branch3 &&
-- 
1.7.2.3

[PATCH 32/72] gettextize: git-fetch formatting messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:36

Translate some of the formatting messages that appear on git-fetch
showing how branches/tags etc. were updated.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/fetch.c             |   20 ++++++++++----------
 t/t5526-fetch-submodules.sh |   40 ++++++++++++++++++++++++++++++++--------
 2 files changed, 42 insertions(+), 18 deletions(-)
diff --git a/builtin/fetch.c b/builtin/fetch.c
index c27c3e9..0a73dff 100644
--- a/builtin/fetch.c
+++ b/builtin/fetch.c
@@ -242,7 +242,7 @@ static int update_local_ref(struct ref *ref,
 	if (!hashcmp(ref->old_sha1, ref->new_sha1)) {
 		if (verbosity > 0)
 			sprintf(display, "= %-*s %-*s -> %s", TRANSPORT_SUMMARY_WIDTH,
-				"[up to date]", REFCOL_WIDTH, remote,
+				_("[up to date]"), REFCOL_WIDTH, remote,
 				pretty_ref);
 		return 0;
 	}
@@ -255,8 +255,8 @@ static int update_local_ref(struct ref *ref,
 		 * If this is the head, and it's not okay to update
 		 * the head, and the old value of the head isn't empty...
 		 */
-		sprintf(display, "! %-*s %-*s -> %s  (can't fetch in current branch)",
-			TRANSPORT_SUMMARY_WIDTH, "[rejected]", REFCOL_WIDTH, remote,
+		sprintf(display, _("! %-*s %-*s -> %s  (can't fetch in current branch)"),
+			TRANSPORT_SUMMARY_WIDTH, _("[rejected]"), REFCOL_WIDTH, remote,
 			pretty_ref);
 		return 1;
 	}
@@ -266,8 +266,8 @@ static int update_local_ref(struct ref *ref,
 		int r;
 		r = s_update_ref("updating tag", ref, 0);
 		sprintf(display, "%c %-*s %-*s -> %s%s", r ? '!' : '-',
-			TRANSPORT_SUMMARY_WIDTH, "[tag update]", REFCOL_WIDTH, remote,
-			pretty_ref, r ? "  (unable to update local ref)" : "");
+			TRANSPORT_SUMMARY_WIDTH, _("[tag update]"), REFCOL_WIDTH, remote,
+			pretty_ref, r ? _("  (unable to update local ref)") : "");
 		return r;
 	}
 
@@ -415,7 +415,7 @@ static int store_updated_refs(const char *raw_url, const char *remote_name,
 				 REFCOL_WIDTH, *what ? what : "HEAD");
 		if (*note) {
 			if (verbosity >= 0 && !shown_url) {
-				fprintf(stderr, "From %.*s\n",
+				fprintf(stderr, _("From %.*s\n"),
 						url_len, url);
 				shown_url = 1;
 			}
@@ -524,16 +524,16 @@ static int prune_refs(struct transport *transport, struct ref *ref_map)
 	int result = 0;
 	struct ref *ref, *stale_refs = get_stale_heads(transport->remote, ref_map);
 	const char *dangling_msg = dry_run
-		? "   (%s will become dangling)\n"
-		: "   (%s has become dangling)\n";
+		? _("   (%s will become dangling)\n")
+		: _("   (%s has become dangling)\n");
 
 	for (ref = stale_refs; ref; ref = ref->next) {
 		if (!dry_run)
 			result |= delete_ref(ref->name, NULL, 0);
 		if (verbosity >= 0) {
 			fprintf(stderr, " x %-*s %-*s -> %s\n",
-				TRANSPORT_SUMMARY_WIDTH, "[deleted]",
-				REFCOL_WIDTH, "(none)", prettify_refname(ref->name));
+				TRANSPORT_SUMMARY_WIDTH, _("[deleted]"),
+				REFCOL_WIDTH, _("(none)"), prettify_refname(ref->name));
 			warn_dangling_symref(stderr, dangling_msg, ref->name);
 		}
 	}
diff --git a/t/t5526-fetch-submodules.sh b/t/t5526-fetch-submodules.sh
index a5f4585..617ce67 100755
--- a/t/t5526-fetch-submodules.sh
+++ b/t/t5526-fetch-submodules.sh
@@ -66,7 +66,10 @@ test_expect_success "fetch --recurse-submodules recurses into submodules" '
 	(
 		cd downstream &&
 		git fetch --recurse-submodules >../actual.out 2>../actual.err
-	) &&
+	)
+'
+
+test_expect_success NO_GETTEXT_POISON "fetch --recurse-submodules recurses into submodules: output" '
 	test_cmp expect.out actual.out &&
 	test_cmp expect.err actual.err
 '
@@ -95,7 +98,10 @@ test_expect_success "using fetchRecurseSubmodules=true in .gitmodules recurses i
 		cd downstream &&
 		git config -f .gitmodules submodule.submodule.fetchRecurseSubmodules true &&
 		git fetch >../actual.out 2>../actual.err
-	) &&
+	)
+'
+
+test_expect_success NO_GETTEXT_POISON "using fetchRecurseSubmodules=true in .gitmodules recurses into submodules" '
 	test_cmp expect.out actual.out &&
 	test_cmp expect.err actual.err
 '
@@ -126,7 +132,10 @@ test_expect_success "--recurse-submodules overrides fetchRecurseSubmodules setti
 		git fetch --recurse-submodules >../actual.out 2>../actual.err &&
 		git config --unset -f .gitmodules submodule.submodule.fetchRecurseSubmodules &&
 		git config --unset submodule.submodule.fetchRecurseSubmodules
-	) &&
+	)
+'
+
+test_expect_success NO_GETTEXT_POISON "--recurse-submodules overrides fetchRecurseSubmodules setting from .git/config: output" '
 	test_cmp expect.out actual.out &&
 	test_cmp expect.err actual.err
 '
@@ -145,13 +154,22 @@ test_expect_success "--dry-run propagates to submodules" '
 	(
 		cd downstream &&
 		git fetch --recurse-submodules --dry-run >../actual.out 2>../actual.err
-	) &&
+	)
+'
+
+test_expect_success NO_GETTEXT_POISON "--dry-run propagates to submodules: output" '
 	test_cmp expect.out actual.out &&
-	test_cmp expect.err actual.err &&
+	test_cmp expect.err actual.err
+'
+
+test_expect_success "Without --dry-run propagates to submodules" '
 	(
 		cd downstream &&
 		git fetch --recurse-submodules >../actual.out 2>../actual.err
-	) &&
+	)
+'
+
+test_expect_success NO_GETTEXT_POISON "Without --dry-run propagates to submodules: output" '
 	test_cmp expect.out actual.out &&
 	test_cmp expect.err actual.err
 '
@@ -162,7 +180,10 @@ test_expect_success "recurseSubmodules=true propagates into submodules" '
 		cd downstream &&
 		git config fetch.recurseSubmodules true
 		git fetch >../actual.out 2>../actual.err
-	) &&
+	)
+'
+
+test_expect_success NO_GETTEXT_POISON "recurseSubmodules=true propagates into submodules: output" '
 	test_cmp expect.out actual.out &&
 	test_cmp expect.err actual.err
 '
@@ -176,7 +197,10 @@ test_expect_success "--recurse-submodules overrides config in submodule" '
 			git config fetch.recurseSubmodules false
 		) &&
 		git fetch --recurse-submodules >../actual.out 2>../actual.err
-	) &&
+	)
+'
+
+test_expect_success NO_GETTEXT_POISON "--recurse-submodules overrides config in submodule: output" '
 	test_cmp expect.out actual.out &&
 	test_cmp expect.err actual.err
 '
-- 
1.7.2.3

[PATCH 28/72] gettextize: git-commit "enter the commit message" message

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:37

Gettextize the "# Please enter the commit message for your changes."
message. Several tests in t7500-commit.sh and t7502-commit.sh assume
that this message starts with a newline. Change the tests to to skip
under GETTEXT_POISON=YesPlease.

These fail under GETTEXT_POISON=YesPlease because the poison editor
message doesn't do the right thing with comments and line breaks, so
these messages will be incorrectly broken up across lines.

This test should not be skipped under a hypothetical future testing
mode that tests Git under language locales, since those messages
should all start with a newline like the original.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/commit.c  |   12 ++++++------
 t/t7500-commit.sh |    8 ++++----
 t/t7502-commit.sh |   26 +++++++++++++++++---------
 3 files changed, 27 insertions(+), 19 deletions(-)
diff --git a/builtin/commit.c b/builtin/commit.c
index c90a8cf..ac8da45 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -705,19 +705,19 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 				git_path("MERGE_HEAD"));
 
 		fprintf(fp,
-			"\n"
-			"# Please enter the commit message for your changes.");
+			_("\n"
+			"# Please enter the commit message for your changes."));
 		if (cleanup_mode == CLEANUP_ALL)
 			fprintf(fp,
-				" Lines starting\n"
+				_(" Lines starting\n"
 				"# with '#' will be ignored, and an empty"
-				" message aborts the commit.\n");
+				" message aborts the commit.\n"));
 		else /* CLEANUP_SPACE, that is. */
 			fprintf(fp,
-				" Lines starting\n"
+				_(" Lines starting\n"
 				"# with '#' will be kept; you may remove them"
 				" yourself if you want to.\n"
-				"# An empty message aborts the commit.\n");
+				"# An empty message aborts the commit.\n"));
 		if (only_include_assumed)
 			fprintf(fp, "# %s\n", only_include_assumed);
 
diff --git a/t/t7500-commit.sh b/t/t7500-commit.sh
index 162527c..70dfc88 100755
--- a/t/t7500-commit.sh
+++ b/t/t7500-commit.sh
@@ -59,7 +59,7 @@ test_expect_success 'adding comments to a template should not commit' '
 	)
 '
 
-test_expect_success 'adding real content to a template should commit' '
+test_expect_success NO_GETTEXT_POISON 'adding real content to a template should commit' '
 	(
 		test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
 		git commit --template "$TEMPLATE"
@@ -67,7 +67,7 @@ test_expect_success 'adding real content to a template should commit' '
 	commit_msg_is "template linecommit message"
 '
 
-test_expect_success '-t option should be short for --template' '
+test_expect_success NO_GETTEXT_POISON '-t option should be short for --template' '
 	echo "short template" > "$TEMPLATE" &&
 	echo "new content" >> foo &&
 	git add foo &&
@@ -78,7 +78,7 @@ test_expect_success '-t option should be short for --template' '
 	commit_msg_is "short templatecommit message"
 '
 
-test_expect_success 'config-specified template should commit' '
+test_expect_success NO_GETTEXT_POISON 'config-specified template should commit' '
 	echo "new template" > "$TEMPLATE" &&
 	git config commit.template "$TEMPLATE" &&
 	echo "more content" >> foo &&
@@ -277,7 +277,7 @@ test_expect_success 'commit --squash works with -c for same commit' '
 	commit_msg_is "squash! edited commit"
 '
 
-test_expect_success 'commit --squash works with editor' '
+test_expect_success NO_GETTEXT_POISON 'commit --squash works with editor' '
 	commit_for_rebase_autosquash_setup &&
 	test_set_editor "$TEST_DIRECTORY"/t7500/add-content &&
 	git commit --squash HEAD~1 &&
diff --git a/t/t7502-commit.sh b/t/t7502-commit.sh
index 298f7d9..6586355 100755
--- a/t/t7502-commit.sh
+++ b/t/t7502-commit.sh
@@ -221,19 +221,21 @@ test_expect_success 'cleanup commit messages (strip,-F)' '
 
 '
 
-echo "sample
-
-# Please enter the commit message for your changes. Lines starting
-# with '#' will be ignored, and an empty message aborts the commit." >expect
-
 test_expect_success 'cleanup commit messages (strip,-F,-e)' '
 
 	echo >>negative &&
 	{ echo;echo sample;echo; } >text &&
 	git commit -e -F text -a &&
-	head -n 4 .git/COMMIT_EDITMSG >actual &&
-	test_cmp expect actual
+	head -n 4 .git/COMMIT_EDITMSG >actual
+'
+
+echo "sample
 
+# Please enter the commit message for your changes. Lines starting
+# with '#' will be ignored, and an empty message aborts the commit." >expect
+
+test_expect_success NO_GETTEXT_POISON 'cleanup commit messages (strip,-F,-e): output' '
+	test_cmp expect actual
 '
 
 echo "#
@@ -244,7 +246,10 @@ test_expect_success NO_GETTEXT_POISON 'author different from committer' '
 
 	echo >>negative &&
 	git commit -e -m "sample"
-	head -n 7 .git/COMMIT_EDITMSG >actual &&
+	head -n 7 .git/COMMIT_EDITMSG >actual
+'
+
+test_expect_success NO_GETTEXT_POISON 'author different from committer: output' '
 	test_cmp expect actual
 '
 
@@ -264,7 +269,10 @@ test_expect_success NO_GETTEXT_POISON 'committer is automatic' '
 		test_must_fail git commit -e -m "sample"
 	) &&
 	head -n 8 .git/COMMIT_EDITMSG |	\
-	sed "s/^# Committer: .*/# Committer:/" >actual &&
+	sed "s/^# Committer: .*/# Committer:/" >actual
+'
+
+test_expect_success NO_GETTEXT_POISON 'committer is automatic: output' '
 	test_cmp expect actual
 '
 
-- 
1.7.2.3

[PATCH 27/72] gettextize: git-commit print_summary messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:37

Gettextize the "(root-commit)" and "detached HEAD" fragments that
appear when you commit either the root commit, or a commit in a
detached head translatable.

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/commit.c  |    4 ++--
 t/t7502-commit.sh |   10 ++++++++--
 2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/builtin/commit.c b/builtin/commit.c
index c7c6c59..c90a8cf 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -1223,9 +1223,9 @@ static void print_summary(const char *prefix, const unsigned char *sha1)
 		!prefixcmp(head, "refs/heads/") ?
 			head + 11 :
 			!strcmp(head, "HEAD") ?
-				"detached HEAD" :
+				_("detached HEAD") :
 				head,
-		initial_commit ? " (root-commit)" : "");
+		initial_commit ? _(" (root-commit)") : "");
 
 	if (!log_tree_commit(&rev, commit)) {
 		rev.always_show_header = 1;
diff --git a/t/t7502-commit.sh b/t/t7502-commit.sh
index 9204a4d..298f7d9 100755
--- a/t/t7502-commit.sh
+++ b/t/t7502-commit.sh
@@ -22,7 +22,10 @@ check_summary_oneline() {
 	SUMMARY_POSTFIX="$(git log -1 --pretty='format:%h')"
 	echo "[$SUMMARY_PREFIX $SUMMARY_POSTFIX] $2" >exp &&
 
-	test_cmp exp act
+	if test_have_prereq NO_GETTEXT_POISON
+	then
+		test_cmp exp act
+	fi
 }
 
 test_expect_success 'output summary format' '
@@ -32,7 +35,10 @@ test_expect_success 'output summary format' '
 	check_summary_oneline "root-commit" "initial" &&
 
 	echo change >>file1 &&
-	git add file1 &&
+	git add file1
+'
+
+test_expect_success 'output summary format: root-commit' '
 	check_summary_oneline "" "a change"
 '
 
-- 
1.7.2.3

[PATCH 19/72] gettextize: git-checkout basic messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:37

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/checkout.c |   68 ++++++++++++++++++++++++++--------------------------
 1 files changed, 34 insertions(+), 34 deletions(-)
diff --git a/builtin/checkout.c b/builtin/checkout.c
index cd7f56e..b5060ab 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -116,7 +116,7 @@ static int check_all_stages(struct cache_entry *ce, int pos)
 	    ce_stage(active_cache[pos+1]) != 2 ||
 	    strcmp(active_cache[pos+2]->name, ce->name) ||
 	    ce_stage(active_cache[pos+2]) != 3)
-		return error("path '%s' does not have all three versions",
+		return error(_("path '%s' does not have all three versions"),
 			     ce->name);
 	return 0;
 }
@@ -150,7 +150,7 @@ static int checkout_merged(int pos, struct checkout *state)
 	    ce_stage(active_cache[pos+1]) != 2 ||
 	    strcmp(active_cache[pos+2]->name, path) ||
 	    ce_stage(active_cache[pos+2]) != 3)
-		return error("path '%s' does not have all 3 versions", path);
+		return error(_("path '%s' does not have all 3 versions"), path);
 
 	read_mmblob(&ancestor, active_cache[pos]->sha1);
 	read_mmblob(&ours, active_cache[pos+1]->sha1);
@@ -167,7 +167,7 @@ static int checkout_merged(int pos, struct checkout *state)
 	free(theirs.ptr);
 	if (status < 0 || !result_buf.ptr) {
 		free(result_buf.ptr);
-		return error("path '%s': cannot merge", path);
+		return error(_("path '%s': cannot merge"), path);
 	}
 
 	/*
@@ -184,12 +184,12 @@ static int checkout_merged(int pos, struct checkout *state)
 	 */
 	if (write_sha1_file(result_buf.ptr, result_buf.size,
 			    blob_type, sha1))
-		die("Unable to add merge result for '%s'", path);
+		die(_("Unable to add merge result for '%s'"), path);
 	ce = make_cache_entry(create_ce_mode(active_cache[pos+1]->ce_mode),
 			      sha1,
 			      path, 2, 0);
 	if (!ce)
-		die("make_cache_entry failed for path '%s'", path);
+		die(_("make_cache_entry failed for path '%s'"), path);
 	status = checkout_entry(ce, state, NULL);
 	return status;
 }
@@ -211,7 +211,7 @@ static int checkout_paths(struct tree *source_tree, const char **pathspec,
 
 	newfd = hold_locked_index(lock_file, 1);
 	if (read_cache_preload(pathspec) < 0)
-		return error("corrupt index file");
+		return error(_("corrupt index file"));
 
 	if (source_tree)
 		read_tree_some(source_tree, pathspec);
@@ -239,14 +239,14 @@ static int checkout_paths(struct tree *source_tree, const char **pathspec,
 			if (!ce_stage(ce))
 				continue;
 			if (opts->force) {
-				warning("path '%s' is unmerged", ce->name);
+				warning(_("path '%s' is unmerged"), ce->name);
 			} else if (stage) {
 				errs |= check_stage(stage, ce, pos);
 			} else if (opts->merge) {
 				errs |= check_all_stages(ce, pos);
 			} else {
 				errs = 1;
-				error("path '%s' is unmerged", ce->name);
+				error(_("path '%s' is unmerged"), ce->name);
 			}
 			pos = skip_same_name(ce, pos) - 1;
 		}
@@ -275,7 +275,7 @@ static int checkout_paths(struct tree *source_tree, const char **pathspec,
 
 	if (write_cache(newfd, active_cache, active_nr) ||
 	    commit_locked_index(lock_file))
-		die("unable to write new index file");
+		die(_("unable to write new index file"));
 
 	resolve_ref("HEAD", rev, 0, &flag);
 	head = lookup_commit_reference_gently(rev, 1);
@@ -292,7 +292,7 @@ static void show_local_changes(struct object *head, struct diff_options *opts)
 	rev.diffopt.flags = opts->flags;
 	rev.diffopt.output_format |= DIFF_FORMAT_NAME_STATUS;
 	if (diff_setup_done(&rev.diffopt) < 0)
-		die("diff_setup_done failed");
+		die(_("diff_setup_done failed"));
 	add_pending_object(&rev, head, NULL);
 	run_diff_index(&rev, 0);
 }
@@ -366,7 +366,7 @@ static int merge_working_tree(struct checkout_opts *opts,
 	int newfd = hold_locked_index(lock_file, 1);
 
 	if (read_cache_preload(NULL) < 0)
-		return error("corrupt index file");
+		return error(_("corrupt index file"));
 
 	resolve_undo_clear();
 	if (opts->force) {
@@ -388,7 +388,7 @@ static int merge_working_tree(struct checkout_opts *opts,
 		refresh_cache(REFRESH_QUIET);
 
 		if (unmerged_cache()) {
-			error("you need to resolve your current index first");
+			error(_("you need to resolve your current index first"));
 			return 1;
 		}
 
@@ -470,7 +470,7 @@ static int merge_working_tree(struct checkout_opts *opts,
 
 	if (write_cache(newfd, active_cache, active_nr) ||
 	    commit_locked_index(lock_file))
-		die("unable to write new index file");
+		die(_("unable to write new index file"));
 
 	if (!opts->force && !opts->quiet)
 		show_local_changes(&new->commit->object, &opts->diff_options);
@@ -519,7 +519,7 @@ static void update_refs_for_switch(struct checkout_opts *opts,
 				temp = log_all_ref_updates;
 				log_all_ref_updates = 1;
 				if (log_ref_setup(ref_name, log_file, sizeof(log_file))) {
-					fprintf(stderr, "Can not do reflog for '%s'\n",
+					fprintf(stderr, _("Can not do reflog for '%s'\n"),
 					    opts->new_orphan_branch);
 					log_all_ref_updates = temp;
 					return;
@@ -545,14 +545,14 @@ static void update_refs_for_switch(struct checkout_opts *opts,
 		create_symref("HEAD", new->path, msg.buf);
 		if (!opts->quiet) {
 			if (old->path && !strcmp(new->path, old->path))
-				fprintf(stderr, "Already on '%s'\n",
+				fprintf(stderr, _("Already on '%s'\n"),
 					new->name);
 			else if (opts->new_branch)
 				fprintf(stderr, "Switched to%s branch '%s'\n",
 					opts->branch_exists ? " and reset" : " a new",
 					new->name);
 			else
-				fprintf(stderr, "Switched to branch '%s'\n",
+				fprintf(stderr, _("Switched to branch '%s'\n"),
 					new->name);
 		}
 		if (old->path && old->name) {
@@ -597,7 +597,7 @@ static int switch_branches(struct checkout_opts *opts, struct branch_info *new)
 		new->name = "HEAD";
 		new->commit = old.commit;
 		if (!new->commit)
-			die("You are on a branch yet to be born");
+			die(_("You are on a branch yet to be born"));
 		parse_commit(new->commit);
 	}
 
@@ -724,7 +724,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
 
 	/* we can assume from now on new_branch = !new_branch_force */
 	if (opts.new_branch && opts.new_branch_force)
-		die("-B cannot be used with -b");
+		die(_("-B cannot be used with -b"));
 
 	/* copy -B over to -b, so that we can just check the latter */
 	if (opts.new_branch_force)
@@ -732,28 +732,28 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
 
 	if (patch_mode && (opts.track > 0 || opts.new_branch
 			   || opts.new_branch_log || opts.merge || opts.force))
-		die ("--patch is incompatible with all other options");
+		die (_("--patch is incompatible with all other options"));
 
 	/* --track without -b should DWIM */
 	if (0 < opts.track && !opts.new_branch) {
 		const char *argv0 = argv[0];
 		if (!argc || !strcmp(argv0, "--"))
-			die ("--track needs a branch name");
+			die (_("--track needs a branch name"));
 		if (!prefixcmp(argv0, "refs/"))
 			argv0 += 5;
 		if (!prefixcmp(argv0, "remotes/"))
 			argv0 += 8;
 		argv0 = strchr(argv0, '/');
 		if (!argv0 || !argv0[1])
-			die ("Missing branch name; try -b");
+			die (_("Missing branch name; try -b"));
 		opts.new_branch = argv0 + 1;
 	}
 
 	if (opts.new_orphan_branch) {
 		if (opts.new_branch)
-			die("--orphan and -b|-B are mutually exclusive");
+			die(_("--orphan and -b|-B are mutually exclusive"));
 		if (opts.track > 0)
-			die("--orphan cannot be used with -t");
+			die(_("--orphan cannot be used with -t"));
 		opts.new_branch = opts.new_orphan_branch;
 	}
 
@@ -763,7 +763,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
 	}
 
 	if (opts.force && opts.merge)
-		die("git checkout: -f and -m are incompatible");
+		die(_("git checkout: -f and -m are incompatible"));
 
 	/*
 	 * case 1: git checkout <ref> -- [<paths>]
@@ -809,7 +809,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
 
 		if (get_sha1_mb(arg, rev)) {
 			if (has_dash_dash)          /* case (1) */
-				die("invalid reference: %s", arg);
+				die(_("invalid reference: %s"), arg);
 			if (!patch_mode &&
 			    dwim_new_local_branch &&
 			    opts.track == BRANCH_TRACK_UNSPECIFIED &&
@@ -846,7 +846,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
 			source_tree = parse_tree_indirect(rev);
 
 		if (!source_tree)                   /* case (1): want a tree */
-			die("reference is not a tree: %s", arg);
+			die(_("reference is not a tree: %s"), arg);
 		if (!has_dash_dash) {/* case (3 -> 1) */
 			/*
 			 * Do not complain the most common case
@@ -872,7 +872,7 @@ no_reference:
 		const char **pathspec = get_pathspec(prefix, argv);
 
 		if (!pathspec)
-			die("invalid path specification");
+			die(_("invalid path specification"));
 
 		if (patch_mode)
 			return interactive_checkout(new.name, pathspec, &opts);
@@ -880,14 +880,14 @@ no_reference:
 		/* Checkout paths */
 		if (opts.new_branch) {
 			if (argc == 1) {
-				die("git checkout: updating paths is incompatible with switching branches.\nDid you intend to checkout '%s' which can not be resolved as commit?", argv[0]);
+				die(_("git checkout: updating paths is incompatible with switching branches.\nDid you intend to checkout '%s' which can not be resolved as commit?"), argv[0]);
 			} else {
-				die("git checkout: updating paths is incompatible with switching branches.");
+				die(_("git checkout: updating paths is incompatible with switching branches."));
 			}
 		}
 
 		if (1 < !!opts.writeout_stage + !!opts.force + !!opts.merge)
-			die("git checkout: --ours/--theirs, --force and --merge are incompatible when\nchecking out of the index.");
+			die(_("git checkout: --ours/--theirs, --force and --merge are incompatible when\nchecking out of the index."));
 
 		return checkout_paths(source_tree, pathspec, &opts);
 	}
@@ -898,22 +898,22 @@ no_reference:
 	if (opts.new_branch) {
 		struct strbuf buf = STRBUF_INIT;
 		if (strbuf_check_branch_ref(&buf, opts.new_branch))
-			die("git checkout: we do not like '%s' as a branch name.",
+			die(_("git checkout: we do not like '%s' as a branch name."),
 			    opts.new_branch);
 		if (!get_sha1(buf.buf, rev)) {
 			opts.branch_exists = 1;
 			if (!opts.new_branch_force)
-				die("git checkout: branch %s already exists",
+				die(_("git checkout: branch %s already exists"),
 				    opts.new_branch);
 		}
 		strbuf_release(&buf);
 	}
 
 	if (new.name && !new.commit) {
-		die("Cannot switch branch to a non-commit.");
+		die(_("Cannot switch branch to a non-commit."));
 	}
 	if (opts.writeout_stage)
-		die("--ours/--theirs is incompatible with switching branches.");
+		die(_("--ours/--theirs is incompatible with switching branches."));
 
 	return switch_branches(&opts, &new);
 }
-- 
1.7.2.3

[PATCH 37/72] gettextize: git-log basic messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:37

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/log.c |   62 ++++++++++++++++++++++++++++----------------------------
 1 files changed, 31 insertions(+), 31 deletions(-)
diff --git a/builtin/log.c b/builtin/log.c
index d8c6c28..b36a01e 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -101,7 +101,7 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
 			const char *v = skip_prefix(arg, "--decorate=");
 			decoration_style = parse_decoration_style(arg, v);
 			if (decoration_style < 0)
-				die("invalid --decorate option: %s", arg);
+				die(_("invalid --decorate option: %s"), arg);
 			decoration_given = 1;
 		} else if (!strcmp(arg, "--no-decorate")) {
 			decoration_style = 0;
@@ -110,7 +110,7 @@ static void cmd_log_init(int argc, const char **argv, const char *prefix,
 		} else if (!strcmp(arg, "-h")) {
 			usage(builtin_log_usage);
 		} else
-			die("unrecognized argument: %s", arg);
+			die(_("unrecognized argument: %s"), arg);
 	}
 
 	/*
@@ -153,7 +153,7 @@ static void show_early_header(struct rev_info *rev, const char *stage, int nr)
 		if (rev->commit_format != CMIT_FMT_ONELINE)
 			putchar(rev->diffopt.line_termination);
 	}
-	printf("Final output: %d %s\n", nr, stage);
+	printf(_("Final output: %d %s\n"), nr, stage);
 }
 
 static struct itimerval early_output_timer;
@@ -252,7 +252,7 @@ static int cmd_log_walk(struct rev_info *rev)
 		setup_early_output(rev);
 
 	if (prepare_revision_walk(rev))
-		die("revision walk setup failed");
+		die(_("revision walk setup failed"));
 
 	if (rev->early_output)
 		finish_early_output(rev);
@@ -343,7 +343,7 @@ static int show_object(const unsigned char *sha1, int show_tag_object,
 	int offset = 0;
 
 	if (!buf)
-		return error("Could not read object %s", sha1_to_hex(sha1));
+		return error(_("Could not read object %s"), sha1_to_hex(sha1));
 
 	if (show_tag_object)
 		while (offset < size && buf[offset] != '\n') {
@@ -430,7 +430,7 @@ int cmd_show(int argc, const char **argv, const char *prefix)
 				break;
 			o = parse_object(t->tagged->sha1);
 			if (!o)
-				ret = error("Could not read object %s",
+				ret = error(_("Could not read object %s"),
 					    sha1_to_hex(t->tagged->sha1));
 			objects[i].item = o;
 			i--;
@@ -454,7 +454,7 @@ int cmd_show(int argc, const char **argv, const char *prefix)
 			ret = cmd_log_walk(&rev);
 			break;
 		default:
-			ret = error("Unknown type: %d", o->type);
+			ret = error(_("Unknown type: %d"), o->type);
 		}
 	}
 	free(objects);
@@ -554,7 +554,7 @@ static int git_format_config(const char *var, const char *value, void *cb)
 {
 	if (!strcmp(var, "format.headers")) {
 		if (!value)
-			die("format.headers without value");
+			die(_("format.headers without value"));
 		add_header(value);
 		return 0;
 	}
@@ -626,7 +626,7 @@ static int reopen_stdout(struct commit *commit, struct rev_info *rev)
 		strbuf_addstr(&filename, output_directory);
 		if (filename.len >=
 		    PATH_MAX - FORMAT_PATCH_NAME_MAX - suffix_len)
-			return error("name of output directory is too long");
+			return error(_("name of output directory is too long"));
 		if (filename.buf[filename.len - 1] != '/')
 			strbuf_addch(&filename, '/');
 	}
@@ -637,7 +637,7 @@ static int reopen_stdout(struct commit *commit, struct rev_info *rev)
 		fprintf(realstdout, "%s\n", filename.buf + outdir_offset);
 
 	if (freopen(filename.buf, "w", stdout) == NULL)
-		return error("Cannot open patch file %s", filename.buf);
+		return error(_("Cannot open patch file %s"), filename.buf);
 
 	strbuf_release(&filename);
 	return 0;
@@ -651,7 +651,7 @@ static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids, const cha
 	unsigned flags1, flags2;
 
 	if (rev->pending.nr != 2)
-		die("Need exactly one range.");
+		die(_("Need exactly one range."));
 
 	o1 = rev->pending.objects[0].item;
 	flags1 = o1->flags;
@@ -659,7 +659,7 @@ static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids, const cha
 	flags2 = o2->flags;
 
 	if ((flags1 & UNINTERESTING) == (flags2 & UNINTERESTING))
-		die("Not a range.");
+		die(_("Not a range."));
 
 	init_patch_ids(ids);
 
@@ -670,7 +670,7 @@ static void get_patch_ids(struct rev_info *rev, struct patch_ids *ids, const cha
 	add_pending_object(&check_rev, o1, "o1");
 	add_pending_object(&check_rev, o2, "o2");
 	if (prepare_revision_walk(&check_rev))
-		die("revision walk setup failed");
+		die(_("revision walk setup failed"));
 
 	while ((commit = get_revision(&check_rev)) != NULL) {
 		/* ignore merges */
@@ -696,7 +696,7 @@ static void gen_message_id(struct rev_info *info, char *base)
 	const char *email_end = strrchr(committer, '>');
 	struct strbuf buf = STRBUF_INIT;
 	if (!email_start || !email_end || email_start > email_end - 1)
-		die("Could not extract email from committer identity.");
+		die(_("Could not extract email from committer identity."));
 	strbuf_addf(&buf, "%s.%lu.git.%.*s", base,
 		    (unsigned long) time(NULL),
 		    (int)(email_end - email_start - 1), email_start + 1);
@@ -728,7 +728,7 @@ static void make_cover_letter(struct rev_info *rev, int use_stdout,
 	struct commit *commit = NULL;
 
 	if (rev->commit_format != CMIT_FMT_EMAIL)
-		die("Cover letter needs email format");
+		die(_("Cover letter needs email format"));
 
 	committer = git_committer_info(0);
 
@@ -821,7 +821,7 @@ static const char *clean_message_id(const char *msg_id)
 		m++;
 	}
 	if (!z)
-		die("insane in-reply-to: %s", msg_id);
+		die(_("insane in-reply-to: %s"), msg_id);
 	if (++z == m)
 		return a;
 	return xmemdupz(a, z - a);
@@ -894,7 +894,7 @@ static int output_directory_callback(const struct option *opt, const char *arg,
 {
 	const char **dir = (const char **)opt->value;
 	if (*dir)
-		die("Two output directories?");
+		die(_("Two output directories?"));
 	*dir = arg;
 	return 0;
 }
@@ -1082,7 +1082,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 		committer = git_committer_info(IDENT_ERROR_ON_NO_NAME);
 		endpos = strchr(committer, '>');
 		if (!endpos)
-			die("bogus committer info %s", committer);
+			die(_("bogus committer info %s"), committer);
 		add_signoff = xmemdupz(committer, endpos - committer + 1);
 	}
 
@@ -1127,13 +1127,13 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 		numbered = 0;
 
 	if (numbered && keep_subject)
-		die ("-n and -k are mutually exclusive.");
+		die (_("-n and -k are mutually exclusive."));
 	if (keep_subject && subject_prefix)
-		die ("--subject-prefix and -k are mutually exclusive.");
+		die (_("--subject-prefix and -k are mutually exclusive."));
 
 	argc = setup_revisions(argc, argv, &rev, &s_r_opt);
 	if (argc > 1)
-		die ("unrecognized argument: %s", argv[1]);
+		die (_("unrecognized argument: %s"), argv[1]);
 
 	if (rev.diffopt.output_format & DIFF_FORMAT_NAME)
 		die("--name-only does not make sense");
@@ -1163,9 +1163,9 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 
 	if (output_directory) {
 		if (use_stdout)
-			die("standard output, or directory, which one?");
+			die(_("standard output, or directory, which one?"));
 		if (mkdir(output_directory, 0777) < 0 && errno != EEXIST)
-			die_errno("Could not create directory '%s'",
+			die_errno(_("Could not create directory '%s'"),
 				  output_directory);
 	}
 
@@ -1219,7 +1219,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 		realstdout = xfdopen(xdup(1), "w");
 
 	if (prepare_revision_walk(&rev))
-		die("revision walk setup failed");
+		die(_("revision walk setup failed"));
 	rev.boundary = 1;
 	while ((commit = get_revision(&rev)) != NULL) {
 		if (commit->object.flags & BOUNDARY) {
@@ -1300,7 +1300,7 @@ int cmd_format_patch(int argc, const char **argv, const char *prefix)
 
 		if (!use_stdout && reopen_stdout(numbered_files ? NULL : commit,
 						 &rev))
-			die("Failed to create output files");
+			die(_("Failed to create output files"));
 		shown = log_tree_commit(&rev, commit);
 		free(commit->buffer);
 		commit->buffer = NULL;
@@ -1387,9 +1387,9 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)
 		if (!current_branch || !current_branch->merge
 					|| !current_branch->merge[0]
 					|| !current_branch->merge[0]->dst) {
-			fprintf(stderr, "Could not find a tracked"
+			fprintf(stderr, _("Could not find a tracked"
 					" remote branch, please"
-					" specify <upstream> manually.\n");
+					" specify <upstream> manually.\n"));
 			usage_with_options(cherry_usage, options);
 		}
 
@@ -1403,9 +1403,9 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)
 	DIFF_OPT_SET(&revs.diffopt, RECURSIVE);
 
 	if (add_pending_commit(head, &revs, 0))
-		die("Unknown commit %s", head);
+		die(_("Unknown commit %s"), head);
 	if (add_pending_commit(upstream, &revs, UNINTERESTING))
-		die("Unknown commit %s", upstream);
+		die(_("Unknown commit %s"), upstream);
 
 	/* Don't say anything if head and upstream are the same. */
 	if (revs.pending.nr == 2) {
@@ -1417,11 +1417,11 @@ int cmd_cherry(int argc, const char **argv, const char *prefix)
 	get_patch_ids(&revs, &ids, prefix);
 
 	if (limit && add_pending_commit(limit, &revs, UNINTERESTING))
-		die("Unknown commit %s", limit);
+		die(_("Unknown commit %s"), limit);
 
 	/* reverse the list of commits */
 	if (prepare_revision_walk(&revs))
-		die("revision walk setup failed");
+		die(_("revision walk setup failed"));
 	while ((commit = get_revision(&revs)) != NULL) {
 		/* ignore merges */
 		if (commit->parents && commit->parents->next)
-- 
1.7.2.3

[PATCH 26/72] gettextize: git-commit formatting messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:37

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/commit.c  |   12 ++++++------
 t/t7502-commit.sh |    4 ++--
 2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/builtin/commit.c b/builtin/commit.c
index 0198e90..c7c6c59 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -696,12 +696,12 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 		char *ai_tmp, *ci_tmp;
 		if (in_merge)
 			fprintf(fp,
-				"#\n"
+				_("#\n"
 				"# It looks like you may be committing a MERGE.\n"
 				"# If this is not correct, please remove the file\n"
 				"#	%s\n"
 				"# and try again.\n"
-				"#\n",
+				"#\n"),
 				git_path("MERGE_HEAD"));
 
 		fprintf(fp,
@@ -725,15 +725,15 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 		ci_tmp = cut_ident_timestamp_part(committer_ident.buf);
 		if (strcmp(author_ident->buf, committer_ident.buf))
 			fprintf(fp,
-				"%s"
-				"# Author:    %s\n",
+				_("%s"
+				"# Author:    %s\n"),
 				ident_shown++ ? "" : "#\n",
 				author_ident->buf);
 
 		if (!user_ident_sufficiently_given())
 			fprintf(fp,
-				"%s"
-				"# Committer: %s\n",
+				_("%s"
+				"# Committer: %s\n"),
 				ident_shown++ ? "" : "#\n",
 				committer_ident.buf);
 
diff --git a/t/t7502-commit.sh b/t/t7502-commit.sh
index 50da034..9204a4d 100755
--- a/t/t7502-commit.sh
+++ b/t/t7502-commit.sh
@@ -234,7 +234,7 @@ echo "#
 # Author:    $GIT_AUTHOR_NAME <$GIT_AUTHOR_EMAIL>
 #" >> expect
 
-test_expect_success 'author different from committer' '
+test_expect_success NO_GETTEXT_POISON 'author different from committer' '
 
 	echo >>negative &&
 	git commit -e -m "sample"
@@ -248,7 +248,7 @@ rm -f expect.tmp
 echo "# Committer:
 #" >> expect
 
-test_expect_success 'committer is automatic' '
+test_expect_success NO_GETTEXT_POISON 'committer is automatic' '
 
 	echo >>negative &&
 	(
-- 
1.7.2.3

[PATCH 24/72] gettextize: git-commit basic messages

From: Ævar Arnfjörð Bjarmason <hidden>
Date: 2016-06-15 22:50:37

Signed-off-by: Ævar Arnfjörð Bjarmason <redacted>
---
 builtin/commit.c |  118 +++++++++++++++++++++++++++---------------------------
 1 files changed, 59 insertions(+), 59 deletions(-)
diff --git a/builtin/commit.c b/builtin/commit.c
index d7f55e3..c57f603 100644
--- a/builtin/commit.c
+++ b/builtin/commit.c
@@ -243,7 +243,7 @@ static void add_remove_files(struct string_list *list)
 
 		if (!lstat(p->string, &st)) {
 			if (add_to_cache(p->string, &st, 0))
-				die("updating files failed");
+				die(_("updating files failed"));
 		} else
 			remove_file_from_cache(p->string);
 	}
@@ -270,7 +270,7 @@ static void create_base_index(void)
 	opts.fn = oneway_merge;
 	tree = parse_tree_indirect(head_sha1);
 	if (!tree)
-		die("failed to unpack HEAD tree object");
+		die(_("failed to unpack HEAD tree object"));
 	parse_tree(tree);
 	init_tree_desc(&t, tree->buffer, tree->size);
 	if (unpack_trees(1, &t, &opts))
@@ -298,9 +298,9 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, int
 		refresh_flags |= REFRESH_UNMERGED;
 	if (interactive) {
 		if (interactive_add(argc, argv, prefix) != 0)
-			die("interactive add failed");
+			die(_("interactive add failed"));
 		if (read_cache_preload(NULL) < 0)
-			die("index file corrupt");
+			die(_("index file corrupt"));
 		commit_style = COMMIT_AS_IS;
 		return get_index_file();
 	}
@@ -309,7 +309,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, int
 		pathspec = get_pathspec(prefix, argv);
 
 	if (read_cache_preload(pathspec) < 0)
-		die("index file corrupt");
+		die(_("index file corrupt"));
 
 	/*
 	 * Non partial, non as-is commit.
@@ -329,7 +329,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, int
 		refresh_cache_or_die(refresh_flags);
 		if (write_cache(fd, active_cache, active_nr) ||
 		    close_lock_file(&index_lock))
-			die("unable to write new_index file");
+			die(_("unable to write new_index file"));
 		commit_style = COMMIT_NORMAL;
 		return index_lock.filename;
 	}
@@ -349,7 +349,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, int
 		if (active_cache_changed) {
 			if (write_cache(fd, active_cache, active_nr) ||
 			    commit_locked_index(&index_lock))
-				die("unable to write new_index file");
+				die(_("unable to write new_index file"));
 		} else {
 			rollback_lock_file(&index_lock);
 		}
@@ -379,7 +379,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, int
 	commit_style = COMMIT_PARTIAL;
 
 	if (in_merge)
-		die("cannot do a partial commit during a merge.");
+		die(_("cannot do a partial commit during a merge."));
 
 	memset(&partial, 0, sizeof(partial));
 	partial.strdup_strings = 1;
@@ -388,14 +388,14 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, int
 
 	discard_cache();
 	if (read_cache() < 0)
-		die("cannot read the index");
+		die(_("cannot read the index"));
 
 	fd = hold_locked_index(&index_lock, 1);
 	add_remove_files(&partial);
 	refresh_cache(REFRESH_QUIET);
 	if (write_cache(fd, active_cache, active_nr) ||
 	    close_lock_file(&index_lock))
-		die("unable to write new_index file");
+		die(_("unable to write new_index file"));
 
 	fd = hold_lock_file_for_update(&false_lock,
 				       git_path("next-index-%"PRIuMAX,
@@ -408,7 +408,7 @@ static char *prepare_index(int argc, const char **argv, const char *prefix, int
 
 	if (write_cache(fd, active_cache, active_nr) ||
 	    close_lock_file(&false_lock))
-		die("unable to write temporary index file");
+		die(_("unable to write temporary index file"));
 
 	discard_cache();
 	read_cache_from(false_lock.filename);
@@ -455,7 +455,7 @@ static int is_a_merge(const unsigned char *sha1)
 {
 	struct commit *commit = lookup_commit(sha1);
 	if (!commit || parse_commit(commit))
-		die("could not parse HEAD commit");
+		die(_("could not parse HEAD commit"));
 	return !!(commit->parents && commit->parents->next);
 }
 
@@ -474,13 +474,13 @@ static void determine_author_info(struct strbuf *author_ident)
 
 		a = strstr(use_message_buffer, "\nauthor ");
 		if (!a)
-			die("invalid commit: %s", use_message);
+			die(_("invalid commit: %s"), use_message);
 
 		lb = strchrnul(a + strlen("\nauthor "), '<');
 		rb = strchrnul(lb, '>');
 		eol = strchrnul(rb, '\n');
 		if (!*lb || !*rb || !*eol)
-			die("invalid commit: %s", use_message);
+			die(_("invalid commit: %s"), use_message);
 
 		if (lb == a + strlen("\nauthor "))
 			/* \nauthor <foo@example.com> */
@@ -498,7 +498,7 @@ static void determine_author_info(struct strbuf *author_ident)
 		const char *rb = strchr(force_author, '>');
 
 		if (!lb || !rb)
-			die("malformed --author parameter");
+			die(_("malformed --author parameter"));
 		name = xstrndup(force_author, lb - force_author);
 		email = xstrndup(lb + 2, rb - (lb + 2));
 	}
@@ -554,7 +554,7 @@ static char *cut_ident_timestamp_part(char *string)
 {
 	char *ket = strrchr(string, '>');
 	if (!ket || ket[1] != ' ')
-		die("Malformed ident string: '%s'", string);
+		die(_("Malformed ident string: '%s'"), string);
 	*++ket = '\0';
 	return ket;
 }
@@ -588,7 +588,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 			struct commit *c;
 			c = lookup_commit_reference_by_name(squash_message);
 			if (!c)
-				die("could not lookup commit %s", squash_message);
+				die(_("could not lookup commit %s"), squash_message);
 			ctx.output_encoding = get_commit_output_encoding();
 			format_commit_message(c, "squash! %s\n\n", &sb,
 					      &ctx);
@@ -600,19 +600,19 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 		hook_arg1 = "message";
 	} else if (logfile && !strcmp(logfile, "-")) {
 		if (isatty(0))
-			fprintf(stderr, "(reading log message from standard input)\n");
+			fprintf(stderr, _("(reading log message from standard input)\n"));
 		if (strbuf_read(&sb, 0, 0) < 0)
-			die_errno("could not read log from standard input");
+			die_errno(_("could not read log from standard input"));
 		hook_arg1 = "message";
 	} else if (logfile) {
 		if (strbuf_read_file(&sb, logfile, 0) < 0)
-			die_errno("could not read log file '%s'",
+			die_errno(_("could not read log file '%s'"),
 				  logfile);
 		hook_arg1 = "message";
 	} else if (use_message) {
 		buffer = strstr(use_message_buffer, "\n\n");
 		if (!buffer || buffer[2] == '\0')
-			die("commit has empty message");
+			die(_("commit has empty message"));
 		strbuf_add(&sb, buffer + 2, strlen(buffer + 2));
 		hook_arg1 = "commit";
 		hook_arg2 = use_message;
@@ -621,22 +621,22 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 		struct commit *commit;
 		commit = lookup_commit_reference_by_name(fixup_message);
 		if (!commit)
-			die("could not lookup commit %s", fixup_message);
+			die(_("could not lookup commit %s"), fixup_message);
 		ctx.output_encoding = get_commit_output_encoding();
 		format_commit_message(commit, "fixup! %s\n\n",
 				      &sb, &ctx);
 		hook_arg1 = "message";
 	} else if (!stat(git_path("MERGE_MSG"), &statbuf)) {
 		if (strbuf_read_file(&sb, git_path("MERGE_MSG"), 0) < 0)
-			die_errno("could not read MERGE_MSG");
+			die_errno(_("could not read MERGE_MSG"));
 		hook_arg1 = "merge";
 	} else if (!stat(git_path("SQUASH_MSG"), &statbuf)) {
 		if (strbuf_read_file(&sb, git_path("SQUASH_MSG"), 0) < 0)
-			die_errno("could not read SQUASH_MSG");
+			die_errno(_("could not read SQUASH_MSG"));
 		hook_arg1 = "squash";
 	} else if (template_file && !stat(template_file, &statbuf)) {
 		if (strbuf_read_file(&sb, template_file, 0) < 0)
-			die_errno("could not read '%s'", template_file);
+			die_errno(_("could not read '%s'"), template_file);
 		hook_arg1 = "template";
 	}
 
@@ -659,7 +659,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 
 	fp = fopen(git_path(commit_editmsg), "w");
 	if (fp == NULL)
-		die_errno("could not open '%s'", git_path(commit_editmsg));
+		die_errno(_("could not open '%s'"), git_path(commit_editmsg));
 
 	if (cleanup_mode != CLEANUP_NONE)
 		stripspace(&sb, 0);
@@ -683,7 +683,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 	}
 
 	if (fwrite(sb.buf, 1, sb.len, fp) < sb.len)
-		die_errno("could not write commit template");
+		die_errno(_("could not write commit template"));
 
 	strbuf_release(&sb);
 
@@ -752,7 +752,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 		const char *parent = "HEAD";
 
 		if (!active_nr && read_cache() < 0)
-			die("Cannot read index");
+			die(_("Cannot read index"));
 
 		if (amend)
 			parent = "HEAD^1";
@@ -785,7 +785,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 		active_cache_tree = cache_tree();
 	if (cache_tree_update(active_cache_tree,
 			      active_cache, active_nr, 0, 0) < 0) {
-		error("Error building trees");
+		error(_("Error building trees"));
 		return 0;
 	}
 
@@ -800,7 +800,7 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
 		snprintf(index, sizeof(index), "GIT_INDEX_FILE=%s", index_file);
 		if (launch_editor(git_path(commit_editmsg), NULL, env)) {
 			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);
 		}
 	}
@@ -880,7 +880,7 @@ static const char *find_author_by_nickname(const char *name)
 		format_commit_message(commit, "%an <%ae>", &buf, &ctx);
 		return strbuf_detach(&buf, NULL);
 	}
-	die("No existing author found with '%s'", name);
+	die(_("No existing author found with '%s'"), name);
 }
 
 
@@ -895,7 +895,7 @@ static void handle_untracked_files_arg(struct wt_status *s)
 	else if (!strcmp(untracked_files_arg, "all"))
 		s->show_untracked_files = SHOW_ALL_UNTRACKED_FILES;
 	else
-		die("Invalid untracked files mode '%s'", untracked_files_arg);
+		die(_("Invalid untracked files mode '%s'"), untracked_files_arg);
 }
 
 static int parse_and_validate_options(int argc, const char *argv[],
@@ -912,7 +912,7 @@ static int parse_and_validate_options(int argc, const char *argv[],
 		force_author = find_author_by_nickname(force_author);
 
 	if (force_author && renew_authorship)
-		die("Using both --reset-author and --author does not make sense");
+		die(_("Using both --reset-author and --author does not make sense"));
 
 	if (logfile || message.len || use_message || fixup_message)
 		use_editor = 0;
@@ -926,7 +926,7 @@ static int parse_and_validate_options(int argc, const char *argv[],
 
 	/* Sanity check options */
 	if (amend && initial_commit)
-		die("You have nothing to amend.");
+		die(_("You have nothing to amend."));
 	if (amend && in_merge)
 		die("You are in the middle of a merge -- cannot amend.");
 	if (fixup_message && squash_message)
@@ -940,22 +940,22 @@ static int parse_and_validate_options(int argc, const char *argv[],
 	if (logfile)
 		f++;
 	if (f > 1)
-		die("Only one of -c/-C/-F/--fixup can be used.");
+		die(_("Only one of -c/-C/-F/--fixup can be used."));
 	if (message.len && f > 0)
-		die("Option -m cannot be combined with -c/-C/-F/--fixup.");
+		die((_("Option -m cannot be combined with -c/-C/-F/--fixup.")));
 	if (edit_message)
 		use_message = edit_message;
 	if (amend && !use_message && !fixup_message)
 		use_message = "HEAD";
 	if (!use_message && renew_authorship)
-		die("--reset-author can be used only with -C, -c or --amend.");
+		die(_("--reset-author can be used only with -C, -c or --amend."));
 	if (use_message) {
 		const char *out_enc;
 		struct commit *commit;
 
 		commit = lookup_commit_reference_by_name(use_message);
 		if (!commit)
-			die("could not lookup commit %s", use_message);
+			die(_("could not lookup commit %s"), use_message);
 		out_enc = get_commit_output_encoding();
 		use_message_buffer = logmsg_reencode(commit, out_enc);
 
@@ -970,13 +970,13 @@ static int parse_and_validate_options(int argc, const char *argv[],
 	}
 
 	if (!!also + !!only + !!all + !!interactive > 1)
-		die("Only one of --include/--only/--all/--interactive can be used.");
+		die(_("Only one of --include/--only/--all/--interactive can be used."));
 	if (argc == 0 && (also || (only && !amend)))
-		die("No paths with --include/--only does not make sense.");
+		die(_("No paths with --include/--only does not make sense."));
 	if (argc == 0 && only && amend)
-		only_include_assumed = "Clever... amending the last one with dirty index.";
+		only_include_assumed = _("Clever... amending the last one with dirty index.");
 	if (argc > 0 && !also && !only)
-		only_include_assumed = "Explicit paths specified without -i nor -o; assuming --only paths...";
+		only_include_assumed = _("Explicit paths specified without -i nor -o; assuming --only paths...");
 	if (!cleanup_arg || !strcmp(cleanup_arg, "default"))
 		cleanup_mode = use_editor ? CLEANUP_ALL : CLEANUP_SPACE;
 	else if (!strcmp(cleanup_arg, "verbatim"))
@@ -986,14 +986,14 @@ static int parse_and_validate_options(int argc, const char *argv[],
 	else if (!strcmp(cleanup_arg, "strip"))
 		cleanup_mode = CLEANUP_ALL;
 	else
-		die("Invalid cleanup mode %s", cleanup_arg);
+		die(_("Invalid cleanup mode %s"), cleanup_arg);
 
 	handle_untracked_files_arg(s);
 
 	if (all && argc > 0)
-		die("Paths with -a does not make sense.");
+		die(_("Paths with -a does not make sense."));
 	else if (interactive && argc > 0)
-		die("Paths with --interactive does not make sense.");
+		die(_("Paths with --interactive does not make sense."));
 
 	if (null_termination && status_format == STATUS_FORMAT_LONG)
 		status_format = STATUS_FORMAT_PORCELAIN;
@@ -1074,7 +1074,7 @@ static int git_status_config(const char *k, const char *v, void *cb)
 		else if (!strcmp(v, "all"))
 			s->show_untracked_files = SHOW_ALL_UNTRACKED_FILES;
 		else
-			return error("Invalid untracked files mode '%s'", v);
+			return error(_("Invalid untracked files mode '%s'"), v);
 		return 0;
 	}
 	return git_diff_ui_config(k, v, NULL);
@@ -1180,9 +1180,9 @@ static void print_summary(const char *prefix, const unsigned char *sha1)
 
 	commit = lookup_commit(sha1);
 	if (!commit)
-		die("couldn't look up newly created commit");
+		die(_("couldn't look up newly created commit"));
 	if (!commit || parse_commit(commit))
-		die("could not parse newly created commit");
+		die(_("could not parse newly created commit"));
 
 	strbuf_addstr(&format, "format:%h] %s");
 
@@ -1336,7 +1336,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 			reflog_msg = "commit (amend)";
 		commit = lookup_commit(head_sha1);
 		if (!commit || parse_commit(commit))
-			die("could not parse HEAD commit");
+			die(_("could not parse HEAD commit"));
 
 		for (c = commit->parents; c; c = c->next)
 			pptr = &commit_list_insert(c->item, pptr)->next;
@@ -1349,19 +1349,19 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 		pptr = &commit_list_insert(lookup_commit(head_sha1), pptr)->next;
 		fp = fopen(git_path("MERGE_HEAD"), "r");
 		if (fp == NULL)
-			die_errno("could not open '%s' for reading",
+			die_errno(_("could not open '%s' for reading"),
 				  git_path("MERGE_HEAD"));
 		while (strbuf_getline(&m, fp, '\n') != EOF) {
 			unsigned char sha1[20];
 			if (get_sha1_hex(m.buf, sha1) < 0)
-				die("Corrupt MERGE_HEAD file (%s)", m.buf);
+				die(_("Corrupt MERGE_HEAD file (%s)"), m.buf);
 			pptr = &commit_list_insert(lookup_commit(sha1), pptr)->next;
 		}
 		fclose(fp);
 		strbuf_release(&m);
 		if (!stat(git_path("MERGE_MODE"), &statbuf)) {
 			if (strbuf_read_file(&sb, git_path("MERGE_MODE"), 0) < 0)
-				die_errno("could not read MERGE_MODE");
+				die_errno(_("could not read MERGE_MODE"));
 			if (!strcmp(sb.buf, "no-ff"))
 				allow_fast_forward = 0;
 		}
@@ -1378,7 +1378,7 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 	if (strbuf_read_file(&sb, git_path(commit_editmsg), 0) < 0) {
 		int saved_errno = errno;
 		rollback_index_files();
-		die("could not read commit message: %s", strerror(saved_errno));
+		die(_("could not read commit message: %s"), strerror(saved_errno));
 	}
 
 	/* Truncate the message just before the diff, if any. */
@@ -1392,14 +1392,14 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 		stripspace(&sb, cleanup_mode == CLEANUP_ALL);
 	if (message_is_empty(&sb) && !allow_empty_message) {
 		rollback_index_files();
-		fprintf(stderr, "Aborting commit due to empty commit message.\n");
+		fprintf(stderr, _("Aborting commit due to empty commit message.\n"));
 		exit(1);
 	}
 
 	if (commit_tree(sb.buf, active_cache_tree->sha1, parents, commit_sha1,
 			author_ident.buf)) {
 		rollback_index_files();
-		die("failed to write commit object");
+		die(_("failed to write commit object"));
 	}
 	strbuf_release(&author_ident);
 
@@ -1417,11 +1417,11 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 
 	if (!ref_lock) {
 		rollback_index_files();
-		die("cannot lock HEAD ref");
+		die(_("cannot lock HEAD ref"));
 	}
 	if (write_ref_sha1(ref_lock, commit_sha1, sb.buf) < 0) {
 		rollback_index_files();
-		die("cannot update HEAD ref");
+		die(_("cannot update HEAD ref"));
 	}
 
 	unlink(git_path("MERGE_HEAD"));
@@ -1430,9 +1430,9 @@ int cmd_commit(int argc, const char **argv, const char *prefix)
 	unlink(git_path("SQUASH_MSG"));
 
 	if (commit_index_files())
-		die ("Repository has been updated, but unable to write\n"
+		die (_("Repository has been updated, but unable to write\n"
 		     "new_index file. Check that disk is not full or quota is\n"
-		     "not exceeded, and then \"git reset HEAD\" to recover.");
+		     "not exceeded, and then \"git reset HEAD\" to recover."));
 
 	rerere(0);
 	run_hook(get_index_file(), "post-commit", NULL);
-- 
1.7.2.3

Re: [PATCH 01/72] gettext.h: add no-op _() and N_() wrappers

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:50:37

Hi Ævar,

Ævar Arnfjörð Bjarmason wrote:
Add a new header called gettext.h which is currently a no-op.
Thanks.  I'd suggest squashing this with patch #2 (#including
gettext.h in cache.h).
quoted hunk
--- /dev/null
+++ b/gettext.h
@@ -0,0 +1,9 @@
+/*
+ * Copyright (c) 2010 Ævar Arnfjörð Bjarmason
Is such a simple header file copyrightable?  But I don't mind.
+ *
+ * This is a skeleton no-op implementation of gettext for Git. It'll
+ * be replaced by something that uses libintl.h and wraps gettext() in
+ * a future patch series.
+ */
+#define N_(s) (s)
Might be nice to make this an inline function, for type safety.
+#define _(s) (s)
This one can't be a function, though, since it needs to transform
literals to literals.

Some possible tweaks:

 - protect against double inclusion
 - make _ into a function
 - add a comment vaguely explaining N_
 - avoid confusing errors if some other header has pre-defined _.

Signed-off-by: Jonathan Nieder <redacted>
---
 gettext.h |   19 +++++++++++++++++--
 1 files changed, 17 insertions(+), 2 deletions(-)
diff --git a/gettext.h b/gettext.h
index c68bbe9..2f806cb 100644
--- a/gettext.h
+++ b/gettext.h
@@ -1,3 +1,10 @@
+#ifndef GETTEXT_H
+#define GETTEXT_H
+
+#ifdef _
+#error "namespace conflict: '_' is pre-defined?"
+#endif
+
 /*
  * Copyright (c) 2010 Ævar Arnfjörð Bjarmason
  *
@@ -5,5 +12,13 @@
  * be replaced by something that uses libintl.h and wraps gettext() in
  * a future patch series.
  */
-#define N_(s) (s)
-#define _(s) (s)
+
+static inline const char *_(const char *msgid)
+{
+	return msgid;
+}
+
+/* Mark msgid for translation but do not translate it. */
+#define N_(msgid) (msgid)
+
+#endif
-- 
1.7.4.1

Re: [PATCH 03/72] t/test-lib.sh: add always-set NO_GETTEXT_POISON prerequisite

From: Jonathan Nieder <hidden>
Date: 2016-06-15 22:50:37

Hi Ævar,

Ævar Arnfjörð Bjarmason wrote:
Add a new test prerequisite called NO_GETTEXT_POISON to t/test-lib.sh
that's always set for now.
Suppose I am writing a new family of tests.  Which of them will need
the NO_GETTEXT_POISON prerequisite?  The name doesn't make it easy to
guess.

If later the testsuite learns to take a --lang= option to test that
git works correctly in my native language, I'd think this same
prerequisite would be relevant for that, too.  So maybe:

Signed-off-by: Jonathan Nieder <redacted>
---
 t/test-lib.sh |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/t/test-lib.sh b/t/test-lib.sh
index ffcfa2e..32004c1 100644
--- a/t/test-lib.sh
+++ b/t/test-lib.sh
@@ -1079,10 +1079,8 @@ esac
 test -z "$NO_PERL" && test_set_prereq PERL
 test -z "$NO_PYTHON" && test_set_prereq PYTHON
 
-# Always set the NO_GETTEXT_POISON prerequisite while we don't have a
-# real gettext implementation in Git. This will be replaced by
-# something that varies in a future patch series.
-test_set_prereq NO_GETTEXT_POISON
+# We can rely on output using the C locale.
+test_set_prereq ENGLISH
 
 # test whether the filesystem supports symbolic links
 ln -s x y 2>/dev/null && test -h y 2>/dev/null && test_set_prereq SYMLINKS
-- 
1.7.4.1
Next 38 of 38 remaining
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help