[PATCH] apply: remove lego in i18n string in gitdiff_verify_name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently it marks the string "...inconsistent %s filename..." where
%s is either "old" or "new" from caller. From a translator point of
view, nothing hints what "%s" may be. Make it two strings
"...inconsistent new filename..." and "...inconsistent old
filename..."

Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx>
---
 On Tue, May 8, 2012 at 1:00 AM, Junio C Hamano <gitster@xxxxxxxxx> wrote:
 >> diff --git a/builtin/apply.c b/builtin/apply.c
 >> index 725712d..1edd3f7 100644
 >> --- a/builtin/apply.c
 >> +++ b/builtin/apply.c
 >> @@ -919,7 +919,7 @@ static int gitdiff_hdrend(const char *line, struct patch *patch)
 >>   * their names against any previous information, just
 >>   * to make sure..
 >>   */
 >> -static char *gitdiff_verify_name(const char *line, int isnull, char *orig_name, const char *oldnew)
 >> +static char *gitdiff_verify_name(const char *line, int isnull, char *orig_name, int new)
 >>  {
 >
 > This change is unwarranted, though.  The callers were much clearer when
 > they passed "old" vs "new"; now they pass an unexplained 0 vs 1.

 Hmm.. how about this?

 builtin/apply.c |   11 +++++++++--
 1 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/builtin/apply.c b/builtin/apply.c
index 725712d..92ba925 100644
--- a/builtin/apply.c
+++ b/builtin/apply.c
@@ -933,8 +933,15 @@ static char *gitdiff_verify_name(const char *line, int isnull, char *orig_name,
 		if (isnull)
 			die(_("git apply: bad git-diff - expected /dev/null, got %s on line %d"), name, linenr);
 		another = find_name(line, NULL, p_value, TERM_TAB);
-		if (!another || memcmp(another, name, len + 1))
-			die(_("git apply: bad git-diff - inconsistent %s filename on line %d"), oldnew, linenr);
+		if (!another || memcmp(another, name, len + 1)) {
+			if (!strcmp(oldnew, "old"))
+				die(_("git apply: bad git-diff - inconsistent old filename on line %d"), linenr);
+			else if (!strcmp(oldnew, "new"))
+				die(_("git apply: bad git-diff - inconsistent new filename on line %d"), linenr);
+			else
+				die("BUG: please add a new full string for '%s' similar to above code.\n"
+				    "It makes translators' life much simpler. Thanks!", oldnew);
+		}
 		free(another);
 		return orig_name;
 	}
-- 
1.7.8.36.g69ee2

--
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]