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

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

From
Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
Date
May 8, 2012, 13:38 UTC
Message-ID
<1336484307-31553-1-git-send-email-pclouds@gmail.com>
In-Reply-To
<7vwr4n6fcj.fsf@alter.siamese.dyndns.org>

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@gmail.com>
---
 On Tue, May 8, 2012 at 1:00 AM, Junio C Hamano <gitster@pobox.com> 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
Previous: Junio C HamanoNext: Junio C Hamano
Message 28 of 43 in “i18n relative dates, help, remote, apply, index-pack and bundle”
  1. 00/10 i18n relative dates, help, remote, apply, index-pack and bundleNguyễn Thái Ngọc Duy, Apr 23, 2012
  2. 01/10 Makefile: feed all header files to xgettextNguyễn Thái Ngọc Duy, Apr 23, 2012
  3. 02/10 Add three convenient format printing functions with \n automatically appendedNguyễn Thái Ngọc Duy, Apr 23, 2012
  4. Jonathan NiederApr 23, 2012
  5. 03/10 i18n: mark relative dates for translationNguyễn Thái Ngọc Duy, Apr 23, 2012
  6. Junio C HamanoApr 24, 2012
  7. Nguyen Thai Ngoc DuyApr 25, 2012
  8. Johannes SixtApr 25, 2012
  9. Zbigniew Jędrzejewski-SzmekApr 25, 2012
  10. Nguyen Thai Ngoc DuyApr 25, 2012
  11. Jonathan NiederApr 25, 2012
  12. Junio C HamanoApr 25, 2012
  13. Jonathan NiederApr 25, 2012
  14. 04/10 i18n: help: mark strings for translationNguyễn Thái Ngọc Duy, Apr 23, 2012
  15. Jonathan NiederApr 23, 2012
  16. Junio C HamanoApr 23, 2012
  17. Jonathan NiederApr 23, 2012
  18. help: replace underlining "help -a" headers using hyphens with a blank lineNguyễn Thái Ngọc Duy, Apr 25, 2012
  19. Junio C HamanoApr 25, 2012
  20. 05/10 i18n: make warn_dangling_symref() automatically append \nNguyễn Thái Ngọc Duy, Apr 23, 2012
  21. 06/10 i18n: remote: mark strings for translationNguyễn Thái Ngọc Duy, Apr 23, 2012
  22. Junio C HamanoApr 25, 2012
  23. Nguyen Thai Ngoc DuyApr 26, 2012
  24. 07/10 i18n: apply: mark strings for translationNguyễn Thái Ngọc Duy, Apr 23, 2012
  25. Junio C HamanoApr 25, 2012
  26. apply: remove lego in i18n string in gitdiff_verify_nameNguyễn Thái Ngọc Duy, May 6, 2012
  27. Junio C HamanoMay 7, 2012
  28. apply: remove lego in i18n string in gitdiff_verify_nameNguyễn Thái Ngọc Duy, May 8, 2012
  29. Junio C HamanoMay 8, 2012
  30. apply: remove lego in i18n string in gitdiff_verify_nameNguyễn Thái Ngọc Duy, May 9, 2012
  31. 08/10 i18n: apply: update say_patch_name to give translators complete sentenceNguyễn Thái Ngọc Duy, Apr 23, 2012
  32. 09/10 i18n: index-pack: mark strings for translationNguyễn Thái Ngọc Duy, Apr 23, 2012
  33. 10/10 i18n: bundle: mark strings for translationNguyễn Thái Ngọc Duy, Apr 23, 2012
  34. Junio C HamanoApr 25, 2012
  35. Nguyen Thai Ngoc DuyApr 26, 2012
  36. bundle: remove stray single-quote from error messageJonathan Nieder, Apr 26, 2012
  37. Jonathan NiederApr 23, 2012
  38. Junio C HamanoApr 23, 2012
  39. Ævar Arnfjörð BjarmasonApr 23, 2012
  40. Nguyen Thai Ngoc DuyApr 24, 2012
  41. Junio C HamanoApr 24, 2012
  42. Nguyen Thai Ngoc DuyApr 25, 2012
  43. Jonathan NiederApr 25, 2012

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

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