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 and what grammatical form it may use. Make it two strings "...inconsistent new filename..." and "...inconsistent old filename..." Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@xxxxxxxxx> --- Another try. enum this time. builtin/apply.c | 17 +++++++++++++---- 1 files changed, 13 insertions(+), 4 deletions(-) diff --git a/builtin/apply.c b/builtin/apply.c index 725712d..3362f4a 100644 --- a/builtin/apply.c +++ b/builtin/apply.c @@ -910,6 +910,11 @@ static int gitdiff_hdrend(const char *line, struct patch *patch) return -1; } +enum diff_filename { + DIFF_OLD, + DIFF_NEW +}; + /* * We're anal about diff header consistency, to make * sure that we don't end up having strange ambiguous @@ -919,7 +924,8 @@ 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, + enum diff_filename oldnew) { if (!orig_name && !isnull) return find_name(line, NULL, p_value, TERM_TAB); @@ -934,7 +940,10 @@ static char *gitdiff_verify_name(const char *line, int isnull, char *orig_name, 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); + die(oldnew == DIFF_OLD ? + _("git apply: bad git-diff - inconsistent old filename on line %d") : + _("git apply: bad git-diff - inconsistent new filename on line %d"), + linenr); free(another); return orig_name; } @@ -949,7 +958,7 @@ static char *gitdiff_verify_name(const char *line, int isnull, char *orig_name, static int gitdiff_oldname(const char *line, struct patch *patch) { char *orig = patch->old_name; - patch->old_name = gitdiff_verify_name(line, patch->is_new, patch->old_name, "old"); + patch->old_name = gitdiff_verify_name(line, patch->is_new, patch->old_name, DIFF_OLD); if (orig != patch->old_name) free(orig); return 0; @@ -958,7 +967,7 @@ static int gitdiff_oldname(const char *line, struct patch *patch) static int gitdiff_newname(const char *line, struct patch *patch) { char *orig = patch->new_name; - patch->new_name = gitdiff_verify_name(line, patch->is_delete, patch->new_name, "new"); + patch->new_name = gitdiff_verify_name(line, patch->is_delete, patch->new_name, DIFF_NEW); if (orig != patch->new_name) free(orig); return 0; -- 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