From: "Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
To: git@vger.kernel.org
Cc: "Junio C Hamano" <gitster@pobox.com>,
"Jonathan Niedier" <jrnieder@gmail.com>,
"Ævar Arnfjörð Bjarmason" <avarab@gmail.com>,
"Jiang Xin" <worldhello.net@gmail.com>,
"Nguyễn Thái Ngọc Duy" <pclouds@gmail.com>
Subject: [PATCH 3/6] merge-recursive: remove i18n legos in conflict messages
Date: Thu, 7 Jun 2012 19:05:12 +0700 [thread overview]
Message-ID: <1339070715-31417-3-git-send-email-pclouds@gmail.com> (raw)
In-Reply-To: <1339070715-31417-1-git-send-email-pclouds@gmail.com>
Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com>
---
The two sentence strings are broken down to one sentence each. Less work for
translators when these are marked i18n.
merge-recursive.c | 60 ++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 44 insertions(+), 16 deletions(-)
diff --git a/merge-recursive.c b/merge-recursive.c
index 680937c..1f16e04 100644
--- a/merge-recursive.c
+++ b/merge-recursive.c
@@ -1018,9 +1018,28 @@ static void handle_change_delete(struct merge_options *o,
const unsigned char *o_sha, int o_mode,
const unsigned char *a_sha, int a_mode,
const unsigned char *b_sha, int b_mode,
- const char *change, const char *change_past)
+ const char *change)
{
char *renamed = NULL;
+ struct strbuf sb = STRBUF_INIT;
+ int idx;
+
+ const char *msg[] = {
+ "CONFLICT (rename/delete): %s deleted in %s and renamed in %s.",
+ "CONFLICT (modify/delete): %s deleted in %s and modified in %s.",
+ };
+ const char *renamed_msg[] = {
+ "CONFLICT (rename/delete): %s deleted in %s and renamed in %s.",
+ "CONFLICT (modify/delete): %s deleted in %s and modified in %s.",
+ };
+
+ if (!strcmp(change, "rename"))
+ idx = 0;
+ else if (!strcmp(change, "modify"))
+ idx = 1;
+ else
+ die("BUG: unsupport action %s", change);
+
if (dir_in_way(path, !o->call_depth)) {
renamed = unique_path(o, path, a_sha ? o->branch1 : o->branch2);
}
@@ -1034,22 +1053,30 @@ static void handle_change_delete(struct merge_options *o,
remove_file_from_cache(path);
update_file(o, 0, o_sha, o_mode, renamed ? renamed : path);
} else if (!a_sha) {
- output(o, 1, "CONFLICT (%s/delete): %s deleted in %s "
- "and %s in %s. Version %s of %s left in tree%s%s.",
- change, path, o->branch1,
- change_past, o->branch2, o->branch2, path,
- NULL == renamed ? "" : " at ",
- NULL == renamed ? "" : renamed);
+ if (renamed) {
+ strbuf_addf(&sb, renamed_msg[idx], path, o->branch1, o->branch2);
+ strbuf_addf(&sb, " Version %s of %s left in tree at %s.",
+ o->branch2, path, renamed);
+ } else {
+ strbuf_addf(&sb, msg[idx], path, o->branch1, o->branch2);
+ strbuf_addf(&sb, " Version %s of %s left in tree.",
+ o->branch2, path);
+ }
+ output(o, 1, "%s", sb.buf);
+
update_file(o, 0, b_sha, b_mode, renamed ? renamed : path);
} else {
- output(o, 1, "CONFLICT (%s/delete): %s deleted in %s "
- "and %s in %s. Version %s of %s left in tree%s%s.",
- change, path, o->branch2,
- change_past, o->branch1, o->branch1, path,
- NULL == renamed ? "" : " at ",
- NULL == renamed ? "" : renamed);
- if (renamed)
+ if (renamed) {
+ strbuf_addf(&sb, renamed_msg[idx], path, o->branch2, o->branch1);
+ strbuf_addf(&sb, " Version %s of %s left in tree at %s.",
+ o->branch2, path, renamed);
update_file(o, 0, a_sha, a_mode, renamed);
+ } else {
+ strbuf_addf(&sb, msg[idx], path, o->branch2, o->branch1);
+ strbuf_addf(&sb, " Version %s of %s left in tree.",
+ o->branch2, path);
+ }
+ output(o, 1, "%s", sb.buf);
/*
* No need to call update_file() on path when !renamed, since
* that would needlessly touch path. We could call
@@ -1058,6 +1085,7 @@ static void handle_change_delete(struct merge_options *o,
*/
}
free(renamed);
+ strbuf_release(&sb);
}
static void conflict_rename_delete(struct merge_options *o,
@@ -1085,7 +1113,7 @@ static void conflict_rename_delete(struct merge_options *o,
orig->sha1, orig->mode,
a_sha, a_mode,
b_sha, b_mode,
- "rename", "renamed");
+ "rename");
if (o->call_depth) {
remove_file_from_cache(dest->path);
@@ -1568,7 +1596,7 @@ static void handle_modify_delete(struct merge_options *o,
o_sha, o_mode,
a_sha, a_mode,
b_sha, b_mode,
- "modify", "modified");
+ "modify");
}
static int merge_content(struct merge_options *o,
--
1.7.8
next prev parent reply other threads:[~2012-06-07 12:10 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <0001-Remove-i18n-legos-in-notifying-new-branch-tracking-s.patch>
2012-06-07 12:05 ` [PATCH 1/6] Remove i18n legos in notifying new branch tracking setup Nguyễn Thái Ngọc Duy
2012-06-07 12:05 ` [PATCH 2/6] reflog: remove i18n legos in pruning message Nguyễn Thái Ngọc Duy
2012-06-07 12:05 ` Nguyễn Thái Ngọc Duy [this message]
2012-06-07 12:05 ` [PATCH 4/6] notes-merge: remove i18n legos in merge result message Nguyễn Thái Ngọc Duy
2012-06-07 12:05 ` [PATCH 5/6] rerere: remove i18n legos in " Nguyễn Thái Ngọc Duy
2012-06-07 12:05 ` [PATCH 6/6] unpack-trees: remove i18n legos in unpack's porcelain error messages Nguyễn Thái Ngọc Duy
2012-06-07 18:44 ` [PATCH 1/6] Remove i18n legos in notifying new branch tracking setup Junio C Hamano
2012-05-31 11:20 [PATCH] i18n: apply: split to fix a partial i18n message Jiang Xin
2012-05-31 13:04 ` Nguyễn Thái Ngọc Duy
2012-05-31 13:04 ` [PATCH 3/6] merge-recursive: remove i18n legos in conflict messages Nguyễn Thái Ngọc Duy
2012-05-31 13:52 ` Jonathan Nieder
2012-05-31 13:56 ` Nguyen Thai Ngoc Duy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1339070715-31417-3-git-send-email-pclouds@gmail.com \
--to=pclouds@gmail.com \
--cc=avarab@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=jrnieder@gmail.com \
--cc=worldhello.net@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).