From: Junio C Hamano Date: Mon, 31 Jan 2011 03:03:20 +0000 (-0800) Subject: Merge branch 'ab/i18n' into pu X-Git-Tag: ko-pu~10 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=787bb21c4fbc09f831907fc455445cb18b2f2983;p=git.git Merge branch 'ab/i18n' into pu * ab/i18n: (161 commits) po/de.po: complete German translation po/sv.po: add Swedish translation gettextize: git-bisect bisect_next_check "You need to" message gettextize: git-bisect [Y/n] messages gettextize: git-bisect bisect_replay + $1 messages gettextize: git-bisect bisect_reset + $1 messages gettextize: git-bisect bisect_run + $@ messages gettextize: git-bisect die + eval_gettext messages gettextize: git-bisect die + gettext messages gettextize: git-bisect echo + eval_gettext message gettextize: git-bisect echo + gettext messages gettextize: git-bisect gettext + echo message gettextize: git-bisect add git-sh-i18n gettextize: git-stash drop_stash say/die messages gettextize: git-stash "unknown option" message gettextize: git-stash die + eval_gettext $1 messages gettextize: git-stash die + eval_gettext $* messages gettextize: git-stash die + eval_gettext messages gettextize: git-stash die + gettext messages gettextize: git-stash say + gettext messages ... Conflicts: Documentation/CodingGuidelines Makefile builtin/clean.c builtin/commit.c builtin/describe.c builtin/grep.c builtin/init-db.c builtin/merge.c builtin/notes.c builtin/revert.c fast-import.c git-bisect.sh git-pull.sh git-submodule.sh t/t3501-revert-cherry-pick.sh t/t7004-tag.sh wt-status.c --- 787bb21c4fbc09f831907fc455445cb18b2f2983 diff --cc Documentation/CodingGuidelines index ba2006d89,93fac9127..2ed232983 --- a/Documentation/CodingGuidelines +++ b/Documentation/CodingGuidelines @@@ -144,54 -144,5 +148,57 @@@ For C programs - When we pass pair to functions, we should try to pass them in that order. + - Use Git's gettext wrappers to make the user interface + translatable. See "Marking strings for translation" in po/README. ++ +Writing Documentation: + + Every user-visible change should be reflected in the documentation. + The same general rule as for code applies -- imitate the existing + conventions. A few commented examples follow to provide reference + when writing or modifying command usage strings and synopsis sections + in the manual pages: + + Placeholders are enclosed in angle brackets: + + --sort= + --abbrev[=] + + Possibility of multiple occurrences is indicated by three dots: + ... + (One or more of .) + + Optional parts are enclosed in square brackets: + [] + (Zero or one .) + + --exec-path[=] + (Option with an optional argument. Note that the "=" is inside the + brackets.) + + [...] + (Zero or more of . Note that the dots are inside, not + outside the brackets.) + + Multiple alternatives are indicated with vertical bar: + [-q | --quiet] + [--utf8 | --no-utf8] + + Parentheses are used for grouping: + [(|)...] + (Any number of either or . Parens are needed to make + it clear that "..." pertains to both and .) + + [(-p )...] + (Any number of option -p, each with one argument.) + + git remote set-head (-a | -d | ) + (One and only one of "-a", "-d" or "" _must_ (no square + brackets) be provided.) + + And a somewhat more contrived example: + --diff-filter=[(A|C|D|M|R|T|U|X|B)...[*]] + Here "=" is outside the brackets, because "--diff-filter=" is a + valid usage. "*" has its own pair of brackets, because it can + (optionally) be specified only when one or more of the letters is + also provided. diff --cc Makefile index 89c72aca1,e1650baa2..7b0245345 --- a/Makefile +++ b/Makefile @@@ -863,7 -896,9 +913,10 @@@ ifeq ($(uname_S),SunOS NO_MKDTEMP = YesPlease NO_MKSTEMPS = YesPlease NO_REGEX = YesPlease + NO_FNMATCH_CASEFOLD = YesPlease + ifndef NO_GETTEXT + GNU_GETTEXT = + endif ifeq ($(uname_R),5.6) SOCKLEN_T = int NO_HSTRERROR = YesPlease diff --cc builtin/add.c index 5f817ad77,eed37bfed..ac9a5b4a4 --- a/builtin/add.c +++ b/builtin/add.c @@@ -447,11 -446,10 +447,11 @@@ int cmd_add(int argc, const char **argv if (!seen[i] && pathspec[i][0] && !file_exists(pathspec[i])) { if (ignore_missing) { - if (excluded(&dir, pathspec[i], DT_UNKNOWN)) + int dtype = DT_UNKNOWN; + if (excluded(&dir, pathspec[i], &dtype)) dir_add_ignored(&dir, pathspec[i], strlen(pathspec[i])); } else - die("pathspec '%s' did not match any files", + die(_("pathspec '%s' did not match any files"), pathspec[i]); } } diff --cc builtin/checkout.c index 0ca8f6a20,dd6f3b92a..054f36341 --- a/builtin/checkout.c +++ b/builtin/checkout.c @@@ -836,24 -835,21 +839,24 @@@ int cmd_checkout(int argc, const char * argc--; new.name = arg; - if ((new.commit = lookup_commit_reference_gently(rev, 1))) { - setup_branch_path(&new); + setup_branch_path(&new); - if ((check_ref_format(new.path) == CHECK_REF_FORMAT_OK) && - resolve_ref(new.path, rev, 1, NULL)) - ; - else - new.path = NULL; + if (check_ref_format(new.path) == CHECK_REF_FORMAT_OK && + resolve_ref(new.path, branch_rev, 1, NULL)) + hashcpy(rev, branch_rev); + else + new.path = NULL; /* not an existing branch */ + + if (!(new.commit = lookup_commit_reference_gently(rev, 1))) { + /* not a commit */ + source_tree = parse_tree_indirect(rev); + } else { parse_commit(new.commit); source_tree = new.commit->tree; - } else - source_tree = parse_tree_indirect(rev); + } if (!source_tree) /* case (1): want a tree */ - die("reference is not a tree: %s", arg); + die(_("reference is not a tree: %s"), arg); if (!has_dash_dash) {/* case (3 -> 1) */ /* * Do not complain the most common case diff --cc builtin/clean.c index 4a312abc6,52ec17a83..75697f711 --- a/builtin/clean.c +++ b/builtin/clean.c @@@ -150,10 -155,10 +155,10 @@@ int cmd_clean(int argc, const char **ar } else if (remove_directories || (matches == MATCHED_EXACTLY)) { if (!quiet) - printf("Removing %s\n", qname); + printf(_("Removing %s\n"), qname); if (remove_dir_recursively(&directory, rm_flags) != 0) { - warning("failed to remove %s", qname); - warning(_("failed to remove '%s'"), qname); ++ warning(_("failed to remove %s"), qname); errors++; } } else if (show_only) { @@@ -167,13 -172,13 +172,13 @@@ continue; qname = quote_path_relative(ent->name, -1, &buf, prefix); if (show_only) { - printf("Would remove %s\n", qname); + printf(_("Would remove %s\n"), qname); continue; } else if (!quiet) { - printf("Removing %s\n", qname); + printf(_("Removing %s\n"), qname); } if (unlink(ent->name) != 0) { - warning("failed to remove %s", qname); - warning(_("failed to remove '%s'"), qname); ++ warning(_("failed to remove %s"), qname); errors++; } } diff --cc builtin/commit.c index 03cff5af6,0252dad4f..b6f9b679f --- a/builtin/commit.c +++ b/builtin/commit.c @@@ -45,14 -45,14 +45,14 @@@ N_("Your name and email address were co " git config --global user.name \"Your Name\"\n" " git config --global user.email you@example.com\n" "\n" -"If the identity used for this commit is wrong, you can fix it with:\n" +"After doing this, you may fix the identity used for this commit with:\n" "\n" - " git commit --amend --reset-author\n"; -" git commit --amend --author='Your Name '\n"); ++" git commit --amend --reset-author\n"); static const char empty_amend_advice[] = - "You asked to amend the most recent commit, but doing so would make\n" + N_("You asked to amend the most recent commit, but doing so would make\n" "it empty. You can repeat your command with --allow-empty, or you can\n" - "remove the commit entirely with \"git reset HEAD^\".\n"; + "remove the commit entirely with \"git reset HEAD^\".\n"); static unsigned char head_sha1[20]; @@@ -616,19 -586,9 +616,19 @@@ static int prepare_to_commit(const cha strbuf_add(&sb, buffer + 2, strlen(buffer + 2)); hook_arg1 = "commit"; hook_arg2 = use_message; + } else if (fixup_message) { + struct pretty_print_context ctx = {0}; + struct commit *commit; + commit = lookup_commit_reference_by_name(fixup_message); + if (!commit) + die("could not lookup commit %s", fixup_message); + ctx.output_encoding = get_commit_output_encoding(); + format_commit_message(commit, "fixup! %s\n\n", + &sb, &ctx); + hook_arg1 = "message"; } else if (!stat(git_path("MERGE_MSG"), &statbuf)) { if (strbuf_read_file(&sb, git_path("MERGE_MSG"), 0) < 0) - die_errno("could not read MERGE_MSG"); + die_errno(_("could not read MERGE_MSG")); hook_arg1 = "merge"; } else if (!stat(git_path("SQUASH_MSG"), &statbuf)) { if (strbuf_read_file(&sb, git_path("SQUASH_MSG"), 0) < 0) @@@ -647,19 -607,9 +647,19 @@@ else if (in_merge) hook_arg1 = "merge"; + if (squash_message) { + /* + * If squash_commit was used for the commit subject, + * then we're possibly hijacking other commit log options. + * Reset the hook args to tell the real story. + */ + hook_arg1 = "message"; + hook_arg2 = ""; + } + fp = fopen(git_path(commit_editmsg), "w"); if (fp == NULL) - die_errno("could not open '%s'", git_path(commit_editmsg)); + die_errno(_("could not open '%s'"), git_path(commit_editmsg)); if (cleanup_mode != CLEANUP_NONE) stripspace(&sb, 0); @@@ -687,16 -637,17 +687,16 @@@ strbuf_release(&sb); - determine_author_info(); + /* This checks and barfs if author is badly specified */ + determine_author_info(author_ident); /* This checks if committer ident is explicitly given */ - git_committer_info(0); + strbuf_addstr(&committer_ident, git_committer_info(0)); if (use_editor && include_status) { - char *author_ident; - const char *committer_ident; - + char *ai_tmp, *ci_tmp; if (in_merge) fprintf(fp, - "#\n" + _("#\n" "# It looks like you may be committing a MERGE.\n" "# If this is not correct, please remove the file\n" "# %s\n" @@@ -721,21 -672,23 +721,21 @@@ if (only_include_assumed) fprintf(fp, "# %s\n", only_include_assumed); - author_ident = xstrdup(fmt_name(author_name, author_email)); - committer_ident = fmt_name(getenv("GIT_COMMITTER_NAME"), - getenv("GIT_COMMITTER_EMAIL")); - if (strcmp(author_ident, committer_ident)) + ai_tmp = cut_ident_timestamp_part(author_ident->buf); + ci_tmp = cut_ident_timestamp_part(committer_ident.buf); + if (strcmp(author_ident->buf, committer_ident.buf)) fprintf(fp, - "%s" - "# Author: %s\n", + _("%s" + "# Author: %s\n"), ident_shown++ ? "" : "#\n", - author_ident); - free(author_ident); + author_ident->buf); if (!user_ident_sufficiently_given()) fprintf(fp, - "%s" - "# Committer: %s\n", + _("%s" + "# Committer: %s\n"), ident_shown++ ? "" : "#\n", - committer_ident); + committer_ident.buf); if (ident_shown) fprintf(fp, "#\n"); @@@ -912,9 -861,9 +912,9 @@@ static int parse_and_validate_options(i force_author = find_author_by_nickname(force_author); if (force_author && renew_authorship) - die("Using both --reset-author and --author does not make sense"); + die(_("Using both --reset-author and --author does not make sense")); - if (logfile || message.len || use_message) + if (logfile || message.len || use_message || fixup_message) use_editor = 0; if (edit_flag) use_editor = 1; @@@ -926,11 -875,10 +926,11 @@@ /* Sanity check options */ if (amend && initial_commit) - die("You have nothing to amend."); + die(_("You have nothing to amend.")); if (amend && in_merge) - die("You are in the middle of a merge -- cannot amend."); + die(_("You are in the middle of a merge -- cannot amend.")); - + 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) f++; if (edit_message) @@@ -940,24 -886,40 +940,24 @@@ if (logfile) f++; if (f > 1) - die("Only one of -c/-C/-F/--fixup can be used."); - die(_("Only one of -c/-C/-F can be used.")); ++ die(_("Only one of -c/-C/-F/--fixup can be used.")); if (message.len && f > 0) - die("Option -m cannot be combined with -c/-C/-F/--fixup."); - die(_("Option -m cannot be combined with -c/-C/-F.")); ++ die(_("Option -m cannot be combined with -c/-C/-F/--fixup.")); if (edit_message) use_message = edit_message; - if (amend && !use_message) + if (amend && !use_message && !fixup_message) use_message = "HEAD"; if (!use_message && renew_authorship) - die("--reset-author can be used only with -C, -c or --amend."); + die(_("--reset-author can be used only with -C, -c or --amend.")); if (use_message) { - unsigned char sha1[20]; - static char utf8[] = "UTF-8"; const char *out_enc; - char *enc, *end; struct commit *commit; - if (get_sha1(use_message, sha1)) + commit = lookup_commit_reference_by_name(use_message); + if (!commit) - die("could not lookup commit %s", use_message); + die(_("could not lookup commit %s"), use_message); - commit = lookup_commit_reference(sha1); - if (!commit || parse_commit(commit)) - die(_("could not parse commit %s"), use_message); - - enc = strstr(commit->buffer, "\nencoding"); - if (enc) { - end = strchr(enc + 10, '\n'); - enc = xstrndup(enc + 10, end - (enc + 10)); - } else { - enc = utf8; - } - out_enc = git_commit_encoding ? git_commit_encoding : utf8; - - if (strcmp(out_enc, enc)) - use_message_buffer = - reencode_string(commit->buffer, out_enc, enc); + out_enc = get_commit_output_encoding(); + use_message_buffer = logmsg_reencode(commit, out_enc); /* * If we failed to reencode the buffer, just copy it @@@ -1397,11 -1352,11 +1397,11 @@@ int cmd_commit(int argc, const char **a } if (commit_tree(sb.buf, active_cache_tree->sha1, parents, commit_sha1, - fmt_ident(author_name, author_email, author_date, - IDENT_ERROR_ON_NO_NAME))) { + author_ident.buf)) { rollback_index_files(); - die("failed to write commit object"); + die(_("failed to write commit object")); } + strbuf_release(&author_ident); ref_lock = lock_any_ref_for_update("HEAD", initial_commit ? NULL : head_sha1, diff --cc builtin/describe.c index 342129fdb,616d405ef..037691e3d --- a/builtin/describe.c +++ b/builtin/describe.c @@@ -264,12 -235,12 +264,12 @@@ static void describe(const char *arg, i unsigned int unannotated_cnt = 0; if (get_sha1(arg, sha1)) - die("Not a valid object name %s", arg); + die(_("Not a valid object name %s"), arg); cmit = lookup_commit_reference(sha1); if (!cmit) - die("%s is not a valid '%s' object", arg, commit_type); + die(_("%s is not a valid '%s' object"), arg, commit_type); - n = cmit->util; + n = find_commit_name(cmit->object.sha1); if (n && (tags || all || n->prio == 2)) { /* * Exact match to an existing ref. @@@ -284,15 -255,10 +284,15 @@@ } if (!max_candidates) - die("no tag exactly matches '%s'", sha1_to_hex(cmit->object.sha1)); + die(_("no tag exactly matches '%s'"), sha1_to_hex(cmit->object.sha1)); if (debug) - fprintf(stderr, "searching to describe %s\n", arg); + fprintf(stderr, _("searching to describe %s\n"), arg); + if (!have_util) { + for_each_hash(&names, set_util); + have_util = 1; + } + list = NULL; cmit->object.flags = SEEN; commit_list_insert(cmit, &list); @@@ -452,10 -418,9 +452,10 @@@ int cmd_describe(int argc, const char * return cmd_name_rev(i + argc, args, prefix); } - for_each_ref(get_name, NULL); - if (!found_names && !always) + init_hash(&names); + for_each_rawref(get_name, NULL); + if (!names.nr && !always) - die("No names found, cannot describe anything."); + die(_("No names found, cannot describe anything.")); if (argc == 0) { if (dirty && !cmd_diff_index(ARRAY_SIZE(diff_index_args) - 1, diff_index_args, prefix)) diff --cc builtin/diff.c index d12de8f39,3ae571519..3cefb872e --- a/builtin/diff.c +++ b/builtin/diff.c @@@ -369,12 -369,16 +369,12 @@@ int cmd_diff(int argc, const char **arg continue; } - die("unhandled object '%s' given.", name); + die(_("unhandled object '%s' given."), name); } - if (rev.prune_data) { - const char **pathspec = rev.prune_data; - while (*pathspec) { - if (!path) - path = *pathspec; - paths++; - pathspec++; - } + if (rev.prune_data.nr) { + if (!path) + path = rev.prune_data.items[0].match; + paths += rev.prune_data.nr; } /* diff --cc builtin/grep.c index c3af8760c,3a57b4c8c..dcbc7a936 --- a/builtin/grep.c +++ b/builtin/grep.c @@@ -549,16 -668,12 +549,16 @@@ static int grep_tree(struct grep_opt *o data = lock_and_read_sha1_file(entry.sha1, &type, &size); if (!data) - die("unable to read tree (%s)", + die(_("unable to read tree (%s)"), sha1_to_hex(entry.sha1)); + + strbuf_addch(base, '/'); init_tree_desc(&sub, data, size); - hit |= grep_tree(opt, paths, &sub, tree_name, down); + hit |= grep_tree(opt, pathspec, &sub, base, tn_len); free(data); } + strbuf_setlen(base, old_baselen); + if (hit && opt->status_only) break; } @@@ -580,24 -694,16 +580,24 @@@ static int grep_object(struct grep_opt data = read_object_with_reference(obj->sha1, tree_type, &size, NULL); if (!data) - die("unable to read tree (%s)", sha1_to_hex(obj->sha1)); + die(_("unable to read tree (%s)"), sha1_to_hex(obj->sha1)); + + len = name ? strlen(name) : 0; + strbuf_init(&base, PATH_MAX + len + 1); + if (len) { + strbuf_add(&base, name, len); + strbuf_addch(&base, ':'); + } init_tree_desc(&tree, data, size); - hit = grep_tree(opt, paths, &tree, name, ""); + hit = grep_tree(opt, pathspec, &tree, &base, base.len); + strbuf_release(&base); free(data); return hit; } - die("unable to grep from object of type %s", typename(obj->type)); + die(_("unable to grep from object of type %s"), typename(obj->type)); } -static int grep_objects(struct grep_opt *opt, const char **paths, +static int grep_objects(struct grep_opt *opt, const struct pathspec *pathspec, const struct object_array *list) { unsigned int i; @@@ -958,12 -1063,9 +958,12 @@@ int cmd_grep(int argc, const char **arg paths[0] = prefix; paths[1] = NULL; } + init_pathspec(&pathspec, paths); + pathspec.max_depth = opt.max_depth; + pathspec.recursive = 1; if (show_in_pager && (cached || list.nr)) - die("--open-files-in-pager only works on the worktree"); + die(_("--open-files-in-pager only works on the worktree")); if (show_in_pager && opt.pattern_list && !opt.pattern_list->next) { const char *pager = path_list.items[0].string; @@@ -988,19 -1090,19 +988,19 @@@ if (!use_index) { if (cached) - die("--cached cannot be used with --no-index."); + die(_("--cached cannot be used with --no-index.")); if (list.nr) - die("--no-index cannot be used with revs."); + die(_("--no-index cannot be used with revs.")); - hit = grep_directory(&opt, paths); + hit = grep_directory(&opt, &pathspec); } else if (!list.nr) { if (!cached) setup_work_tree(); - hit = grep_cache(&opt, paths, cached); + hit = grep_cache(&opt, &pathspec, cached); } else { if (cached) - die("both --cached and trees are given."); + die(_("both --cached and trees are given.")); - hit = grep_objects(&opt, paths, &list); + hit = grep_objects(&opt, &pathspec, &list); } if (use_threads) diff --cc builtin/init-db.c index e3af9eaa8,28e20f960..95387b70f --- a/builtin/init-db.c +++ b/builtin/init-db.c @@@ -481,10 -484,10 +485,10 @@@ int cmd_init_db(int argc, const char ** * without --bare. Catch the error early. */ git_dir = getenv(GIT_DIR_ENVIRONMENT); - if ((!git_dir || is_bare_repository_cfg == 1) - && getenv(GIT_WORK_TREE_ENVIRONMENT)) + work_tree = getenv(GIT_WORK_TREE_ENVIRONMENT); + if ((!git_dir || is_bare_repository_cfg == 1) && work_tree) - die("%s (or --work-tree=) not allowed without " - "specifying %s (or --git-dir=)", + die(_("%s (or --work-tree=) not allowed without " - "specifying %s (or --git-dir=)"), ++ "specifying %s (or --git-dir=)"), GIT_WORK_TREE_ENVIRONMENT, GIT_DIR_ENVIRONMENT); @@@ -509,20 -512,12 +513,20 @@@ if (!git_work_tree_cfg) { git_work_tree_cfg = xcalloc(PATH_MAX, 1); if (!getcwd(git_work_tree_cfg, PATH_MAX)) - die_errno ("Cannot access current working directory"); + die_errno (_("Cannot access current working directory")); } + if (work_tree) + set_git_work_tree(make_absolute_path(work_tree)); + else + set_git_work_tree(git_work_tree_cfg); if (access(get_git_work_tree(), X_OK)) - die_errno ("Cannot access work tree '%s'", + die_errno (_("Cannot access work tree '%s'"), get_git_work_tree()); } + else { + if (work_tree) + set_git_work_tree(make_absolute_path(work_tree)); + } set_git_dir(make_absolute_path(git_dir)); diff --cc builtin/merge.c index b573d9804,62bdd6c77..2511361ec --- a/builtin/merge.c +++ b/builtin/merge.c @@@ -236,27 -231,9 +236,27 @@@ static void save_state(void return; strbuf_setlen(&buffer, buffer.len-1); if (get_sha1(buffer.buf, stash)) - die("not a valid object: %s", buffer.buf); + die(_("not a valid object: %s"), buffer.buf); } +static void read_empty(unsigned const char *sha1, int verbose) +{ + int i = 0; + const char *args[7]; + + args[i++] = "read-tree"; + if (verbose) + args[i++] = "-v"; + args[i++] = "-m"; + args[i++] = "-u"; + args[i++] = EMPTY_TREE_SHA1_HEX; + args[i++] = sha1_to_hex(sha1); + args[i] = NULL; + + if (run_command_v_opt(args, RUN_GIT_CMD)) + die("read-tree failed"); +} + static void reset_hard(unsigned const char *sha1, int verbose) { int i = 0; @@@ -581,11 -558,10 +581,11 @@@ static int read_tree_trivial(unsigned c static void write_tree_trivial(unsigned char *sha1) { if (write_cache_as_tree(sha1, 0, NULL)) - die("git write-tree failed to write a tree"); + die(_("git write-tree failed to write a tree")); } -int try_merge_command(const char *strategy, struct commit_list *common, +int try_merge_command(const char *strategy, size_t xopts_nr, + const char **xopts, struct commit_list *common, const char *head_arg, struct commit_list *remotes) { const char **args; @@@ -949,34 -935,6 +949,34 @@@ int cmd_merge(int argc, const char **ar argc = parse_options(argc, argv, prefix, builtin_merge_options, builtin_merge_usage, 0); + + if (abort_current_merge) { + int nargc = 2; + const char *nargv[] = {"reset", "--merge", NULL}; + + if (!file_exists(git_path("MERGE_HEAD"))) - die("There is no merge to abort (MERGE_HEAD missing)."); ++ die(_("There is no merge to abort (MERGE_HEAD missing).")); + + /* Invoke 'git reset --merge' */ + return cmd_reset(nargc, nargv, prefix); + } + + if (read_cache_unmerged()) + die_resolve_conflict("merge"); + + if (file_exists(git_path("MERGE_HEAD"))) { + /* + * There is no unmerged entry, don't advise 'git + * add/rm ', just 'git commit'. + */ + if (advice_resolve_conflict) - die("You have not concluded your merge (MERGE_HEAD exists).\n" - "Please, commit your changes before you can merge."); ++ die(_("You have not concluded your merge (MERGE_HEAD exists).\n" ++ "Please, commit your changes before you can merge.")); + else - die("You have not concluded your merge (MERGE_HEAD exists)."); ++ die(_("You have not concluded your merge (MERGE_HEAD exists).")); + } + resolve_undo_clear(); + if (verbosity < 0) show_diffstat = 0; @@@ -1015,19 -973,19 +1015,19 @@@ * We do the same for "git pull". */ if (argc != 1) - die("Can merge only exactly one commit into " - "empty head"); + die(_("Can merge only exactly one commit into " + "empty head")); if (squash) - die("Squash commit into empty head not supported yet"); + die(_("Squash commit into empty head not supported yet")); if (!allow_fast_forward) - die("Non-fast-forward commit does not make sense into " - "an empty head"); + die(_("Non-fast-forward commit does not make sense into " + "an empty head")); remote_head = peel_to_type(argv[0], 0, NULL, OBJ_COMMIT); if (!remote_head) - die("%s - not something we can merge", argv[0]); + die(_("%s - not something we can merge"), argv[0]); update_ref("initial pull", "HEAD", remote_head->sha1, NULL, 0, DIE_ON_ERR); - reset_hard(remote_head->sha1, 0); + read_empty(remote_head->sha1, 0); return 0; } else { struct strbuf merge_names = STRBUF_INIT; diff --cc builtin/notes.c index 4d5556e2c,e33e39a50..91d792928 --- a/builtin/notes.c +++ b/builtin/notes.c @@@ -306,9 -280,9 +306,9 @@@ void commit_notes(struct notes_tree *t if (!t) t = &default_notes_tree; if (!t->initialized || !t->ref || !*t->ref) - die("Cannot commit uninitialized/unreferenced notes tree"); + die(_("Cannot commit uninitialized/unreferenced notes tree")); if (!t->dirty) - return 0; /* don't have to commit an unchanged tree */ + return; /* don't have to commit an unchanged tree */ /* Prepare commit message and reflog message */ strbuf_addstr(&buf, "notes: "); /* commit message starts at index 7 */ @@@ -1066,10 -873,8 +1070,10 @@@ int cmd_notes(int argc, const char **ar result = remove_cmd(argc, argv, prefix); else if (!strcmp(argv[0], "prune")) result = prune(argc, argv, prefix); + else if (!strcmp(argv[0], "get-ref")) + result = get_ref(argc, argv, prefix); else { - result = error("Unknown subcommand: %s", argv[0]); + result = error(_("Unknown subcommand: %s"), argv[0]); usage_with_options(git_notes_usage, options); } diff --cc builtin/revert.c index dc1b702ed,c8463d23c..d4631d7d5 --- a/builtin/revert.c +++ b/builtin/revert.c @@@ -556,27 -553,12 +568,28 @@@ static void prepare_revs(struct rev_inf usage(*revert_or_cherry_pick_usage()); if (prepare_revision_walk(revs)) - die("revision walk setup failed"); + die(_("revision walk setup failed")); if (!revs->commits) - die("empty commit set passed"); + die(_("empty commit set passed")); } +static void read_and_refresh_cache(const char *me) +{ + static struct lock_file index_lock; + int index_fd = hold_locked_index(&index_lock, 0); + if (read_index_preload(&the_index, NULL) < 0) + die("git %s: failed to read the index", me); + refresh_index(&the_index, REFRESH_QUIET|REFRESH_UNMERGED, NULL, NULL, NULL); + if (the_index.cache_changed) { + if (write_index(&the_index, index_fd) || + commit_locked_index(&index_lock)) - die("git %s: failed to refresh the index", me); ++ /* TRANSLATORS: %s will be "revert" or "cherry-pick" */ ++ die(_("git %s: failed to read the index"), me); + } + rollback_lock_file(&index_lock); +} + static int revert_or_cherry_pick(int argc, const char **argv) { struct rev_info revs; @@@ -588,16 -570,18 +601,16 @@@ if (allow_ff) { if (signoff) - die("cherry-pick --ff cannot be used with --signoff"); + die(_("cherry-pick --ff cannot be used with --signoff")); if (no_commit) - die("cherry-pick --ff cannot be used with --no-commit"); + die(_("cherry-pick --ff cannot be used with --no-commit")); if (no_replay) - die("cherry-pick --ff cannot be used with -x"); + die(_("cherry-pick --ff cannot be used with -x")); if (edit) - die("cherry-pick --ff cannot be used with --edit"); + die(_("cherry-pick --ff cannot be used with --edit")); } - if (read_cache() < 0) - /* TRANSLATORS: %s will be "revert" or "cherry-pick" */ - die(_("git %s: failed to read the index"), me); + read_and_refresh_cache(me); prepare_revs(&revs); diff --cc daemon.c index 347fd0c52,c69f72258..d9f2291cc --- a/daemon.c +++ b/daemon.c @@@ -4,7 -4,10 +4,8 @@@ #include "run-command.h" #include "strbuf.h" #include "string-list.h" + #include "gettext.h" -#include - #ifndef HOST_NAME_MAX #define HOST_NAME_MAX 256 #endif @@@ -1047,12 -994,16 +1048,14 @@@ int main(int argc, char **argv { int listen_port = 0; struct string_list listen_addr = STRING_LIST_INIT_NODUP; - int inetd_mode = 0; + int serve_mode = 0, inetd_mode = 0; const char *pid_file = NULL, *user_name = NULL, *group_name = NULL; int detach = 0; - struct passwd *pass = NULL; - struct group *group; - gid_t gid = 0; + struct credentials *cred = NULL; int i; + git_setup_gettext(); + git_extract_argv0_path(argv[0]); for (i = 1; i < argc; i++) { diff --cc fast-import.c index 60f26fe47,bbd7c3968..3cbc26bbd --- a/fast-import.c +++ b/fast-import.c @@@ -159,7 -156,7 +159,8 @@@ Format of STDIN stream #include "csum-file.h" #include "quote.h" #include "exec_cmd.h" +#include "dir.h" + #include "gettext.h" #define PACK_ID_BITS 16 #define MAX_PACK_ID ((1<extra_file && git add extra_file && diff --cc t/t7502-commit.sh index 50da034cd,e1af8adb4..d7c4280e8 --- a/t/t7502-commit.sh +++ b/t/t7502-commit.sh @@@ -388,9 -402,9 +402,9 @@@ try_commit_status_combo () grep "^# Changes to be committed:" .git/COMMIT_EDITMSG ' - test_expect_success 'commit --no-status' ' + test_expect_success NO_GETTEXT_POISON 'commit --no-status' ' clear_config commit.status && - try_commit --no-status + try_commit --no-status && ! grep "^# Changes to be committed:" .git/COMMIT_EDITMSG ' diff --cc wt-status.c index a82b11d34,27cafd9e3..57bf1033b --- a/wt-status.c +++ b/wt-status.c @@@ -92,7 -88,7 +92,7 @@@ static void wt_status_print_dirty_heade { const char *c = color(WT_STATUS_HEADER, s); - color_fprintf_ln(s->fp, c, "# Changes not staged for commit:"); - color_fprintf_ln(s->fp, c, _("# Changed but not updated:")); ++ color_fprintf_ln(s->fp, c, _("# Changes not staged for commit:")); if (!advice_status_hints) return; if (!has_deleted) @@@ -632,22 -625,20 +632,22 @@@ static void wt_status_print_tracking(st void wt_status_print(struct wt_status *s) { - const char *branch_color = color(WT_STATUS_HEADER, s); + const char *branch_color = color(WT_STATUS_ONBRANCH, s); + const char *branch_status_color = color(WT_STATUS_HEADER, s); if (s->branch) { - const char *on_what = "On branch "; + const char *on_what = _("On branch "); const char *branch_name = s->branch; if (!prefixcmp(branch_name, "refs/heads/")) branch_name += 11; else if (!strcmp(branch_name, "HEAD")) { branch_name = ""; - branch_color = color(WT_STATUS_NOBRANCH, s); + branch_status_color = color(WT_STATUS_NOBRANCH, s); - on_what = "Not currently on any branch."; + on_what = _("Not currently on any branch."); } color_fprintf(s->fp, color(WT_STATUS_HEADER, s), "# "); - color_fprintf_ln(s->fp, branch_color, "%s%s", on_what, branch_name); + color_fprintf(s->fp, branch_status_color, "%s", on_what); + color_fprintf_ln(s->fp, branch_color, "%s", branch_name); if (!s->is_initial) wt_status_print_tracking(s); }