summaryrefslogtreecommitdiff
path: root/builtin
diff options
context:
space:
mode:
Diffstat (limited to 'builtin')
-rw-r--r--builtin/checkout.c24
-rw-r--r--builtin/clone.c2
-rw-r--r--builtin/diff-tree.c12
-rw-r--r--builtin/diff.c4
-rw-r--r--builtin/init-db.c10
-rw-r--r--builtin/log.c9
-rw-r--r--builtin/merge.c16
7 files changed, 53 insertions, 24 deletions
diff --git a/builtin/checkout.c b/builtin/checkout.c
index eece5d6..38632fc 100644
--- a/builtin/checkout.c
+++ b/builtin/checkout.c
@@ -648,18 +648,30 @@ static void suggest_reattach(struct commit *commit, struct rev_info *revs)
if (more == 1)
describe_one_orphan(&sb, last);
else
- strbuf_addf(&sb, " ... and %d more.\n", more);
+ strbuf_addf(&sb, _(" ... and %d more.\n"), more);
}
fprintf(stderr,
- "Warning: you are leaving %d commit%s behind, "
+ Q_(
+ /* The singular version */
+ "Warning: you are leaving %d commit behind, "
+ "not connected to\n"
+ "any of your branches:\n\n"
+ "%s\n"
+ "If you want to keep it by creating a new branch, "
+ "this may be a good time\nto do so with:\n\n"
+ " git branch new_branch_name %s\n\n",
+ /* The plural version */
+ "Warning: you are leaving %d commits behind, "
"not connected to\n"
"any of your branches:\n\n"
"%s\n"
"If you want to keep them by creating a new branch, "
"this may be a good time\nto do so with:\n\n"
" git branch new_branch_name %s\n\n",
- lost, ((1 < lost) ? "s" : ""),
+ /* Give ngettext() the count */
+ lost),
+ lost,
sb.buf,
sha1_to_hex(commit->object.sha1));
strbuf_release(&sb);
@@ -961,9 +973,9 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
die (_("--patch is incompatible with all other options"));
if (opts.force_detach && (opts.new_branch || opts.new_orphan_branch))
- die("--detach cannot be used with -b/-B/--orphan");
+ die(_("--detach cannot be used with -b/-B/--orphan"));
if (opts.force_detach && 0 < opts.track)
- die("--detach cannot be used with -t");
+ die(_("--detach cannot be used with -t"));
/* --track without -b should DWIM */
if (0 < opts.track && !opts.new_branch) {
@@ -1043,7 +1055,7 @@ int cmd_checkout(int argc, const char **argv, const char *prefix)
}
if (opts.force_detach)
- die("git checkout: --detach does not take a path argument");
+ die(_("git checkout: --detach does not take a path argument"));
if (1 < !!opts.writeout_stage + !!opts.force + !!opts.merge)
die(_("git checkout: --ours/--theirs, --force and --merge are incompatible when\nchecking out of the index."));
diff --git a/builtin/clone.c b/builtin/clone.c
index 8560cf8..f579794 100644
--- a/builtin/clone.c
+++ b/builtin/clone.c
@@ -417,7 +417,7 @@ int cmd_clone(int argc, const char **argv, const char *prefix)
if (path)
repo = xstrdup(absolute_path(repo_name));
else if (!strchr(repo_name, ':'))
- die("repository '%s' does not exist", repo_name);
+ die(_("repository '%s' does not exist"), repo_name);
else
repo = repo_name;
is_local = path && !is_bundle;
diff --git a/builtin/diff-tree.c b/builtin/diff-tree.c
index 0d2a3e9..be6417d 100644
--- a/builtin/diff-tree.c
+++ b/builtin/diff-tree.c
@@ -163,6 +163,9 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
}
if (read_stdin) {
+ int saved_nrl = 0;
+ int saved_dcctc = 0;
+
if (opt->diffopt.detect_rename)
opt->diffopt.setup |= (DIFF_SETUP_USE_SIZE_CACHE |
DIFF_SETUP_USE_CACHE);
@@ -173,9 +176,16 @@ int cmd_diff_tree(int argc, const char **argv, const char *prefix)
fputs(line, stdout);
fflush(stdout);
}
- else
+ else {
diff_tree_stdin(line);
+ if (saved_nrl < opt->diffopt.needed_rename_limit)
+ saved_nrl = opt->diffopt.needed_rename_limit;
+ if (opt->diffopt.degraded_cc_to_c)
+ saved_dcctc = 1;
+ }
}
+ opt->diffopt.degraded_cc_to_c = saved_dcctc;
+ opt->diffopt.needed_rename_limit = saved_nrl;
}
return diff_result_code(&opt->diffopt, 0);
diff --git a/builtin/diff.c b/builtin/diff.c
index 717fa1a..14bd14f 100644
--- a/builtin/diff.c
+++ b/builtin/diff.c
@@ -202,7 +202,6 @@ static void refresh_index_quietly(void)
static int builtin_diff_files(struct rev_info *revs, int argc, const char **argv)
{
- int result;
unsigned int options = 0;
while (1 < argc && argv[1][0] == '-') {
@@ -236,8 +235,7 @@ static int builtin_diff_files(struct rev_info *revs, int argc, const char **argv
perror("read_cache_preload");
return -1;
}
- result = run_diff_files(revs, options);
- return diff_result_code(&revs->diffopt, result);
+ return run_diff_files(revs, options);
}
int cmd_diff(int argc, const char **argv, const char *prefix)
diff --git a/builtin/init-db.c b/builtin/init-db.c
index 7d8ff09..025aa47 100644
--- a/builtin/init-db.c
+++ b/builtin/init-db.c
@@ -319,10 +319,10 @@ int set_git_dir_init(const char *git_dir, const char *real_git_dir,
struct stat st;
if (!exist_ok && !stat(git_dir, &st))
- die("%s already exists", git_dir);
+ die(_("%s already exists"), git_dir);
if (!exist_ok && !stat(real_git_dir, &st))
- die("%s already exists", real_git_dir);
+ die(_("%s already exists"), real_git_dir);
/*
* make sure symlinks are resolved because we'll be
@@ -351,15 +351,15 @@ static void separate_git_dir(const char *git_dir)
else if (S_ISDIR(st.st_mode))
src = git_link;
else
- die("unable to handle file type %d", st.st_mode);
+ die(_("unable to handle file type %d"), st.st_mode);
if (rename(src, git_dir))
- die_errno("unable to move %s to %s", src, git_dir);
+ die_errno(_("unable to move %s to %s"), src, git_dir);
}
fp = fopen(git_link, "w");
if (!fp)
- die("Could not create git link %s", git_link);
+ die(_("Could not create git link %s"), git_link);
fprintf(fp, "gitdir: %s\n", git_dir);
fclose(fp);
}
diff --git a/builtin/log.c b/builtin/log.c
index c6dce9b..55abe07 100644
--- a/builtin/log.c
+++ b/builtin/log.c
@@ -256,6 +256,8 @@ static void finish_early_output(struct rev_info *rev)
static int cmd_log_walk(struct rev_info *rev)
{
struct commit *commit;
+ int saved_nrl = 0;
+ int saved_dcctc = 0;
if (rev->early_output)
setup_early_output(rev);
@@ -286,7 +288,14 @@ static int cmd_log_walk(struct rev_info *rev)
}
free_commit_list(commit->parents);
commit->parents = NULL;
+ if (saved_nrl < rev->diffopt.needed_rename_limit)
+ saved_nrl = rev->diffopt.needed_rename_limit;
+ if (rev->diffopt.degraded_cc_to_c)
+ saved_dcctc = 1;
}
+ rev->diffopt.degraded_cc_to_c = saved_dcctc;
+ rev->diffopt.needed_rename_limit = saved_nrl;
+
if (rev->diffopt.output_format & DIFF_FORMAT_CHECKDIFF &&
DIFF_OPT_TST(&rev->diffopt, CHECK_FAILED)) {
return 02;
diff --git a/builtin/merge.c b/builtin/merge.c
index a437ecb..24445f4 100644
--- a/builtin/merge.c
+++ b/builtin/merge.c
@@ -839,7 +839,7 @@ static void read_merge_msg(void)
{
strbuf_reset(&merge_msg);
if (strbuf_read_file(&merge_msg, git_path("MERGE_MSG"), 0) < 0)
- die_errno("Could not read from '%s'", git_path("MERGE_MSG"));
+ die_errno(_("Could not read from '%s'"), git_path("MERGE_MSG"));
}
static void run_prepare_commit_msg(void)
@@ -979,16 +979,16 @@ static int setup_with_upstream(const char ***argv)
const char **args;
if (!branch)
- die("No current branch.");
+ die(_("No current branch."));
if (!branch->remote)
- die("No remote for the current branch.");
+ die(_("No remote for the current branch."));
if (!branch->merge_nr)
- die("No default upstream defined for the current branch.");
+ die(_("No default upstream defined for the current branch."));
args = xcalloc(branch->merge_nr + 1, sizeof(char *));
for (i = 0; i < branch->merge_nr; i++) {
if (!branch->merge[i]->dst)
- die("No remote tracking branch for %s from %s",
+ die(_("No remote tracking branch for %s from %s"),
branch->merge[i]->src, branch->remote_name);
args[i] = branch->merge[i]->dst;
}
@@ -1062,10 +1062,10 @@ int cmd_merge(int argc, const char **argv, const char *prefix)
}
if (file_exists(git_path("CHERRY_PICK_HEAD"))) {
if (advice_resolve_conflict)
- die("You have not concluded your cherry-pick (CHERRY_PICK_HEAD exists).\n"
- "Please, commit your changes before you can merge.");
+ die(_("You have not concluded your cherry-pick (CHERRY_PICK_HEAD exists).\n"
+ "Please, commit your changes before you can merge."));
else
- die("You have not concluded your cherry-pick (CHERRY_PICK_HEAD exists).");
+ die(_("You have not concluded your cherry-pick (CHERRY_PICK_HEAD exists)."));
}
resolve_undo_clear();