mirror of
https://github.com/git/git.git
synced 2024-11-29 04:54:56 +08:00
Merge branch 'ab/i18n'
Fix some constructs that build messages meant for i18n by concatenating pieces of strings. By Ævar Arnfjörð Bjarmason * ab/i18n: git-commit: remove lego in i18n messages git-commit: remove lego in i18n messages git-branch: remove lego in i18n messages
This commit is contained in:
commit
d7c03ca1ea
@ -152,21 +152,22 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
|
|||||||
struct commit *rev, *head_rev = NULL;
|
struct commit *rev, *head_rev = NULL;
|
||||||
unsigned char sha1[20];
|
unsigned char sha1[20];
|
||||||
char *name = NULL;
|
char *name = NULL;
|
||||||
const char *fmt, *remote;
|
const char *fmt;
|
||||||
int i;
|
int i;
|
||||||
int ret = 0;
|
int ret = 0;
|
||||||
|
int remote_branch = 0;
|
||||||
struct strbuf bname = STRBUF_INIT;
|
struct strbuf bname = STRBUF_INIT;
|
||||||
|
|
||||||
switch (kinds) {
|
switch (kinds) {
|
||||||
case REF_REMOTE_BRANCH:
|
case REF_REMOTE_BRANCH:
|
||||||
fmt = "refs/remotes/%s";
|
fmt = "refs/remotes/%s";
|
||||||
/* TRANSLATORS: This is "remote " in "remote branch '%s' not found" */
|
/* For subsequent UI messages */
|
||||||
remote = _("remote ");
|
remote_branch = 1;
|
||||||
|
|
||||||
force = 1;
|
force = 1;
|
||||||
break;
|
break;
|
||||||
case REF_LOCAL_BRANCH:
|
case REF_LOCAL_BRANCH:
|
||||||
fmt = "refs/heads/%s";
|
fmt = "refs/heads/%s";
|
||||||
remote = "";
|
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
die(_("cannot use -a with -d"));
|
die(_("cannot use -a with -d"));
|
||||||
@ -190,8 +191,9 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
|
|||||||
|
|
||||||
name = xstrdup(mkpath(fmt, bname.buf));
|
name = xstrdup(mkpath(fmt, bname.buf));
|
||||||
if (read_ref(name, sha1)) {
|
if (read_ref(name, sha1)) {
|
||||||
error(_("%sbranch '%s' not found."),
|
error(remote_branch
|
||||||
remote, bname.buf);
|
? _("remote branch '%s' not found.")
|
||||||
|
: _("branch '%s' not found."), bname.buf);
|
||||||
ret = 1;
|
ret = 1;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -212,14 +214,18 @@ static int delete_branches(int argc, const char **argv, int force, int kinds,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (delete_ref(name, sha1, 0)) {
|
if (delete_ref(name, sha1, 0)) {
|
||||||
error(_("Error deleting %sbranch '%s'"), remote,
|
error(remote_branch
|
||||||
|
? _("Error deleting remote branch '%s'")
|
||||||
|
: _("Error deleting branch '%s'"),
|
||||||
bname.buf);
|
bname.buf);
|
||||||
ret = 1;
|
ret = 1;
|
||||||
} else {
|
} else {
|
||||||
struct strbuf buf = STRBUF_INIT;
|
struct strbuf buf = STRBUF_INIT;
|
||||||
if (!quiet)
|
if (!quiet)
|
||||||
printf(_("Deleted %sbranch %s (was %s).\n"),
|
printf(remote_branch
|
||||||
remote, bname.buf,
|
? _("Deleted remote branch %s (was %s).\n")
|
||||||
|
: _("Deleted branch %s (was %s).\n"),
|
||||||
|
bname.buf,
|
||||||
find_unique_abbrev(sha1, DEFAULT_ABBREV));
|
find_unique_abbrev(sha1, DEFAULT_ABBREV));
|
||||||
strbuf_addf(&buf, "branch.%s", bname.buf);
|
strbuf_addf(&buf, "branch.%s", bname.buf);
|
||||||
if (git_config_rename_section(buf.buf, NULL) < 0)
|
if (git_config_rename_section(buf.buf, NULL) < 0)
|
||||||
|
@ -194,24 +194,6 @@ static void determine_whence(struct wt_status *s)
|
|||||||
s->whence = whence;
|
s->whence = whence;
|
||||||
}
|
}
|
||||||
|
|
||||||
static const char *whence_s(void)
|
|
||||||
{
|
|
||||||
const char *s = "";
|
|
||||||
|
|
||||||
switch (whence) {
|
|
||||||
case FROM_COMMIT:
|
|
||||||
break;
|
|
||||||
case FROM_MERGE:
|
|
||||||
s = _("merge");
|
|
||||||
break;
|
|
||||||
case FROM_CHERRY_PICK:
|
|
||||||
s = _("cherry-pick");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return s;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void rollback_index_files(void)
|
static void rollback_index_files(void)
|
||||||
{
|
{
|
||||||
switch (commit_style) {
|
switch (commit_style) {
|
||||||
@ -453,8 +435,12 @@ static char *prepare_index(int argc, const char **argv, const char *prefix,
|
|||||||
*/
|
*/
|
||||||
commit_style = COMMIT_PARTIAL;
|
commit_style = COMMIT_PARTIAL;
|
||||||
|
|
||||||
if (whence != FROM_COMMIT)
|
if (whence != FROM_COMMIT) {
|
||||||
die(_("cannot do a partial commit during a %s."), whence_s());
|
if (whence == FROM_MERGE)
|
||||||
|
die(_("cannot do a partial commit during a merge."));
|
||||||
|
else if (whence == FROM_CHERRY_PICK)
|
||||||
|
die(_("cannot do a partial commit during a cherry-pick."));
|
||||||
|
}
|
||||||
|
|
||||||
memset(&partial, 0, sizeof(partial));
|
memset(&partial, 0, sizeof(partial));
|
||||||
partial.strdup_strings = 1;
|
partial.strdup_strings = 1;
|
||||||
@ -796,28 +782,31 @@ static int prepare_to_commit(const char *index_file, const char *prefix,
|
|||||||
char *ai_tmp, *ci_tmp;
|
char *ai_tmp, *ci_tmp;
|
||||||
if (whence != FROM_COMMIT)
|
if (whence != FROM_COMMIT)
|
||||||
status_printf_ln(s, GIT_COLOR_NORMAL,
|
status_printf_ln(s, GIT_COLOR_NORMAL,
|
||||||
_("\n"
|
whence == FROM_MERGE
|
||||||
"It looks like you may be committing a %s.\n"
|
? _("\n"
|
||||||
"If this is not correct, please remove the file\n"
|
"It looks like you may be committing a merge.\n"
|
||||||
" %s\n"
|
"If this is not correct, please remove the file\n"
|
||||||
"and try again.\n"
|
" %s\n"
|
||||||
""),
|
"and try again.\n")
|
||||||
whence_s(),
|
: _("\n"
|
||||||
|
"It looks like you may be committing a cherry-pick.\n"
|
||||||
|
"If this is not correct, please remove the file\n"
|
||||||
|
" %s\n"
|
||||||
|
"and try again.\n"),
|
||||||
git_path(whence == FROM_MERGE
|
git_path(whence == FROM_MERGE
|
||||||
? "MERGE_HEAD"
|
? "MERGE_HEAD"
|
||||||
: "CHERRY_PICK_HEAD"));
|
: "CHERRY_PICK_HEAD"));
|
||||||
|
|
||||||
fprintf(s->fp, "\n");
|
fprintf(s->fp, "\n");
|
||||||
status_printf(s, GIT_COLOR_NORMAL,
|
|
||||||
_("Please enter the commit message for your changes."));
|
|
||||||
if (cleanup_mode == CLEANUP_ALL)
|
if (cleanup_mode == CLEANUP_ALL)
|
||||||
status_printf_more(s, GIT_COLOR_NORMAL,
|
status_printf(s, GIT_COLOR_NORMAL,
|
||||||
_(" Lines starting\n"
|
_("Please enter the commit message for your changes."
|
||||||
"with '#' will be ignored, and an empty"
|
" Lines starting\nwith '#' will be ignored, and an empty"
|
||||||
" message aborts the commit.\n"));
|
" message aborts the commit.\n"));
|
||||||
else /* CLEANUP_SPACE, that is. */
|
else /* CLEANUP_SPACE, that is. */
|
||||||
status_printf_more(s, GIT_COLOR_NORMAL,
|
status_printf(s, GIT_COLOR_NORMAL,
|
||||||
_(" Lines starting\n"
|
_("Please enter the commit message for your changes."
|
||||||
|
" Lines starting\n"
|
||||||
"with '#' will be kept; you may remove them"
|
"with '#' will be kept; you may remove them"
|
||||||
" yourself if you want to.\n"
|
" yourself if you want to.\n"
|
||||||
"An empty message aborts the commit.\n"));
|
"An empty message aborts the commit.\n"));
|
||||||
@ -1072,8 +1061,12 @@ static int parse_and_validate_options(int argc, const char *argv[],
|
|||||||
/* Sanity check options */
|
/* Sanity check options */
|
||||||
if (amend && !current_head)
|
if (amend && !current_head)
|
||||||
die(_("You have nothing to amend."));
|
die(_("You have nothing to amend."));
|
||||||
if (amend && whence != FROM_COMMIT)
|
if (amend && whence != FROM_COMMIT) {
|
||||||
die(_("You are in the middle of a %s -- cannot amend."), whence_s());
|
if (whence == FROM_MERGE)
|
||||||
|
die(_("You are in the middle of a merge -- cannot amend."));
|
||||||
|
else if (whence == FROM_CHERRY_PICK)
|
||||||
|
die(_("You are in the middle of a cherry-pick -- cannot amend."));
|
||||||
|
}
|
||||||
if (fixup_message && squash_message)
|
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)
|
if (use_message)
|
||||||
|
Loading…
Reference in New Issue
Block a user