Mark strings for translation
cover Mark strings for translation
This is a rebased version of v2 [1], sent during rc time and was probably fell through the cracks.
[1] https://public-inbox.org/git/[email protected]/
Nguyễn Thái Ngọc Duy (23):
Update messages in preparation for i18n archive-tar.c: mark more strings for translation archive-zip.c: mark more strings for translation builtin/config.c: mark more strings for translation builtin/grep.c: mark strings for translation and no full stops builtin/pack-objects.c: mark more strings for translation builtin/replace.c: mark more strings for translation commit-graph.c: mark more strings for translation config.c: mark more strings for translation connect.c: mark more strings for translation convert.c: mark more strings for translation
dir.c: mark more strings for translation environment.c: mark more strings for translation exec-cmd.c: mark more strings for translation object.c: mark more strings for translation pkt-line.c: mark more strings for translation refs.c: mark more strings for translation
refspec.c: mark more strings for translation replace-object.c: mark more strings for translation sequencer.c: mark more strings for translation sha1-file.c: mark more strings for translation transport.c: mark more strings for translation transport-helper.c: mark more strings for translation
archive-tar.c | 12 +-- archive-zip.c | 14 ++-- builtin/config.c | 50 ++++++------ builtin/grep.c | 12 +-- builtin/pack-objects.c | 108 ++++++++++++------------- builtin/replace.c | 90 ++++++++++----------- commit-graph.c | 20 ++--- config.c | 76 +++++++++--------- connect.c | 85 +++++++++++--------- convert.c | 42 +++++----- dir.c | 8 +- environment.c | 4 +- exec-cmd.c | 2 +- object.c | 10 +-- pkt-line.c | 26 +++--- refs.c | 40 +++++----- refspec.c | 2 +- replace-object.c | 6 +- sequencer.c | 28 ++++--- sha1-file.c | 110 +++++++++++++------------- t/t0021-conversion.sh | 2 +- t/t1305-config-include.sh | 2 +- t/t1308-config-set.sh | 2 +- t/t1400-update-ref.sh | 20 ++--- t/t1404-update-ref-errors.sh | 4 +- t/t1450-fsck.sh | 2 +- t/t3005-ls-files-relative.sh | 8 +- t/t3210-pack-refs.sh | 2 +- t/t3310-notes-merge-manual-resolve.sh | 6 +- t/t5500-fetch-pack.sh | 2 +- t/t5505-remote.sh | 2 +- t/t5570-git-daemon.sh | 6 +- t/t5801-remote-helpers.sh | 8 +- t/t7063-status-untracked-cache.sh | 2 +- t/t7400-submodule-basic.sh | 2 +- transport-helper.c | 89 ++++++++++----------- transport.c | 18 ++--- 37 files changed, 470 insertions(+), 452 deletions(-)
Signature · 1 line
2.18.0.rc2.476.g39500d3211
PATCH 1/23 Update messages in preparation for i18n
Many messages will be marked for translation in the following commits. This commit updates some of them to be more consistent and reduce diff noise in those commits. Changes are
- keep the first letter of die(), error() and warning() in lowercase
- no full stop in die(), error() or warning() if it's single sentence messages
- indentation
- some messages are turned to BUG(), or prefixed with "BUG:" and will not be marked for i18n
- some messages are improved to give more information
- some messages are broken down by sentence to be i18n friendly
- the trailing \n is converted to printf_ln if possible
- errno_errno() is used instead of explicit strerror()
--- archive-zip.c | 2 +- builtin/config.c | 18 +++++++----- builtin/grep.c | 10 +++---- builtin/pack-objects.c | 10 +++---- builtin/replace.c | 22 +++++++------- config.c | 2 +- connect.c | 33 +++++++++++---------- convert.c | 6 ++-- dir.c | 4 +-- pkt-line.c | 2 +- refs.c | 12 ++++---- refspec.c | 2 +- sequencer.c | 8 +++--- sha1-file.c | 8 +++--- t/t1400-update-ref.sh | 8 +++--- t/t3005-ls-files-relative.sh | 4 +-- t/t5801-remote-helpers.sh | 6 ++-- t/t7063-status-untracked-cache.sh | 2 +- transport-helper.c | 48 +++++++++++++++---------------- transport.c | 8 +++--- 20 files changed, 111 insertions(+), 104 deletions(-)
archive-zip.c +1 -1
@@ -309,7 +309,7 @@ static int write_zip_entry(struct archiver_args *args,if (is_utf8 (path)) flags |=ZIP_UTF8 ;else -warning ("Path is not valid UTF-8: %s" , path); +warning ("path is not valid UTF-8: %s" , path); }if (pathlen >0xffff ) {
builtin/config.c +11 -7
@@ -110,7 +110,7 @@ static int option_parse_type(const struct option *opt, const char *arg,* --int' and '--type=bool * --type=int'. */ -error ("only one type at a time." ); +error ("only one type at a time" );usage_with_options (builtin_config_usage, builtin_config_options); }
@@ -160,7 +160,11 @@ static struct option builtin_config_options[] = {static void check_argc (int argc,int min,int max) {if (argc >= min && argc <= max)return ; -error ("wrong number of arguments" ); +if (min == max) +error ("wrong number of arguments, should be %d" , min); +else +error ("wrong number of arguments, should be from %d to %d" , + min, max);usage_with_options (builtin_config_usage, builtin_config_options); }
@@ -595,7 +599,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)if (use_global_config + use_system_config + use_local_config + !!given_config_source.file + !!given_config_source.blob >1 ) { -error ("only one config file at a time." ); +error ("only one config file at a time" );usage_with_options (builtin_config_usage, builtin_config_options); }
@@ -622,7 +626,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)* location; error out even if XDG_CONFIG_HOME * is set and points at a sane location. */ -die ("$HOME not set" ); +die ("$HOME is not set" );if (access_or_warn (user_config,R_OK ,0 ) && xdg_config && !access_or_warn (xdg_config,R_OK ,0 )) {
@@ -664,7 +668,7 @@ int cmd_config(int argc, const char **argv, const char *prefix) }if (HAS_MULTI_BITS (actions)) { -error ("only one action at a time." ); +error ("only one action at a time" );usage_with_options (builtin_config_usage, builtin_config_options); }if (actions ==0 )
@@ -819,7 +823,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)if (ret <0 )return ret;if (ret ==0 ) -die ("No such section!" ); +die ("no such section: %s" , argv[0 ]); }else if (actions ==ACTION_REMOVE_SECTION ) {int ret;
@@ -830,7 +834,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)if (ret <0 )return ret;if (ret ==0 ) -die ("No such section!" ); +die ("no such section: %s" , argv[0 ]); }else if (actions ==ACTION_GET_COLOR ) {check_argc (argc,1 ,2 );
builtin/grep.c +5 -5
@@ -959,7 +959,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix) }if (!opt.pattern_list) -die (_ ("no pattern given." )); +die (_ ("no pattern given" ));/* * We have to find "--" in a separate pass, because its presence
@@ -1085,19 +1085,19 @@ int cmd_grep(int argc, const char **argv, const char *prefix) }if (recurse_submodules && (!use_index || untracked)) -die (_ ("option not supported with --recurse-submodules." )); +die (_ ("option not supported with --recurse-submodules" ));if (!show_in_pager && !opt.status_only)setup_pager ();if (!use_index && (untracked || cached)) -die (_ ("--cached or --untracked cannot be used with --no-index." )); +die (_ ("--cached or --untracked cannot be used with --no-index" ));if (!use_index || untracked) {int use_exclude = (opt_exclude <0 ) ? use_index : !!opt_exclude; hit =grep_directory (&opt, &pathspec, use_exclude, use_index); }else if (0 <= opt_exclude) { -die (_ ("--[no-]exclude-standard cannot be used for tracked contents." )); +die (_ ("--[no-]exclude-standard cannot be used for tracked contents" )); }else if (!list.nr) {if (!cached)setup_work_tree ();
@@ -1105,7 +1105,7 @@ int cmd_grep(int argc, const char **argv, const char *prefix) hit =grep_cache (&opt, the_repository, &pathspec, cached); }else {if (cached) -die (_ ("both --cached and trees are given." )); +die (_ ("both --cached and trees are given" )); hit =grep_objects (&opt, &pathspec, &list); }
builtin/pack-objects.c +5 -5
@@ -2341,7 +2341,7 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size,return ; }if (progress > pack_to_stdout) -fprintf (stderr,"Delta compression using up to %d threads.\n" , +fprintf_ln (stderr,"Delta compression using up to %d threads." , delta_search_threads); p =xcalloc (delta_search_threads,sizeof (*p));
@@ -2638,7 +2638,7 @@ static void read_object_list_from_stdin(void)if (feof (stdin))break ;if (!ferror (stdin)) -die ("fgets returned NULL, not EOF, not error!" ); +die ("BUG: fgets returned NULL, not EOF, not error!" );if (errno !=EINTR )die_errno ("fgets" );clearerr (stdin);
@@ -3353,8 +3353,8 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)prepare_pack (window, depth);write_pack_file ();if (progress) -fprintf (stderr,"Total %" PRIu32" (delta %" PRIu32")," -" reused %" PRIu32" (delta %" PRIu32")\n" , - written, written_delta, reused, reused_delta); +fprintf_ln (stderr,"Total %" PRIu32" (delta %" PRIu32")," +" reused %" PRIu32" (delta %" PRIu32")" , + written, written_delta, reused, reused_delta);return 0 ; }
builtin/replace.c +11 -11
@@ -54,7 +54,7 @@ static int show_reference(const char *refname, const struct object_id *oid,enum object_type obj_type, repl_type;if (get_oid (refname, &object)) -return error ("Failed to resolve '%s' as a valid ref." , refname); +return error ("failed to resolve '%s' as a valid ref" , refname); obj_type =oid_object_info (the_repository, &object,NULL );
@@ -108,7 +108,7 @@ static int for_each_replace_name(const char **argv, each_replace_name_fn fn)for (p = argv; *p; p++) {if (get_oid (*p, &oid)) { -error ("Failed to resolve '%s' as a valid ref." , *p); +error ("failed to resolve '%s' as a valid ref" , *p); had_error =1 ;continue ; }
@@ -118,7 +118,7 @@ static int for_each_replace_name(const char **argv, each_replace_name_fn fn) full_hex = ref.buf + base_len;if (read_ref (ref.buf, &oid)) { -error ("replace ref '%s' not found." , full_hex); +error ("replace ref '%s' not found" , full_hex); had_error =1 ;continue ; }
@@ -134,7 +134,7 @@ static int delete_replace_ref(const char *name, const char *ref, {if (delete_ref (NULL , ref, oid,0 ))return 1 ; -printf ("Deleted replace ref '%s'\n" , name); +printf_ln ("Deleted replace ref '%s'" , name);return 0 ; }
@@ -146,7 +146,7 @@ static int check_ref_valid(struct object_id *object,strbuf_reset (ref);strbuf_addf (ref,"%s%s" , git_replace_ref_base,oid_to_hex (object));if (check_refname_format (ref->buf,0 )) -return error ("'%s' is not a valid ref name." , ref->buf); +return error ("'%s' is not a valid ref name" , ref->buf);if (read_ref (ref->buf, prev))oidclr (prev);
@@ -200,10 +200,10 @@ static int replace_object(const char *object_ref, const char *replace_ref, int fstruct object_id object, repl;if (get_oid (object_ref, &object)) -return error ("Failed to resolve '%s' as a valid ref." , +return error ("failed to resolve '%s' as a valid ref" , object_ref);if (get_oid (replace_ref, &repl)) -return error ("Failed to resolve '%s' as a valid ref." , +return error ("failed to resolve '%s' as a valid ref" , replace_ref);return replace_object_oid (object_ref, &object, replace_ref, &repl, force);
@@ -315,7 +315,7 @@ static int edit_and_replace(const char *object_ref, int force, int raw)struct strbuf ref =STRBUF_INIT ;if (get_oid (object_ref, &old_oid) <0 ) -return error ("Not a valid object name: '%s'" , object_ref); +return error ("not a valid object name: '%s'" , object_ref); type =oid_object_info (the_repository, &old_oid,NULL );if (type <0 )
@@ -368,7 +368,7 @@ static int replace_parents(struct strbuf *buf, int argc, const char **argv)struct object_id oid;if (get_oid (argv[i], &oid) <0 ) {strbuf_release (&new_parents); -return error (_ ("Not a valid object name: '%s'" ), +return error (_ ("not a valid object name: '%s'" ), argv[i]); }if (!lookup_commit_reference (&oid)) {
@@ -412,7 +412,7 @@ static int check_one_mergetag(struct commit *commit,for (i =1 ; i < mergetag_data->argc; i++) {struct object_id oid;if (get_oid (mergetag_data->argv[i], &oid) <0 ) -return error (_ ("Not a valid object name: '%s'" ), +return error (_ ("not a valid object name: '%s'" ), mergetag_data->argv[i]);if (!oidcmp (&tag->tagged->oid, &oid))return 0 ;/* found */
@@ -442,7 +442,7 @@ static int create_graft(int argc, const char **argv, int force, int gentle)unsigned long size;if (get_oid (old_ref, &old_oid) <0 ) -return error (_ ("Not a valid object name: '%s'" ), old_ref); +return error (_ ("not a valid object name: '%s'" ), old_ref); commit =lookup_commit_reference (&old_oid);if (!commit)return error (_ ("could not parse %s" ), old_ref);
config.c +1 -1
@@ -461,7 +461,7 @@ int git_config_from_parameters(config_fn_t fn, void *data) envw =xstrdup (env);if (sq_dequote_to_argv (envw, &argv, &nr, &alloc) <0 ) { - ret =error ("bogus format in " CONFIG_DATA_ENVIRONMENT ); + ret =error ("bogus format in %s" ,CONFIG_DATA_ENVIRONMENT ); goto out; }
connect.c +18 -15
@@ -58,7 +58,7 @@ static NORETURN void die_initial_contact(int unexpected)* response does not necessarily mean an ACL problem, though. */ if (unexpected) -die (_ ("The remote end hung up upon initial contact" )); +die (_ ("the remote end hung up upon initial contact" ));else die(_("Could not read from remote repository.\n\n" "Please make sure you have the correct access rights\n"
@@ -230,7 +230,7 @@ static int process_dummy_ref(const char *line)static void check_no_capabilities (const char *line,int len) {if (strlen (line) != len) -warning ("Ignoring capabilities after first line '%s'" , +warning ("ignoring capabilities after first line '%s'" , line +strlen (line)); }
@@ -544,7 +544,7 @@ static enum protocol get_protocol(const char *name)return PROTO_SSH ;if (!strcmp (name,"file" ))return PROTO_FILE ; -die ("I don't handle protocol '%s'" , name); +die ("protocol '%s' is not supported" , name); }static char *host_end (char **hoststart,int removebrackets)
@@ -595,8 +595,7 @@ static void enable_keepalive(int sockfd)int ka =1 ;if (setsockopt (sockfd,SOL_SOCKET ,SO_KEEPALIVE , &ka,sizeof (ka)) <0 ) -fprintf (stderr,"unable to set SO_KEEPALIVE on socket: %s\n" , -strerror (errno)); +error_errno ("unable to set SO_KEEPALIVE on socket" ); }#ifndef NO_IPV6
@@ -640,10 +639,12 @@ static int git_tcp_connect_sock(char *host, int flags) gai =getaddrinfo (host, port, &hints, &ai);if (gai) -die ("Unable to look up %s (port %s) (%s)" , host, port,gai_strerror (gai)); +die ("unable to look up %s (port %s) (%s)" , host, port,gai_strerror (gai)); -if (flags &CONNECT_VERBOSE ) -fprintf (stderr,"done.\nConnecting to %s (port %s) ... " , host, port); +if (flags &CONNECT_VERBOSE ) { +fprintf_ln (stderr,"done." ); +fprintf (stderr,"Connecting to %s (port %s) ... " , host, port); + }for (ai0 = ai; ai; ai = ai->ai_next, cnt++) { sockfd = socket(ai->ai_family,
@@ -670,7 +671,7 @@ static int git_tcp_connect_sock(char *host, int flags)enable_keepalive (sockfd);if (flags &CONNECT_VERBOSE ) -fprintf (stderr,"done.\n" ); +fprintf_ln (stderr,"done." );strbuf_release (&error_message);
@@ -701,18 +702,20 @@ static int git_tcp_connect_sock(char *host, int flags) he =gethostbyname (host);if (!he) -die ("Unable to look up %s (%s)" , host,hstrerror (h_errno)); +die ("unable to look up %s (%s)" , host,hstrerror (h_errno)); nport =strtoul (port, &ep,10 );if ( ep == port || *ep ) {/* Not numeric */ struct servent *se =getservbyname (port,"tcp" );if ( !se ) -die ("Unknown port %s" , port); +die ("unknown port %s" , port); nport = se->s_port; } -if (flags &CONNECT_VERBOSE ) -fprintf (stderr,"done.\nConnecting to %s (port %s) ... " , host, port); +if (flags &CONNECT_VERBOSE ) { +fprintf_ln (stderr,"done." ); +fprintf (stderr,"Connecting to %s (port %s) ... " , host, port); + }for (cnt =0 , ap = he->h_addr_list; *ap; ap++, cnt++) {memset (&sa,0 ,sizeof sa);
@@ -745,7 +748,7 @@ static int git_tcp_connect_sock(char *host, int flags)enable_keepalive (sockfd);if (flags &CONNECT_VERBOSE ) -fprintf (stderr,"done.\n" ); +fprintf_ln (stderr,"done." );return sockfd; }
@@ -921,7 +924,7 @@ static enum protocol parse_connect_url(const char *url_orig, char **ret_host, path =strchr (end, separator);if (!path || !*path) -die ("No path specified. See 'man git-pull' for valid url syntax" ); +die ("no path specified; see 'git help pull' for valid url syntax" );/* * null-terminate hostname and point path to ~ for URL's like this:
convert.c +3 -3
@@ -190,7 +190,7 @@ static enum eol output_eol(enum crlf_action crlf_action)/* fall through */ return text_eol_is_crlf () ?EOL_CRLF :EOL_LF ; } -warning ("Illegal crlf_action %d\n" , (int )crlf_action); +warning ("illegal crlf_action %d" , (int )crlf_action);return core_eol; }
@@ -203,7 +203,7 @@ static void check_global_conv_flags_eol(const char *path, enum crlf_action crlf_* CRLFs would not be restored by checkout */ if (conv_flags &CONV_EOL_RNDTRP_DIE ) -die (_ ("CRLF would be replaced by LF in %s." ), path); +die (_ ("CRLF would be replaced by LF in %s" ), path);else if (conv_flags &CONV_EOL_RNDTRP_WARN ) warning(_("CRLF will be replaced by LF in %s.\n" "The file will have its original line"
@@ -493,7 +493,7 @@ static int encode_to_worktree(const char *path, const char *src, size_t src_len, &dst_len);if (!dst) {error ("failed to encode '%s' from %s to %s" , - path, default_encoding, enc); + path, default_encoding, enc);return 0 ; }
dir.c +2 -2
@@ -560,7 +560,7 @@ int report_path_error(const char *ps_matched,if (found_dup)continue ; -error ("pathspec '%s' did not match any file(s) known to git." , +error ("pathspec '%s' did not match any file(s) known to git" , pathspec->items[num].original); errors++; }
@@ -2230,7 +2230,7 @@ static struct untracked_cache_dir *validate_untracked_cache(struct dir_struct *dreturn NULL ;if (!ident_in_untracked (dir->untracked)) { -warning (_ ("Untracked cache is disabled on this system or location." )); +warning (_ ("untracked cache is disabled on this system or location" ));return NULL ; }
pkt-line.c +1 -1
@@ -296,7 +296,7 @@ static int get_packet_data(int fd, char **src_buf, size_t *src_size,if (options &PACKET_READ_GENTLE_ON_EOF )return -1 ; -die ("The remote end hung up unexpectedly" ); +die ("the remote end hung up unexpectedly" ); }return ret;
refs.c +6 -6
@@ -567,9 +567,9 @@ int expand_ref(const char *str, int len, struct object_id *oid, char **ref)if (!warn_ambiguous_refs)break ; }else if ((flag &REF_ISSYMREF ) &&strcmp (fullref.buf,"HEAD" )) { -warning ("ignoring dangling symref %s." , fullref.buf); +warning ("ignoring dangling symref %s" , fullref.buf); }else if ((flag &REF_ISBROKEN ) &&strchr (fullref.buf,'/' )) { -warning ("ignoring broken ref %s." , fullref.buf); +warning ("ignoring broken ref %s" , fullref.buf); } }strbuf_release (&fullref);
@@ -871,13 +871,13 @@ static int read_ref_at_ent(struct object_id *ooid, struct object_id *noid,if (!is_null_oid (&cb->ooid)) {oidcpy (cb->oid, noid);if (oidcmp (&cb->ooid, noid)) -warning ("Log for ref %s has gap after %s." , +warning ("log for ref %s has gap after %s" , cb->refname,show_date (cb->date, cb->tz,DATE_MODE (RFC2822 ))); }else if (cb->date == cb->at_time)oidcpy (cb->oid, noid);else if (oidcmp (noid, cb->oid)) -warning ("Log for ref %s unexpectedly ended on %s." , +warning ("log for ref %s unexpectedly ended on %s" , cb->refname,show_date (cb->date, cb->tz,DATE_MODE (RFC2822 )));oidcpy (&cb->ooid, ooid);
@@ -935,7 +935,7 @@ int read_ref_at(const char *refname, unsigned int flags, timestamp_t at_time, inif (flags &GET_OID_QUIETLY )exit (128 );else -die ("Log for %s is empty." , refname); +die ("log for %s is empty" , refname); }if (cb.found_it)return 0 ;
@@ -1845,7 +1845,7 @@ int ref_update_reject_duplicates(struct string_list *refnames,if (!cmp) {strbuf_addf (err, -"multiple updates for ref '%s' not allowed." , +"multiple updates for ref '%s' not allowed" , refnames->items[i].string);return 1 ; }else if (cmp >0 ) {
refspec.c +1 -1
@@ -134,7 +134,7 @@ void refspec_item_init_or_die(struct refspec_item *item, const char *refspec, int fetch) {if (!refspec_item_init (item, refspec, fetch)) -die ("Invalid refspec '%s'" , refspec); +die ("invalid refspec '%s'" , refspec); }void refspec_item_clear (struct refspec_item *item)
sequencer.c +4 -4
@@ -306,7 +306,7 @@ static const char *action_name(const struct replay_opts *opts)case REPLAY_INTERACTIVE_REBASE :return N_ ("rebase -i" ); } -die (_ ("Unknown action: %d" ), opts->action); +die (_ ("unknown action: %d" ), opts->action); }struct commit_message {
@@ -1444,7 +1444,7 @@ static const char *command_to_string(const enum todo_command command) {if (command <TODO_COMMENT )return todo_command_info[command].str; -die ("Unknown command: %d" , command); +die ("unknown command: %d" , command); }static char command_to_char (const enum todo_command command)
@@ -2608,7 +2608,7 @@ static int error_with_patch(struct commit *commit,"\n" " git rebase --continue\n", gpg_sign_opt_quoted(opts)); }else if (exit_code) -fprintf (stderr,"Could not apply %s... %.*s\n" , +fprintf_ln (stderr,"Could not apply %s... %.*s" ,short_commit_name (commit), subject_len, subject);return exit_code;
@@ -2719,7 +2719,7 @@ static int do_label(const char *name, int len)struct object_id head_oid;if (len ==1 && *name =='#' ) -return error ("Illegal label name: '%.*s'" , len, name); +return error ("illegal label name: '%.*s'" , len, name);strbuf_addf (&ref_name,"refs/rewritten/%.*s" , len, name);strbuf_addf (&msg,"rebase -i (label) '%.*s'" , len, name);
sha1-file.c +4 -4
@@ -71,17 +71,17 @@ static void git_hash_sha1_final(unsigned char *hash, git_hash_ctx *ctx)static void git_hash_unknown_init (git_hash_ctx *ctx) { -die ("trying to init unknown hash" ); +BUG ("trying to init unknown hash" ); }static void git_hash_unknown_update (git_hash_ctx *ctx,const void *data,size_t len) { -die ("trying to update unknown hash" ); +BUG ("trying to update unknown hash" ); }static void git_hash_unknown_final (unsigned char *hash,git_hash_ctx *ctx) { -die ("trying to finalize unknown hash" ); +BUG ("trying to finalize unknown hash" ); }const struct git_hash_algo hash_algos[GIT_HASH_NALGOS ] = {
@@ -379,7 +379,7 @@ static int alt_odb_usable(struct raw_object_store *o,/* Detect cases where alternate disappeared */ if (!is_directory (path->buf)) {error ("object directory %s does not exist; " -"check .git/objects/info/alternates." , +"check .git/objects/info/alternates" , path->buf);return 0 ; }
t/t1400-update-ref.sh +4 -4
@@ -390,7 +390,7 @@ test_expect_success 'Query "master@{2005-05-26 23:33:01}" (middle of history wit test_when_finished "rm -f o e" && git rev-parse --verify "master@{2005-05-26 23:33:01}" >o 2>e && test $B = $(cat o) && - test "warning: Log for ref $m has gap after $gd." = "$(cat e)" + test "warning: log for ref $m has gap after $gd" = "$(cat e)" ' test_expect_success 'Query "master@{2005-05-26 23:38:00}" (middle of history)' ' test_when_finished "rm -f o e" &&
@@ -408,7 +408,7 @@ test_expect_success 'Query "master@{2005-05-28}" (past end of history)' ' test_when_finished "rm -f o e" && git rev-parse --verify "master@{2005-05-28}" >o 2>e && test $D = $(cat o) && - test "warning: Log for ref $m unexpectedly ended on $ld." = "$(cat e)" + test "warning: log for ref $m unexpectedly ended on $ld" = "$(cat e)" ' rm -f .git/$m .git/logs/$m expect
@@ -650,7 +650,7 @@ test_expect_success 'stdin fails with duplicate refs' ' create $a $m EOF test_must_fail git update-ref --stdin <stdin 2>err && - grep "fatal: multiple updates for ref '"'"'$a'"'"' not allowed." err + grep "fatal: multiple updates for ref '"'"'$a'"'"' not allowed" err ' test_expect_success 'stdin create ref works' '
@@ -1052,7 +1052,7 @@ test_expect_success 'stdin -z fails option with unknown name' ' test_expect_success 'stdin -z fails with duplicate refs' ' printf $F "create $a" "$m" "create $b" "$m" "create $a" "$m" >stdin && test_must_fail git update-ref -z --stdin <stdin 2>err && - grep "fatal: multiple updates for ref '"'"'$a'"'"' not allowed." err + grep "fatal: multiple updates for ref '"'"'$a'"'"' not allowed" err ' test_expect_success 'stdin -z create ref works' '
t/t3005-ls-files-relative.sh +2 -2
@@ -44,7 +44,7 @@ test_expect_success 'ls-files -c' ' cd top/sub && for f in ../y* do - echo "error: pathspec $sq$f$sq did not match any file(s) known to git." + echo "error: pathspec $sq$f$sq did not match any file(s) known to git" done >expect.err && echo "Did you forget to ${sq}git add${sq}?" >>expect.err && ls ../x* >expect.out &&
@@ -59,7 +59,7 @@ test_expect_success 'ls-files -o' ' cd top/sub && for f in ../x* do - echo "error: pathspec $sq$f$sq did not match any file(s) known to git." + echo "error: pathspec $sq$f$sq did not match any file(s) known to git" done >expect.err && echo "Did you forget to ${sq}git add${sq}?" >>expect.err && ls ../y* >expect.out &&
t/t5801-remote-helpers.sh +3 -3
@@ -126,7 +126,7 @@ test_expect_success 'forced push' ' test_expect_success 'cloning without refspec' ' GIT_REMOTE_TESTGIT_REFSPEC="" \ git clone "testgit::${PWD}/server" local2 2>error && - grep "This remote helper should implement refspec capability" error && + grep "this remote helper should implement refspec capability" error && compare_refs local2 HEAD server HEAD '
@@ -134,7 +134,7 @@ test_expect_success 'pulling without refspecs' ' (cd local2 && git reset --hard && GIT_REMOTE_TESTGIT_REFSPEC="" git pull 2>../error) && - grep "This remote helper should implement refspec capability" error && + grep "this remote helper should implement refspec capability" error && compare_refs local2 HEAD server HEAD '
@@ -246,7 +246,7 @@ test_expect_success 'proper failure checks for fetching' ' (cd local && test_must_fail env GIT_REMOTE_TESTGIT_FAILURE=1 git fetch 2>error && cat error && - grep -q "Error while running fast-import" error + grep -q "error while running fast-import" error ) '
t/t7063-status-untracked-cache.sh +1 -1
@@ -666,7 +666,7 @@ test_expect_success 'test ident field is working' ' mkdir ../other_worktree && cp -R done dthree dtwo four three ../other_worktree && GIT_WORK_TREE=../other_worktree git status 2>../err && - echo "warning: Untracked cache is disabled on this system or location." >../expect && + echo "warning: untracked cache is disabled on this system or location" >../expect && test_i18ncmp ../expect ../err '
transport-helper.c +24 -24
170 lines not on this page · raw message
transport.c +4 -4
@@ -139,7 +139,7 @@ static struct ref *get_refs_from_bundle(struct transport *transport,close (data->fd); data->fd =read_bundle_header (transport->url, &data->header);if (data->fd <0 ) -die ("Could not read bundle '%s'." , transport->url); +die ("could not read bundle '%s'." , transport->url);for (i =0 ; i < data->header.references.nr; i++) {struct ref_list_entry *e = data->header.references.list + i;struct ref *ref =alloc_ref (e->name);
@@ -875,7 +875,7 @@ struct transport *transport_get(struct remote *remote, const char *url) ret->progress =isatty (2 );if (!remote) -die ("No remote provided to transport_get()" ); +BUG ("No remote provided to transport_get()" ); ret->got_remote_refs =0 ; ret->remote = remote;
@@ -1143,7 +1143,7 @@ int transport_push(struct transport *transport, transport->push_options, pretend)) {oid_array_clear (&commits); -die ("Failed to push all needed submodules!" ); +die ("failed to push all needed submodules!" ); }oid_array_clear (&commits); }
@@ -1265,7 +1265,7 @@ int transport_connect(struct transport *transport, const char *name,if (transport->vtable->connect)return transport->vtable->connect (transport, name, exec, fd);else -die ("Operation not supported by protocol" ); +die ("operation not supported by protocol" ); }int transport_disconnect (struct transport *transport)
Signature · 1 line
2.18.0.rc2.476.g39500d3211
PATCH 2/23 archive-tar.c: mark more strings for translation
In reply to Nguyễn Thái Ngọc Duy--- archive-tar.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
archive-tar.c +6 -6
@@ -121,7 +121,7 @@ static int stream_blocked(const struct object_id *oid) st =open_istream (oid, &type, &sz,NULL );if (!st) -return error ("cannot stream blob %s" ,oid_to_hex (oid)); +return error (_ ("cannot stream blob %s" ),oid_to_hex (oid));for (;;) { readlen =read_istream (st, buf,sizeof (buf));if (readlen <=0 )
@@ -256,7 +256,7 @@ static int write_tar_entry(struct archiver_args *args, *header.typeflag =TYPEFLAG_REG ; mode = (mode | ((mode &0100 ) ?0777 :0666 )) & ~tar_umask; }else { -return error ("unsupported file mode: 0%o (SHA1: %s)" , +return error (_ ("unsupported file mode: 0%o (SHA1: %s)" ), mode,oid_to_hex (oid)); }if (pathlen >sizeof (header.name)) {
@@ -283,7 +283,7 @@ static int write_tar_entry(struct archiver_args *args,enum object_type type; buffer =object_file_to_archive (args, path, oid, old_mode, &type, &size);if (!buffer) -return error ("cannot read %s" ,oid_to_hex (oid)); +return error (_ ("cannot read %s" ),oid_to_hex (oid)); }else { buffer =NULL ; size =0 ;
@@ -454,17 +454,17 @@ static int write_tar_filter_archive(const struct archiver *ar, filter.in =-1 ;if (start_command (&filter) <0 ) -die_errno ("unable to start '%s' filter" , argv[0 ]); +die_errno (_ ("unable to start '%s' filter" ), argv[0 ]);close (1 );if (dup2 (filter.in,1 ) <0 ) -die_errno ("unable to redirect descriptor" ); +die_errno (_ ("unable to redirect descriptor" ));close (filter.in); r =write_tar_archive (ar, args);close (1 );if (finish_command (&filter) !=0 ) -die ("'%s' filter reported error" , argv[0 ]); +die (_ ("'%s' filter reported error" ), argv[0 ]);strbuf_release (&cmd);return r;
Signature · 1 line
2.18.0.rc2.476.g39500d3211
PATCH 3/23 archive-zip.c: mark more strings for translation
In reply to Nguyễn Thái Ngọc Duy--- archive-zip.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
archive-zip.c +7 -7
@@ -309,11 +309,11 @@ static int write_zip_entry(struct archiver_args *args,if (is_utf8 (path)) flags |=ZIP_UTF8 ;else -warning ("path is not valid UTF-8: %s" , path); +warning (_ ("path is not valid UTF-8: %s" ), path); }if (pathlen >0xffff ) { -return error ("path too long (%d chars, SHA1: %s): %s" , +return error (_ ("path too long (%d chars, SHA1: %s): %s" ), (int )pathlen,oid_to_hex (oid), path); }
@@ -340,7 +340,7 @@ static int write_zip_entry(struct archiver_args *args, size > big_file_threshold) { stream =open_istream (oid, &type, &size,NULL );if (!stream) -return error ("cannot stream blob %s" , +return error (_ ("cannot stream blob %s" ),oid_to_hex (oid)); flags |=ZIP_STREAM ; out = buffer =NULL ;
@@ -348,7 +348,7 @@ static int write_zip_entry(struct archiver_args *args, buffer =object_file_to_archive (args, path, oid, mode, &type, &size);if (!buffer) -return error ("cannot read %s" , +return error (_ ("cannot read %s" ),oid_to_hex (oid)); crc =crc32 (crc, buffer, size); is_binary = entry_is_binary(path_without_prefix,
@@ -357,7 +357,7 @@ static int write_zip_entry(struct archiver_args *args, } compressed_size = (method ==0 ) ? size :0 ; }else { -return error ("unsupported file mode: 0%o (SHA1: %s)" , mode, +return error (_ ("unsupported file mode: 0%o (SHA1: %s)" ), mode,oid_to_hex (oid)); }
@@ -466,7 +466,7 @@ static int write_zip_entry(struct archiver_args *args, zstream.avail_in = readlen; result =git_deflate (&zstream,0 );if (result !=Z_OK ) -die ("deflate error (%d)" , result); +die (_ ("deflate error (%d)" ), result); out_len = zstream.next_out - compressed;if (out_len >0 ) {
@@ -601,7 +601,7 @@ static void dos_time(timestamp_t *timestamp, int *dos_date, int *dos_time)struct tm *t;if (date_overflows (*timestamp)) -die ("timestamp too large for this system: %" PRItime, +die (_ ("timestamp too large for this system: %" PRItime), *timestamp); time = (time_t)*timestamp; t =localtime (&time);
Signature · 1 line
2.18.0.rc2.476.g39500d3211
PATCH 4/23 builtin/config.c: mark more strings for translation
In reply to Nguyễn Thái Ngọc Duy--- builtin/config.c | 48 +++++++++++++++++++++---------------------- t/t1308-config-set.sh | 2 +- 2 files changed, 25 insertions(+), 25 deletions(-)
builtin/config.c +24 -24
@@ -110,7 +110,7 @@ static int option_parse_type(const struct option *opt, const char *arg,* --int' and '--type=bool * --type=int'. */ -error ("only one type at a time" ); +error (_ ("only one type at a time" ));usage_with_options (builtin_config_usage, builtin_config_options); }
@@ -161,9 +161,9 @@ static void check_argc(int argc, int min, int max) {if (argc >= min && argc <= max)return ;if (min == max) -error ("wrong number of arguments, should be %d" , min); +error (_ ("wrong number of arguments, should be %d" ), min);else -error ("wrong number of arguments, should be from %d to %d" , +error (_ ("wrong number of arguments, should be from %d to %d" ), min, max);usage_with_options (builtin_config_usage, builtin_config_options); }
@@ -297,7 +297,7 @@ static int get_value(const char *key_, const char *regex_) key_regexp = (regex_t *)xmalloc (sizeof (regex_t));if (regcomp (key_regexp, key,REG_EXTENDED )) { -error ("invalid key pattern: %s" , key_); +error (_ ("invalid key pattern: %s" ), key_);FREE_AND_NULL (key_regexp); ret =CONFIG_INVALID_PATTERN ; goto free_strings;
@@ -317,7 +317,7 @@ static int get_value(const char *key_, const char *regex_) regexp = (regex_t *)xmalloc (sizeof (regex_t));if (regcomp (regexp, regex_,REG_EXTENDED )) { -error ("invalid pattern: %s" , regex_); +error (_ ("invalid pattern: %s" ), regex_);FREE_AND_NULL (regexp); ret =CONFIG_INVALID_PATTERN ; goto free_strings;
@@ -390,7 +390,7 @@ static char *normalize_value(const char *key, const char *value)if (type ==TYPE_COLOR ) {char v[COLOR_MAXLEN ];if (git_config_color (v, key, value)) -die ("cannot parse color '%s'" , value); +die (_ ("cannot parse color '%s'" ), value);/* * The contents of `v` now contain an ANSI escape
@@ -485,13 +485,13 @@ static int get_colorbool(const char *var, int print)static void check_write (void ) {if (!given_config_source.file && !startup_info->have_repository) -die ("not in a git directory" ); +die (_ ("not in a git directory" ));if (given_config_source.use_stdin) -die ("writing to stdin is not supported" ); +die (_ ("writing to stdin is not supported" ));if (given_config_source.blob) -die ("writing config blobs is not supported" ); +die (_ ("writing config blobs is not supported" )); }struct urlmatch_current_candidate_value {
@@ -599,7 +599,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)if (use_global_config + use_system_config + use_local_config + !!given_config_source.file + !!given_config_source.blob >1 ) { -error ("only one config file at a time" ); +error (_ ("only one config file at a time" ));usage_with_options (builtin_config_usage, builtin_config_options); }
@@ -626,7 +626,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)* location; error out even if XDG_CONFIG_HOME * is set and points at a sane location. */ -die ("$HOME is not set" ); +die (_ ("$HOME is not set" ));if (access_or_warn (user_config,R_OK ,0 ) && xdg_config && !access_or_warn (xdg_config,R_OK ,0 )) {
@@ -663,12 +663,12 @@ int cmd_config(int argc, const char **argv, const char *prefix) }if ((actions & (ACTION_GET_COLOR |ACTION_GET_COLORBOOL )) && type) { -error ("--get-color and variable type are incoherent" ); +error (_ ("--get-color and variable type are incoherent" ));usage_with_options (builtin_config_usage, builtin_config_options); }if (HAS_MULTI_BITS (actions)) { -error ("only one action at a time" ); +error (_ ("only one action at a time" ));usage_with_options (builtin_config_usage, builtin_config_options); }if (actions ==0 )
@@ -681,19 +681,19 @@ int cmd_config(int argc, const char **argv, const char *prefix) }if (omit_values && !(actions ==ACTION_LIST || actions ==ACTION_GET_REGEXP )) { -error ("--name-only is only applicable to --list or --get-regexp" ); +error (_ ("--name-only is only applicable to --list or --get-regexp" ));usage_with_options (builtin_config_usage, builtin_config_options); }if (show_origin && !(actions & (ACTION_GET |ACTION_GET_ALL |ACTION_GET_REGEXP |ACTION_LIST ))) { -error ("--show-origin is only applicable to --get, --get-all, " -"--get-regexp, and --list." ); +error (_ ("--show-origin is only applicable to --get, --get-all, " +"--get-regexp, and --list" ));usage_with_options (builtin_config_usage, builtin_config_options); }if (default_value && !(actions &ACTION_GET )) { -error ("--default is only applicable to --get" ); +error (_ ("--default is only applicable to --get" ));usage_with_options (builtin_config_usage, builtin_config_options); }
@@ -707,10 +707,10 @@ int cmd_config(int argc, const char **argv, const char *prefix) &given_config_source, &config_options) < 0) {if (given_config_source.file) -die_errno ("unable to read config file '%s'" , +die_errno (_ ("unable to read config file '%s'" ), given_config_source.file);else -die ("error processing config file(s)" ); +die (_ ("error processing config file(s)" )); } }else if (actions ==ACTION_EDIT ) {
@@ -718,11 +718,11 @@ int cmd_config(int argc, const char **argv, const char *prefix)check_argc (argc,0 ,0 );if (!given_config_source.file && nongit) -die ("not in a git directory" ); +die (_ ("not in a git directory" ));if (given_config_source.use_stdin) -die ("editing stdin is not supported" ); +die (_ ("editing stdin is not supported" ));if (given_config_source.blob) -die ("editing blobs is not supported" ); +die (_ ("editing blobs is not supported" ));git_config (git_default_config,NULL ); config_file = given_config_source.file ? xstrdup(given_config_source.file) :
@@ -823,7 +823,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)if (ret <0 )return ret;if (ret ==0 ) -die ("no such section: %s" , argv[0 ]); +die (_ ("no such section: %s" ), argv[0 ]); }else if (actions ==ACTION_REMOVE_SECTION ) {int ret;
@@ -834,7 +834,7 @@ int cmd_config(int argc, const char **argv, const char *prefix)if (ret <0 )return ret;if (ret ==0 ) -die ("no such section: %s" , argv[0 ]); +die (_ ("no such section: %s" ), argv[0 ]); }else if (actions ==ACTION_GET_COLOR ) {check_argc (argc,1 ,2 );
t/t1308-config-set.sh +1 -1
@@ -233,7 +233,7 @@ test_expect_success 'check line errors for malformed values' ' test_expect_success 'error on modifying repo config without repo' ' nongit test_must_fail git config a.b c 2>err && - grep "not in a git directory" err + test_i18ngrep "not in a git directory" err ' cmdline_config="'foo.bar=from-cmdline'"
Signature · 1 line
2.18.0.rc2.476.g39500d3211
Re: [PATCH 04/23] builtin/config.c: mark more strings for translation
builtin/config.c int cmd_config(int argc, const char **argv, const char *prefix) · line 691
Quoted 6 lines · Nguyễn Thái Ngọc Duy
if (show_origin && !(actions & (ACTION_GET|ACTION_GET_ALL|ACTION_GET_REGEXP|ACTION_LIST))) {builtin/config.c +2
-2-error ("--show-origin is only applicable to --get, --get-all, " -"--get-regexp, and --list." ); +error (_ ("--show-origin is only applicable to --get, --get-all, " +"--get-regexp, and --list" ));
I would have expected the fullstop removal to have been part of patch 1 instead of this patch.
Didn't spot any other issues.
PATCH 5/23 builtin/grep.c: mark strings for translation and no full stops
In reply to Nguyễn Thái Ngọc Duy--- builtin/grep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
builtin/grep.c +1 -1
@@ -489,7 +489,7 @@ static int grep_cache(struct grep_opt *opt, struct repository *repo, }if (repo_read_index (repo) <0 ) -die ("index file corrupt" ); +die (_ ("index file corrupt" ));for (nr =0 ; nr < repo->index->cache_nr; nr++) {const struct cache_entry *ce = repo->index->cache[nr];
Signature · 1 line
2.18.0.rc2.476.g39500d3211
PATCH 6/23 builtin/pack-objects.c: mark more strings for translation
In reply to Nguyễn Thái Ngọc DuyMost of these are straight forward. GETTEXT_POISON does catch the last string in cmd_pack_objects(), but since this is --progress output, it's not supposed to be machine-readable.
--- builtin/pack-objects.c | 108 +++++++++++++++++++++-------------------- t/t5500-fetch-pack.sh | 2 +- 2 files changed, 56 insertions(+), 54 deletions(-)
builtin/pack-objects.c +55 -53
@@ -140,7 +140,7 @@ static void *get_delta(struct object_entry *entry) buf =read_object_file (&entry->idx.oid, &type, &size);if (!buf) -die ("unable to read %s" ,oid_to_hex (&entry->idx.oid)); +die (_ ("unable to read %s" ),oid_to_hex (&entry->idx.oid)); base_buf =read_object_file (&DELTA (entry)->idx.oid, &type, &base_size);if (!base_buf)
@@ -149,7 +149,7 @@ static void *get_delta(struct object_entry *entry) delta_buf =diff_delta (base_buf, base_size, buf, size, &delta_size,0 );if (!delta_buf || delta_size !=DELTA_SIZE (entry)) -die ("delta size changed" ); +die (_ ("delta size changed" ));free (buf);free (base_buf);return delta_buf;
@@ -406,7 +406,7 @@ static off_t write_reuse_object(struct hashfile *f, struct object_entry *entry, datalen = revidx[1 ].offset - offset;if (!pack_to_stdout && p->index_version >1 &&check_pack_crc (p, &w_curs, offset, datalen, revidx->nr)) { -error ("bad packed object CRC for %s" , +error (_ ("bad packed object CRC for %s" ),oid_to_hex (&entry->idx.oid));unuse_pack (&w_curs);return write_no_reuse_object (f, entry, limit, usable_delta);
@@ -417,7 +417,7 @@ static off_t write_reuse_object(struct hashfile *f, struct object_entry *entry,if (!pack_to_stdout && p->index_version ==1 &&check_pack_inflate (p, &w_curs, offset, datalen, entry_size)) { -error ("corrupt packed object for %s" , +error (_ ("corrupt packed object for %s" ),oid_to_hex (&entry->idx.oid));unuse_pack (&w_curs);return write_no_reuse_object (f, entry, limit, usable_delta);
@@ -548,7 +548,7 @@ static enum write_one_status write_one(struct hashfile *f,*/ recursing = (e->idx.offset ==1 );if (recursing) { -warning ("recursive delta detected for object %s" , +warning (_ ("recursive delta detected for object %s" ),oid_to_hex (&e->idx.oid));return WRITE_ONE_RECURSIVE ; }else if (e->idx.offset || e->preferred_base) {
@@ -582,7 +582,7 @@ static enum write_one_status write_one(struct hashfile *f,/* make sure off_t is sufficiently large not to wrap */ if (signed_add_overflows (*offset, size)) -die ("pack too large for current definition of off_t" ); +die (_ ("pack too large for current definition of off_t" )); *offset += size;return WRITE_ONE_WRITTEN ; }
@@ -748,7 +748,8 @@ static struct object_entry **compute_write_order(void) }if (wo_end != to_pack.nr_objects) -die ("ordered %u objects, expected %" PRIu32, wo_end, to_pack.nr_objects); +die (_ ("ordered %u objects, expected %" PRIu32), + wo_end, to_pack.nr_objects);return wo; }
@@ -760,15 +761,15 @@ static off_t write_reused_pack(struct hashfile *f)int fd;if (!is_pack_valid (reuse_packfile)) -die ("packfile is invalid: %s" , reuse_packfile->pack_name); +die (_ ("packfile is invalid: %s" ), reuse_packfile->pack_name); fd =git_open (reuse_packfile->pack_name);if (fd <0 ) -die_errno ("unable to open packfile for reuse: %s" , +die_errno (_ ("unable to open packfile for reuse: %s" ), reuse_packfile->pack_name);if (lseek (fd,sizeof (struct pack_header ),SEEK_SET ) ==-1 ) -die_errno ("unable to seek in reused packfile" ); +die_errno (_ ("unable to seek in reused packfile" ));if (reuse_packfile_offset <0 ) reuse_packfile_offset = reuse_packfile->pack_size - the_hash_algo->rawsz;
@@ -779,7 +780,7 @@ static off_t write_reused_pack(struct hashfile *f)int read_pack =xread (fd, buffer,sizeof (buffer));if (read_pack <=0 ) -die_errno ("unable to read from reused packfile" ); +die_errno (_ ("unable to read from reused packfile" ));if (read_pack > to_write) read_pack = to_write;
@@ -882,7 +883,7 @@ static void write_pack_file(void)* to preserve this property. */ if (stat (pack_tmp_name, &st) <0 ) { -warning_errno ("failed to stat %s" , pack_tmp_name); +warning_errno (_ ("failed to stat %s" ), pack_tmp_name); }else if (!last_mtime) { last_mtime = st.st_mtime; }else {
@@ -890,7 +891,7 @@ static void write_pack_file(void) utb.actime = st.st_atime; utb.modtime = --last_mtime;if (utime (pack_tmp_name, &utb) <0 ) -warning_errno ("failed utime() on %s" , pack_tmp_name); +warning_errno (_ ("failed utime() on %s" ), pack_tmp_name); }strbuf_addf (&tmpname,"%s-" , base_name);
@@ -935,8 +936,8 @@ static void write_pack_file(void)free (write_order);stop_progress (&progress_state);if (written != nr_result) -die ("wrote %" PRIu32" objects while expecting %" PRIu32, - written, nr_result); +die (_ ("wrote %" PRIu32" objects while expecting %" PRIu32), + written, nr_result); }static int no_try_delta (const char *path)
@@ -1480,7 +1481,7 @@ static void check_object(struct object_entry *entry)while (c &128 ) { ofs +=1 ;if (!ofs ||MSB (ofs,7 )) { -error ("delta base offset overflow in pack for %s" , +error (_ ("delta base offset overflow in pack for %s" ),oid_to_hex (&entry->idx.oid)); goto give_up; }
@@ -1489,7 +1490,7 @@ static void check_object(struct object_entry *entry) } ofs = entry->in_pack_offset - ofs;if (ofs <=0 || ofs >= entry->in_pack_offset) { -error ("delta base offset out of bound for %s" , +error (_ ("delta base offset out of bound for %s" ),oid_to_hex (&entry->idx.oid)); goto give_up; }
@@ -1974,10 +1975,10 @@ static int try_delta(struct unpacked *trg, struct unpacked *src, trg->data =read_object_file (&trg_entry->idx.oid, &type, &sz);read_unlock ();if (!trg->data) -die ("object %s cannot be read" , +die (_ ("object %s cannot be read" ),oid_to_hex (&trg_entry->idx.oid));if (sz != trg_size) -die ("object %s inconsistent object length (%lu vs %lu)" , +die (_ ("object %s inconsistent object length (%lu vs %lu)" ),oid_to_hex (&trg_entry->idx.oid), sz, trg_size); *mem_usage += sz;
@@ -1990,7 +1991,7 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,if (src_entry->preferred_base) {static int warned =0 ;if (!warned++) -warning ("object %s cannot be read" , +warning (_ ("object %s cannot be read" ),oid_to_hex (&src_entry->idx.oid));/* * Those objects are not included in the
@@ -2000,11 +2001,11 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,*/ return 0 ; } -die ("object %s cannot be read" , +die (_ ("object %s cannot be read" ),oid_to_hex (&src_entry->idx.oid)); }if (sz != src_size) -die ("object %s inconsistent object length (%lu vs %lu)" , +die (_ ("object %s inconsistent object length (%lu vs %lu)" ),oid_to_hex (&src_entry->idx.oid), sz, src_size); *mem_usage += sz;
@@ -2014,7 +2015,7 @@ static int try_delta(struct unpacked *trg, struct unpacked *src,if (!src->index) {static int warned =0 ;if (!warned++) -warning ("suboptimal pack - out of memory" ); +warning (_ ("suboptimal pack - out of memory" ));return 0 ; } *mem_usage +=sizeof_delta_index (src->index);
@@ -2341,8 +2342,8 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size,return ; }if (progress > pack_to_stdout) -fprintf_ln (stderr,"Delta compression using up to %d threads." , - delta_search_threads); +fprintf_ln (stderr,_ ("Delta compression using up to %d threads" ), + delta_search_threads); p =xcalloc (delta_search_threads,sizeof (*p));/* Partition the work amongst work threads. */
@@ -2382,7 +2383,7 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size, ret =pthread_create (&p[i].thread,NULL , threaded_find_deltas, &p[i]);if (ret) -die ("unable to create thread: %s" ,strerror (ret)); +die (_ ("unable to create thread: %s" ),strerror (ret)); active_threads++; }
@@ -2477,7 +2478,7 @@ static void add_tag_chain(const struct object_id *oid) tag =lookup_tag (oid);while (1 ) {if (!tag ||parse_tag (tag) || !tag->tagged) -die ("unable to pack objects reachable from tag %s" , +die (_ ("unable to pack objects reachable from tag %s" ),oid_to_hex (oid));add_object_entry (&tag->object.oid,OBJ_TAG ,NULL ,0 );
@@ -2543,7 +2544,7 @@ static void prepare_pack(int window, int depth)if (!entry->preferred_base) { nr_deltas++;if (oe_type (entry) <0 ) -die ("unable to get type of object %s" , +die (_ ("unable to get type of object %s" ),oid_to_hex (&entry->idx.oid)); }else {if (oe_type (entry) <0 ) {
@@ -2567,7 +2568,7 @@ static void prepare_pack(int window, int depth)ll_find_deltas (delta_list, n, window+1 , depth, &nr_done);stop_progress (&progress_state);if (nr_done != nr_deltas) -die ("inconsistency with delta count" ); +die (_ ("inconsistency with delta count" )); }free (delta_list); }
@@ -2607,11 +2608,11 @@ static int git_pack_config(const char *k, const char *v, void *cb)if (!strcmp (k,"pack.threads" )) { delta_search_threads =git_config_int (k, v);if (delta_search_threads <0 ) -die ("invalid number of threads specified (%d)" , +die (_ ("invalid number of threads specified (%d)" ), delta_search_threads);#ifdef NO_PTHREADS if (delta_search_threads !=1 ) { -warning ("no threads support, ignoring %s" , k); +warning (_ ("no threads support, ignoring %s" ), k); delta_search_threads =0 ; }#endif
@@ -2620,7 +2621,7 @@ static int git_pack_config(const char *k, const char *v, void *cb)if (!strcmp (k,"pack.indexversion" )) { pack_idx_opts.version =git_config_int (k, v);if (pack_idx_opts.version >2 ) -die ("bad pack.indexversion=%" PRIu32, +die (_ ("bad pack.indexversion=%" PRIu32), pack_idx_opts.version);return 0 ; }
@@ -2646,13 +2647,13 @@ static void read_object_list_from_stdin(void) }if (line[0 ] =='-' ) {if (get_oid_hex (line+1 , &oid)) -die ("expected edge object ID, got garbage:\n %s" , +die (_ ("expected edge object ID, got garbage:\n %s" ), line);add_preferred_base (&oid);continue ; }if (parse_oid_hex (line, &oid, &p)) -die ("expected object ID, got garbage:\n %s" , line); +die (_ ("expected object ID, got garbage:\n %s" ), line);add_preferred_base_object (p +1 );add_object_entry (&oid,OBJ_NONE , p +1 ,0 );
@@ -2791,7 +2792,7 @@ static void add_objects_in_unpacked_packs(struct rev_info *revs)if (!p->pack_local || p->pack_keep || p->pack_keep_in_core)continue ;if (open_pack_index (p)) -die ("cannot open pack index" ); +die (_ ("cannot open pack index" )); ALLOC_GROW(in_pack.array, in_pack.nr + p->num_objects,
@@ -2822,7 +2823,7 @@ static int add_loose_object(const struct object_id *oid, const char *path,enum object_type type =oid_object_info (the_repository, oid,NULL );if (type <0 ) { -warning ("loose object at %s could not be examined" , path); +warning (_ ("loose object at %s could not be examined" ), path);return 0 ; }
@@ -2899,7 +2900,7 @@ static void loosen_unused_packed_objects(struct rev_info *revs)continue ;if (open_pack_index (p)) -die ("cannot open pack index" ); +die (_ ("cannot open pack index" ));for (i =0 ; i < p->num_objects; i++) {nth_packed_object_oid (&oid, p, i);
@@ -2907,7 +2908,7 @@ static void loosen_unused_packed_objects(struct rev_info *revs) !has_sha1_pack_kept_or_nonlocal(&oid) && !loosened_object_can_be_discarded(&oid, p->mtime))if (force_object_loose (&oid, p->mtime)) -die ("unable to force loose object" ); +die (_ ("unable to force loose object" )); } } }
@@ -2991,17 +2992,17 @@ static void get_object_list(int ac, const char **av) use_bitmap_index =0 ;continue ; } -die ("not a rev '%s'" , line); +die (_ ("not a rev '%s'" ), line); }if (handle_revision_arg (line, &revs, flags,REVARG_CANNOT_BE_FILENAME )) -die ("bad revision '%s'" , line); +die (_ ("bad revision '%s'" ), line); }if (use_bitmap_index && !get_object_list_from_bitmap (&revs))return ;if (prepare_revision_walk (&revs)) -die ("revision walk setup failed" ); +die (_ ("revision walk setup failed" ));mark_edges_uninteresting (&revs, show_edge);if (!fn_show_object)
@@ -3014,9 +3015,9 @@ static void get_object_list(int ac, const char **av) revs.ignore_missing_links =1 ;if (add_unseen_recent_objects_to_traversal (&revs, unpack_unreachable_expiration)) -die ("unable to add recent objects" ); +die (_ ("unable to add recent objects" ));if (prepare_revision_walk (&revs)) -die ("revision walk setup failed" ); +die (_ ("revision walk setup failed" ));traverse_commit_list (&revs, record_recent_commit, record_recent_object,NULL ); }
@@ -3251,35 +3252,35 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)if (pack_compression_level ==-1 ) pack_compression_level =Z_DEFAULT_COMPRESSION ;else if (pack_compression_level <0 || pack_compression_level >Z_BEST_COMPRESSION ) -die ("bad pack compression level %d" , pack_compression_level); +die (_ ("bad pack compression level %d" ), pack_compression_level);if (!delta_search_threads)/* --threads=0 means autodetect */ delta_search_threads =online_cpus ();#ifdef NO_PTHREADS if (delta_search_threads !=1 ) -warning ("no threads support, ignoring --threads" ); +warning (_ ("no threads support, ignoring --threads" ));#endif if (!pack_to_stdout && !pack_size_limit) pack_size_limit = pack_size_limit_cfg;if (pack_to_stdout && pack_size_limit) -die ("--max-pack-size cannot be used to build a pack for transfer." ); +die (_ ("--max-pack-size cannot be used to build a pack for transfer" ));if (pack_size_limit && pack_size_limit <1024 *1024 ) { -warning ("minimum pack size limit is 1 MiB" ); +warning (_ ("minimum pack size limit is 1 MiB" )); pack_size_limit =1024 *1024 ; }if (!pack_to_stdout && thin) -die ("--thin cannot be used to build an indexable pack." ); +die (_ ("--thin cannot be used to build an indexable pack" ));if (keep_unreachable && unpack_unreachable) -die ("--keep-unreachable and --unpack-unreachable are incompatible." ); +die (_ ("--keep-unreachable and --unpack-unreachable are incompatible" ));if (!rev_list_all || !rev_list_reflog || !rev_list_index) unpack_unreachable_expiration =0 ;if (filter_options.choice) {if (!pack_to_stdout) -die ("cannot use --filter without --stdout." ); +die (_ ("cannot use --filter without --stdout" )); use_bitmap_index =0 ; }
@@ -3353,8 +3354,9 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)prepare_pack (window, depth);write_pack_file ();if (progress) -fprintf_ln (stderr,"Total %" PRIu32" (delta %" PRIu32")," -" reused %" PRIu32" (delta %" PRIu32")" , - written, written_delta, reused, reused_delta); +fprintf_ln (stderr, +_ ("Total %" PRIu32" (delta %" PRIu32")," +" reused %" PRIu32" (delta %" PRIu32")" ), + written, written_delta, reused, reused_delta);return 0 ; }
t/t5500-fetch-pack.sh +1 -1
@@ -403,7 +403,7 @@ test_expect_success 'fetch creating new shallow root' ' git fetch --depth=1 --progress 2>actual && # This should fetch only the empty commit, no tree or # blob objects - grep "remote: Total 1" actual + test_i18ngrep "remote: Total 1" actual ) '
Signature · 1 line
2.18.0.rc2.476.g39500d3211
Re: [PATCH 06/23] builtin/pack-objects.c: mark more strings for translation
builtin/pack-objects.c static void ll_find_deltas(struct object_entry **list, unsigned list_size, · line 2346
Quoted 13 lines · Nguyễn Thái Ngọc Duy
Most of these are straight forward.
GETTEXT_POISONdoes catch the last string incmd_pack_objects(), but since this is --progress output, it's not supposed to be machine-readable.builtin/pack-objects.c +2
-2@@ -2341,8 +2342,8 @@ static void ll_find_deltas(struct object_entry **list, unsigned list_size,return ; }if (progress > pack_to_stdout) -fprintf_ln (stderr,"Delta compression using up to %d threads." , - delta_search_threads); +fprintf_ln (stderr,_ ("Delta compression using up to %d threads" ), + delta_search_threads);
Full stop removal that probably belongs in patch 1 instead.
builtin/pack-objects.c int cmd_pack_objects(int argc, const char **argv, const char *prefix) · line 3267
Quoted 5 lines
builtin/pack-objects.c +1
-1if (!pack_to_stdout && !pack_size_limit) pack_size_limit = pack_size_limit_cfg;if (pack_to_stdout && pack_size_limit) -die ("--max-pack-size cannot be used to build a pack for transfer." ); +die (_ ("--max-pack-size cannot be used to build a pack for transfer" ));
same.
builtin/pack-objects.c int cmd_pack_objects(int argc, const char **argv, const char *prefix) · line 3277
Quoted 3 lines
if (keep_unreachable && unpack_unreachable)builtin/pack-objects.c +1
-1-die ("--keep-unreachable and --unpack-unreachable are incompatible." ); +die (_ ("--keep-unreachable and --unpack-unreachable are incompatible" ));
same.
builtin/pack-objects.c int cmd_pack_objects(int argc, const char **argv, const char *prefix) · line 3283
Quoted 4 lines
if (filter_options.choice) { if (!pack_to_stdout)builtin/pack-objects.c +1
-1-die ("cannot use --filter without --stdout." ); +die (_ ("cannot use --filter without --stdout" ));
same.
PATCH 7/23 builtin/replace.c: mark more strings for translation
In reply to Nguyễn Thái Ngọc Duy--- builtin/replace.c | 82 +++++++++++++++++++++++------------------------ 1 file changed, 41 insertions(+), 41 deletions(-)
builtin/replace.c +41 -41
@@ -54,7 +54,7 @@ static int show_reference(const char *refname, const struct object_id *oid,enum object_type obj_type, repl_type;if (get_oid (refname, &object)) -return error ("failed to resolve '%s' as a valid ref" , refname); +return error (_ ("failed to resolve '%s' as a valid ref" ), refname); obj_type =oid_object_info (the_repository, &object,NULL );
@@ -83,8 +83,8 @@ static int list_replace_refs(const char *pattern, const char *format)else if (!strcmp (format,"long" )) data.format =REPLACE_FORMAT_LONG ;else -return error ("invalid replace format '%s'\n" -"valid formats are 'short', 'medium' and 'long'\n" , +return error (_ ("invalid replace format '%s'\n" +"valid formats are 'short', 'medium' and 'long'" ), format);for_each_replace_ref (the_repository, show_reference, (void *)&data);
@@ -118,7 +118,7 @@ static int for_each_replace_name(const char **argv, each_replace_name_fn fn) full_hex = ref.buf + base_len;if (read_ref (ref.buf, &oid)) { -error ("replace ref '%s' not found" , full_hex); +error (_ ("replace ref '%s' not found" ), full_hex); had_error =1 ;continue ; }
@@ -134,7 +134,7 @@ static int delete_replace_ref(const char *name, const char *ref, {if (delete_ref (NULL , ref, oid,0 ))return 1 ; -printf_ln ("Deleted replace ref '%s'" , name); +printf_ln (_ ("Deleted replace ref '%s'" ), name);return 0 ; }
@@ -146,12 +146,12 @@ static int check_ref_valid(struct object_id *object,strbuf_reset (ref);strbuf_addf (ref,"%s%s" , git_replace_ref_base,oid_to_hex (object));if (check_refname_format (ref->buf,0 )) -return error ("'%s' is not a valid ref name" , ref->buf); +return error (_ ("'%s' is not a valid ref name" ), ref->buf);if (read_ref (ref->buf, prev))oidclr (prev);else if (!force) -return error ("replace ref '%s' already exists" , ref->buf); +return error (_ ("replace ref '%s' already exists" ), ref->buf);return 0 ; }
@@ -171,10 +171,10 @@ static int replace_object_oid(const char *object_ref, obj_type =oid_object_info (the_repository, object,NULL ); repl_type =oid_object_info (the_repository, repl,NULL );if (!force && obj_type != repl_type) -return error ("Objects must be of the same type.\n" -"'%s' points to a replaced object of type '%s'\n" -"while '%s' points to a replacement object of " -"type '%s'." , +return error (_ ("Objects must be of the same type.\n" +"'%s' points to a replaced object of type '%s'\n" +"while '%s' points to a replacement object of " +"type '%s'." ), object_ref,type_name (obj_type), replace_ref,type_name (repl_type));
@@ -200,10 +200,10 @@ static int replace_object(const char *object_ref, const char *replace_ref, int fstruct object_id object, repl;if (get_oid (object_ref, &object)) -return error ("failed to resolve '%s' as a valid ref" , +return error (_ ("failed to resolve '%s' as a valid ref" ), object_ref);if (get_oid (replace_ref, &repl)) -return error ("failed to resolve '%s' as a valid ref" , +return error (_ ("failed to resolve '%s' as a valid ref" ), replace_ref);return replace_object_oid (object_ref, &object, replace_ref, &repl, force);
@@ -222,7 +222,7 @@ static int export_object(const struct object_id *oid, enum object_type type, fd =open (filename,O_WRONLY |O_CREAT |O_TRUNC ,0666 );if (fd <0 ) -return error_errno ("unable to open %s for writing" , filename); +return error_errno (_ ("unable to open %s for writing" ), filename);argv_array_push (&cmd.args,"--no-replace-objects" );argv_array_push (&cmd.args,"cat-file" );
@@ -235,7 +235,7 @@ static int export_object(const struct object_id *oid, enum object_type type, cmd.out = fd;if (run_command (&cmd)) -return error ("cat-file reported failure" ); +return error (_ ("cat-file reported failure" ));return 0 ; }
@@ -251,7 +251,7 @@ static int import_object(struct object_id *oid, enum object_type type, fd =open (filename,O_RDONLY );if (fd <0 ) -return error_errno ("unable to open %s for reading" , filename); +return error_errno (_ ("unable to open %s for reading" ), filename);if (!raw && type ==OBJ_TREE ) {const char *argv[] = {"mktree" ,NULL };
@@ -265,11 +265,11 @@ static int import_object(struct object_id *oid, enum object_type type,if (start_command (&cmd)) {close (fd); -return error ("unable to spawn mktree" ); +return error (_ ("unable to spawn mktree" )); }if (strbuf_read (&result, cmd.out,41 ) <0 ) { -error_errno ("unable to read from mktree" ); +error_errno (_ ("unable to read from mktree" ));close (fd);close (cmd.out);return -1 ;
@@ -278,11 +278,11 @@ static int import_object(struct object_id *oid, enum object_type type,if (finish_command (&cmd)) {strbuf_release (&result); -return error ("mktree reported failure" ); +return error (_ ("mktree reported failure" )); }if (get_oid_hex (result.buf, oid) <0 ) {strbuf_release (&result); -return error ("mktree did not return an object name" ); +return error (_ ("mktree did not return an object name" )); }strbuf_release (&result);
@@ -291,12 +291,12 @@ static int import_object(struct object_id *oid, enum object_type type,int flags =HASH_FORMAT_CHECK |HASH_WRITE_OBJECT ;if (fstat (fd, &st) <0 ) { -error_errno ("unable to fstat %s" , filename); +error_errno (_ ("unable to fstat %s" ), filename);close (fd);return -1 ; }if (index_fd (oid, fd, &st, type,NULL , flags) <0 ) -return error ("unable to write object to database" ); +return error (_ ("unable to write object to database" ));/* index_fd close()s fd for us */ }
@@ -315,11 +315,11 @@ static int edit_and_replace(const char *object_ref, int force, int raw)struct strbuf ref =STRBUF_INIT ;if (get_oid (object_ref, &old_oid) <0 ) -return error ("not a valid object name: '%s'" , object_ref); +return error (_ ("not a valid object name: '%s'" ), object_ref); type =oid_object_info (the_repository, &old_oid,NULL );if (type <0 ) -return error ("unable to get object type for %s" , +return error (_ ("unable to get object type for %s" ),oid_to_hex (&old_oid));if (check_ref_valid (&old_oid, &prev, &ref, force)) {
@@ -335,7 +335,7 @@ static int edit_and_replace(const char *object_ref, int force, int raw) }if (launch_editor (tmpfile,NULL ,NULL ) <0 ) {free (tmpfile); -return error ("editing object file failed" ); +return error (_ ("editing object file failed" )); }if (import_object (&new_oid, type, raw, tmpfile)) {free (tmpfile);
@@ -344,7 +344,7 @@ static int edit_and_replace(const char *object_ref, int force, int raw)free (tmpfile);if (!oidcmp (&old_oid, &new_oid)) -return error ("new object is the same as the old one: '%s'" ,oid_to_hex (&old_oid)); +return error (_ ("new object is the same as the old one: '%s'" ),oid_to_hex (&old_oid));return replace_object_oid (object_ref, &old_oid,"replacement" , &new_oid, force); }
@@ -456,10 +456,10 @@ static int create_graft(int argc, const char **argv, int force, int gentle)return -1 ; } -if (remove_signature (&buf)) { -warning (_ ("the original commit '%s' has a gpg signature." ), old_ref); -warning (_ ("the signature will be removed in the replacement commit!" )); - } +if (remove_signature (&buf)) +warning (_ ("the original commit '%s' has a gpg signature.\n" +"The signature will be removed in the replacement commit!" ), + old_ref);if (check_mergetags (commit, argc, argv)) {strbuf_release (&buf);
@@ -476,10 +476,10 @@ static int create_graft(int argc, const char **argv, int force, int gentle)if (!oidcmp (&old_oid, &new_oid)) {if (gentle) { -warning ("graft for '%s' unnecessary" ,oid_to_hex (&old_oid)); +warning (_ ("graft for '%s' unnecessary" ),oid_to_hex (&old_oid));return 0 ; } -return error ("new commit is the same as the old one: '%s'" ,oid_to_hex (&old_oid)); +return error (_ ("new commit is the same as the old one: '%s'" ),oid_to_hex (&old_oid)); }return replace_object_oid (old_ref, &old_oid,"replacement" , &new_oid, force);
@@ -553,7 +553,7 @@ int cmd_replace(int argc, const char **argv, const char *prefix) cmdmode = argc ?MODE_REPLACE :MODE_LIST ;if (format && cmdmode !=MODE_LIST ) -usage_msg_opt ("--format cannot be used when not listing" , +usage_msg_opt (_ ("--format cannot be used when not listing" ), git_replace_usage, options); if (force &&
@@ -561,47 +561,47 @@ int cmd_replace(int argc, const char **argv, const char *prefix) cmdmode != MODE_EDIT && cmdmode != MODE_GRAFT && cmdmode != MODE_CONVERT_GRAFT_FILE) -usage_msg_opt ("-f only makes sense when writing a replacement" , +usage_msg_opt (_ ("-f only makes sense when writing a replacement" ), git_replace_usage, options);if (raw && cmdmode !=MODE_EDIT ) -usage_msg_opt ("--raw only makes sense with --edit" , +usage_msg_opt (_ ("--raw only makes sense with --edit" ), git_replace_usage, options);switch (cmdmode) {case MODE_DELETE :if (argc <1 ) -usage_msg_opt ("-d needs at least one argument" , +usage_msg_opt (_ ("-d needs at least one argument" ), git_replace_usage, options);return for_each_replace_name (argv, delete_replace_ref);case MODE_REPLACE :if (argc !=2 ) -usage_msg_opt ("bad number of arguments" , +usage_msg_opt (_ ("bad number of arguments" ), git_replace_usage, options);return replace_object (argv[0 ], argv[1 ], force);case MODE_EDIT :if (argc !=1 ) -usage_msg_opt ("-e needs exactly one argument" , +usage_msg_opt (_ ("-e needs exactly one argument" ), git_replace_usage, options);return edit_and_replace (argv[0 ], force, raw);case MODE_GRAFT :if (argc <1 ) -usage_msg_opt ("-g needs at least one argument" , +usage_msg_opt (_ ("-g needs at least one argument" ), git_replace_usage, options);return create_graft (argc, argv, force,0 );case MODE_CONVERT_GRAFT_FILE :if (argc !=0 ) -usage_msg_opt ("--convert-graft-file takes no argument" , +usage_msg_opt (_ ("--convert-graft-file takes no argument" ), git_replace_usage, options);return !!convert_graft_file (force);case MODE_LIST :if (argc >1 ) -usage_msg_opt ("only one pattern can be given with -l" , +usage_msg_opt (_ ("only one pattern can be given with -l" ), git_replace_usage, options);return list_replace_refs (argv[0 ], format);
Signature · 1 line
2.18.0.rc2.476.g39500d3211
Re: [PATCH 07/23] builtin/replace.c: mark more strings for translation
builtin/replace.c static int list_replace_refs(const char *pattern, const char *format) · line 87
Quoted 10 lines · Nguyễn Thái Ngọc Duy
Signed-off-by Nguyễn Thái Ngọc Duy <[email protected]>--- builtin/replace.c | 82 +++++++++++++++++++++++------------------------ 1 file changed, 41 insertions(+), 41 deletions(-)builtin/replace.c +2
-2- return error("invalid replace format '%s'\n" - "valid formats are 'short', 'medium' and 'long'\n", + return error(_("invalid replace format '%s'\n" + "valid formats are 'short', 'medium' and 'long'"),
Was the removal of the trailing newline intentional? If so, move it to patch 1?
builtin/replace.c static int create_graft(int argc, const char **argv, int force, int gentle) · line 462
Quoted 12 lines
builtin/replace.c +4
-4@@ -456,10 +456,10 @@ static int create_graft(int argc, const char **argv, int force, int gentle)return -1 ; } -if (remove_signature (&buf)) { -warning (_ ("the original commit '%s' has a gpg signature." ), old_ref); -warning (_ ("the signature will be removed in the replacement commit!" )); - } +if (remove_signature (&buf)) +warning (_ ("the original commit '%s' has a gpg signature.\n" +"The signature will be removed in the replacement commit!" ), + old_ref);
More message changes that probably belong in patch 1 for consistency.
PATCH 8/23 commit-graph.c: mark more strings for translation
In reply to Nguyễn Thái Ngọc Duy--- commit-graph.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
commit-graph.c +10 -10
@@ -77,28 +77,28 @@ struct commit_graph *load_commit_graph_one(const char *graph_file)if (graph_size <GRAPH_MIN_SIZE ) {close (fd); -die ("graph file %s is too small" , graph_file); +die (_ ("graph file %s is too small" ), graph_file); } graph_map =xmmap (NULL , graph_size,PROT_READ ,MAP_PRIVATE , fd,0 ); data = (const unsigned char *)graph_map; graph_signature =get_be32 (data);if (graph_signature !=GRAPH_SIGNATURE ) { -error ("graph signature %X does not match signature %X" , +error (_ ("graph signature %X does not match signature %X" ), graph_signature,GRAPH_SIGNATURE ); goto cleanup_fail; } graph_version = *(unsigned char *)(data +4 );if (graph_version !=GRAPH_VERSION ) { -error ("graph version %X does not match version %X" , +error (_ ("graph version %X does not match version %X" ), graph_version,GRAPH_VERSION ); goto cleanup_fail; } hash_version = *(unsigned char *)(data +5 );if (hash_version !=GRAPH_OID_VERSION ) { -error ("hash version %X does not match version %X" , +error (_ ("hash version %X does not match version %X" ), hash_version,GRAPH_OID_VERSION ); goto cleanup_fail; }
@@ -122,7 +122,7 @@ struct commit_graph *load_commit_graph_one(const char *graph_file) chunk_lookup +=GRAPH_CHUNKLOOKUP_WIDTH ;if (chunk_offset > graph_size -GIT_MAX_RAWSZ ) { -error ("improper chunk offset %08x%08x" , (uint32_t )(chunk_offset >>32 ), +error (_ ("improper chunk offset %08x%08x" ), (uint32_t )(chunk_offset >>32 ), (uint32_t )chunk_offset); goto cleanup_fail; }
@@ -158,7 +158,7 @@ struct commit_graph *load_commit_graph_one(const char *graph_file) }if (chunk_repeated) { -error ("chunk id %08x appears multiple times" , chunk_id); +error (_ ("chunk id %08x appears multiple times" ), chunk_id); goto cleanup_fail; }
@@ -244,7 +244,7 @@ static struct commit_list **insert_parent_or_die(struct commit_graph *g,hashcpy (oid.hash, g->chunk_oid_lookup + g->hash_len * pos); c =lookup_commit (&oid);if (!c) -die ("could not find commit %s" ,oid_to_hex (&oid)); +die (_ ("could not find commit %s" ),oid_to_hex (&oid)); c->graph_pos = pos;return &commit_list_insert (c, pptr)->next; }
@@ -537,7 +537,7 @@ static int add_packed_commits(const struct object_id *oid, oi.typep = &type;if (packed_object_info (the_repository, pack, offset, &oi) <0 ) -die ("unable to get type of object %s" ,oid_to_hex (oid)); +die (_ ("unable to get type of object %s" ),oid_to_hex (oid));if (type !=OBJ_COMMIT )return 0 ;
@@ -683,9 +683,9 @@ void write_commit_graph(const char *obj_dir,strbuf_addstr (&packname, pack_indexes[i]); p =add_packed_git (packname.buf, packname.len,1 );if (!p) -die ("error adding pack %s" , packname.buf); +die (_ ("error adding pack %s" ), packname.buf);if (open_pack_index (p)) -die ("error opening index for %s" , packname.buf); +die (_ ("error opening index for %s" ), packname.buf);for_each_object_in_pack (p, add_packed_commits, &oids);close_pack (p); }
Signature · 1 line
2.18.0.rc2.476.g39500d3211
Re: [PATCH 08/23] commit-graph.c: mark more strings for translation
Quoted 80 lines · Nguyễn Thái Ngọc Duy
Signed-off-by Nguyễn Thái Ngọc Duy <[email protected]>--- commit-graph.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)commit-graph.c +8
-8@@ -77,28 +77,28 @@ struct commit_graph *load_commit_graph_one(const char *graph_file)if (graph_size <GRAPH_MIN_SIZE ) {close (fd); -die ("graph file %s is too small" , graph_file); +die (_ ("graph file %s is too small" ), graph_file); } graph_map =xmmap (NULL , graph_size,PROT_READ ,MAP_PRIVATE , fd,0 ); data = (const unsigned char *)graph_map; graph_signature =get_be32 (data);if (graph_signature !=GRAPH_SIGNATURE ) { -error ("graph signature %X does not match signature %X" , +error (_ ("graph signature %X does not match signature %X" ), graph_signature,GRAPH_SIGNATURE ); goto cleanup_fail; } graph_version = *(unsigned char *)(data +4 );if (graph_version !=GRAPH_VERSION ) { -error ("graph version %X does not match version %X" , +error (_ ("graph version %X does not match version %X" ), graph_version,GRAPH_VERSION ); goto cleanup_fail; } hash_version = *(unsigned char *)(data +5 );if (hash_version !=GRAPH_OID_VERSION ) { -error ("hash version %X does not match version %X" , +error (_ ("hash version %X does not match version %X" ), hash_version,GRAPH_OID_VERSION ); goto cleanup_fail; }@@ -122,7 +122,7 @@ struct commit_graph *load_commit_graph_one(const char *graph_file) chunk_lookup +=GRAPH_CHUNKLOOKUP_WIDTH ;if (chunk_offset > graph_size -GIT_MAX_RAWSZ ) { -error ("improper chunk offset %08x%08x" , (uint32_t )(chunk_offset >>32 ), +error (_ ("improper chunk offset %08x%08x" ), (uint32_t )(chunk_offset >>32 ), (uint32_t )chunk_offset); goto cleanup_fail; }@@ -158,7 +158,7 @@ struct commit_graph *load_commit_graph_one(const char *graph_file) }if (chunk_repeated) { -error ("chunk id %08x appears multiple times" , chunk_id); +error (_ ("chunk id %08x appears multiple times" ), chunk_id); goto cleanup_fail; }@@ -244,7 +244,7 @@ static struct commit_list **insert_parent_or_die(struct commit_graph *g,hashcpy (oid.hash, g->chunk_oid_lookup + g->hash_len * pos); c =lookup_commit (&oid);if (!c) -die ("could not find commit %s" ,oid_to_hex (&oid)); +die (_ ("could not find commit %s" ),oid_to_hex (&oid)); c->graph_pos = pos;return &commit_list_insert (c, pptr)->next; }@@ -537,7 +537,7 @@ static int add_packed_commits(const struct object_id *oid, oi.typep = &type;if (packed_object_info (the_repository, pack, offset, &oi) <0 ) -die ("unable to get type of object %s" ,oid_to_hex (oid)); +die (_ ("unable to get type of object %s" ),oid_to_hex (oid));if (type !=OBJ_COMMIT )return 0 ;@@ -683,9 +683,9 @@ void write_commit_graph(const char *obj_dir,strbuf_addstr (&packname, pack_indexes[i]);
commit-graph.c void write_commit_graph(const char *obj_dir, · line 691
Quoted 10 lines
commit-graph.c +2
-2p =add_packed_git (packname.buf, packname.len,1 );if (!p) -die ("error adding pack %s" , packname.buf); +die (_ ("error adding pack %s" ), packname.buf);if (open_pack_index (p)) -die ("error opening index for %s" , packname.buf); +die (_ ("error opening index for %s" ), packname.buf);for_each_object_in_pack (p, add_packed_commits, &oids);close_pack (p); }
These all look good to me. Thanks!
PATCH 9/23 config.c: mark more strings for translation
In reply to Nguyễn Thái Ngọc Duy--- config.c | 76 +++++++++++++++++++-------------------- t/t1305-config-include.sh | 2 +- 2 files changed, 39 insertions(+), 39 deletions(-)
config.c +38 -38
@@ -116,12 +116,12 @@ static long config_buf_ftell(struct config_source *conf) }#define MAX_INCLUDE_DEPTH 10 -static const char include_depth_advice[] = +static const char include_depth_advice[] =N_ ("exceeded maximum include depth (%d) while including\n" " %s\n" "from\n" " %s\n" -"Do you have circular includes?" ; +"Do you have circular includes?" );static int handle_path_include (const char *path,struct config_include_data *inc) {int ret =0 ;
@@ -133,7 +133,7 @@ static int handle_path_include(const char *path, struct config_include_data *inc expanded =expand_user_path (path,0 );if (!expanded) -return error ("could not expand include path '%s'" , path); +return error (_ ("could not expand include path '%s'" ), path); path = expanded;/*
@@ -144,7 +144,7 @@ static int handle_path_include(const char *path, struct config_include_data *incchar *slash;if (!cf || !cf->path) -return error ("relative config includes must come from files" ); +return error (_ ("relative config includes must come from files" )); slash =find_last_dir_sep (cf->path);if (slash)
@@ -155,7 +155,7 @@ static int handle_path_include(const char *path, struct config_include_data *incif (!access_or_die (path,R_OK ,0 )) {if (++inc->depth >MAX_INCLUDE_DEPTH ) -die (include_depth_advice,MAX_INCLUDE_DEPTH , path, +die (_ (include_depth_advice),MAX_INCLUDE_DEPTH , path, !cf ?"<unknown>" : cf->name ? cf->name :"the command line" );
@@ -342,13 +342,13 @@ static int git_config_parse_key_1(const char *key, char **store_key, int *baseleif (last_dot ==NULL || last_dot == key) {if (!quiet) -error ("key does not contain a section: %s" , key); +error (_ ("key does not contain a section: %s" ), key);return -CONFIG_NO_SECTION_OR_NAME ; }if (!last_dot[1 ]) {if (!quiet) -error ("key does not contain variable name: %s" , key); +error (_ ("key does not contain variable name: %s" ), key);return -CONFIG_NO_SECTION_OR_NAME ; }
@@ -372,13 +372,13 @@ static int git_config_parse_key_1(const char *key, char **store_key, int *baseleif (!iskeychar (c) || (i == baselen +1 && !isalpha (c))) {if (!quiet) -error ("invalid key: %s" , key); +error (_ ("invalid key: %s" ), key); goto out_free_ret_1; } c =tolower (c); }else if (c =='\n' ) {if (!quiet) -error ("invalid key (newline): %s" , key); +error (_ ("invalid key (newline): %s" ), key); goto out_free_ret_1; }if (store_key)
@@ -414,7 +414,7 @@ int git_config_parse_parameter(const char *text, pair =strbuf_split_str (text,'=' ,2 );if (!pair[0 ]) -return error ("bogus config parameter: %s" , text); +return error (_ ("bogus config parameter: %s" ), text);if (pair[0 ]->len && pair[0 ]->buf[pair[0 ]->len -1 ] =='=' ) {strbuf_setlen (pair[0 ], pair[0 ]->len -1 );
@@ -426,7 +426,7 @@ int git_config_parse_parameter(const char *text,strbuf_trim (pair[0 ]);if (!pair[0 ]->len) {strbuf_list_free (pair); -return error ("bogus config parameter: %s" , text); +return error (_ ("bogus config parameter: %s" ), text); }if (git_config_parse_key (pair[0 ]->buf, &canonical_name,NULL )) {
@@ -461,7 +461,7 @@ int git_config_from_parameters(config_fn_t fn, void *data) envw =xstrdup (env);if (sq_dequote_to_argv (envw, &argv, &nr, &alloc) <0 ) { - ret =error ("bogus format in %s" ,CONFIG_DATA_ENVIRONMENT ); + ret =error (_ ("bogus format in %s" ),CONFIG_DATA_ENVIRONMENT ); goto out; }
@@ -1154,7 +1154,7 @@ static int git_default_core_config(const char *var, const char *value)else {int abbrev =git_config_int (var, value);if (abbrev < minimum_abbrev || abbrev >40 ) -return error ("abbrev length out of range: %d" , abbrev); +return error (_ ("abbrev length out of range: %d" ), abbrev); default_abbrev = abbrev; }return 0 ;
@@ -1271,7 +1271,7 @@ static int git_default_core_config(const char *var, const char *value) comment_line_char = value[0 ]; auto_comment_line_char =0 ; }else -return error ("core.commentChar should only be one character" ); +return error (_ ("core.commentChar should only be one character" ));return 0 ; }
@@ -1384,7 +1384,7 @@ static int git_default_branch_config(const char *var, const char *value)else if (!strcmp (value,"always" )) autorebase =AUTOREBASE_ALWAYS ;else -return error ("malformed value for %s" , var); +return error (_ ("malformed value for %s" ), var);return 0 ; }
@@ -1409,11 +1409,11 @@ static int git_default_push_config(const char *var, const char *value) push_default =PUSH_DEFAULT_UPSTREAM ; else if (!strcmp(value, "current")) push_default =PUSH_DEFAULT_CURRENT ; - else { -error ("malformed value for %s: %s" , var, value); -return error ("Must be one of nothing, matching, simple, " -"upstream or current." ); - } + else + return error(_("malformed value for %s: %s\n" +"Must be one of nothing, matching, simple, " +"upstream or current." ), + var, value);return 0 ; }
@@ -1589,10 +1589,10 @@ int git_config_from_blob_oid(config_fn_t fn, buf =read_object_file (oid, &type, &size);if (!buf) -return error ("unable to load config blob object '%s'" , name); +return error (_ ("unable to load config blob object '%s'" ), name);if (type !=OBJ_BLOB ) {free (buf); -return error ("reference '%s' does not point to a blob" , name); +return error (_ ("reference '%s' does not point to a blob" ), name); } ret =git_config_from_mem (fn,CONFIG_ORIGIN_BLOB , name, buf, size, data);
@@ -1608,7 +1608,7 @@ static int git_config_from_blob_ref(config_fn_t fn,struct object_id oid;if (get_oid (name, &oid) <0 ) -return error ("unable to resolve config blob '%s'" , name); +return error (_ ("unable to resolve config blob '%s'" ), name);return git_config_from_blob_oid (fn, name, &oid, data); }
@@ -1638,7 +1638,7 @@ unsigned long git_env_ulong(const char *k, unsigned long val) {const char *v =getenv (k);if (v && !git_parse_ulong (v, &val)) -die ("failed to parse %s" , k); +die (_ ("failed to parse %s" ), k);return val; }
@@ -2372,7 +2372,7 @@ static int store_aux_event(enum config_event_t type,if (type ==CONFIG_EVENT_SECTION ) {if (cf->var.len <2 || cf->var.buf[cf->var.len -1 ] !='.' ) -return error ("invalid section name '%s'" , cf->var.buf); +return error (_ ("invalid section name '%s'" ), cf->var.buf);/* Is this the section we were looking for? */ store->is_keys_section =
@@ -2428,7 +2428,7 @@ static int store_aux(const char *key, const char *value, void *cb)static int write_error (const char *filename) { -error ("failed to write new configuration file %s" , filename); +error (_ ("failed to write new configuration file %s" ), filename);/* Same error code as "failed to rename". */ return 4 ;
@@ -2679,7 +2679,7 @@ int git_config_set_multivar_in_file_gently(const char *config_filename,*/ fd =hold_lock_file_for_update (&lock, config_filename,0 );if (fd <0 ) { -error_errno ("could not lock config file %s" , config_filename); +error_errno (_ ("could not lock config file %s" ), config_filename); ret =CONFIG_NO_LOCK ; goto out_free; }
@@ -2690,7 +2690,7 @@ int git_config_set_multivar_in_file_gently(const char *config_filename, in_fd =open (config_filename,O_RDONLY );if ( in_fd <0 ) {if (ENOENT != errno ) { -error_errno ("opening %s" , config_filename); +error_errno (_ ("opening %s" ), config_filename); ret =CONFIG_INVALID_FILE ;/* same as "invalid config file" */ goto out_free; }
@@ -2725,7 +2725,7 @@ int git_config_set_multivar_in_file_gently(const char *config_filename, store.value_regex = (regex_t *)xmalloc (sizeof (regex_t));if (regcomp (store.value_regex, value_regex,REG_EXTENDED )) { -error ("invalid pattern: %s" , value_regex); +error (_ ("invalid pattern: %s" ), value_regex);FREE_AND_NULL (store.value_regex); ret =CONFIG_INVALID_PATTERN ; goto out_free;
@@ -2750,7 +2750,7 @@ int git_config_set_multivar_in_file_gently(const char *config_filename,if (git_config_from_file_with_options (store_aux, config_filename, &store, &opts)) { -error ("invalid config file %s" , config_filename); +error (_ ("invalid config file %s" ), config_filename); ret =CONFIG_INVALID_FILE ; goto out_free; }
@@ -2774,7 +2774,7 @@ int git_config_set_multivar_in_file_gently(const char *config_filename,if (contents ==MAP_FAILED ) {if (errno ==ENODEV &&S_ISDIR (st.st_mode)) errno =EISDIR ; -error_errno ("unable to mmap '%s'" , config_filename); +error_errno (_ ("unable to mmap '%s'" ), config_filename); ret =CONFIG_INVALID_FILE ; contents =NULL ; goto out_free;
@@ -2783,7 +2783,7 @@ int git_config_set_multivar_in_file_gently(const char *config_filename, in_fd =-1 ;if (chmod (get_lock_file_path (&lock), st.st_mode &07777 ) <0 ) { -error_errno ("chmod on %s failed" ,get_lock_file_path (&lock)); +error_errno (_ ("chmod on %s failed" ),get_lock_file_path (&lock)); ret =CONFIG_NO_WRITE ; goto out_free; }
@@ -2868,7 +2868,7 @@ int git_config_set_multivar_in_file_gently(const char *config_filename, }if (commit_lock_file (&lock) <0 ) { -error_errno ("could not write config file %s" , config_filename); +error_errno (_ ("could not write config file %s" ), config_filename); ret =CONFIG_NO_WRITE ; goto out_free; }
@@ -2994,7 +2994,7 @@ static int git_config_copy_or_rename_section_in_file(const char *config_filenamememset (&store,0 ,sizeof (store));if (new_name && !section_name_is_ok (new_name)) { - ret =error ("invalid section name: %s" , new_name); + ret =error (_ ("invalid section name: %s" ), new_name); goto out_no_rollback; }
@@ -3003,7 +3003,7 @@ static int git_config_copy_or_rename_section_in_file(const char *config_filename out_fd =hold_lock_file_for_update (&lock, config_filename,0 );if (out_fd <0 ) { - ret =error ("could not lock config file %s" , config_filename); + ret =error (_ ("could not lock config file %s" ), config_filename); goto out; }
@@ -3021,7 +3021,7 @@ static int git_config_copy_or_rename_section_in_file(const char *config_filename }if (chmod (get_lock_file_path (&lock), st.st_mode &07777 ) <0 ) { - ret =error_errno ("chmod on %s failed" , + ret =error_errno (_ ("chmod on %s failed" ),get_lock_file_path (&lock)); goto out; }
@@ -3118,7 +3118,7 @@ static int git_config_copy_or_rename_section_in_file(const char *config_filename config_file =NULL ; commit_and_out:if (commit_lock_file (&lock) <0 ) - ret =error_errno ("could not write config file %s" , + ret =error_errno (_ ("could not write config file %s" ), config_filename); out:if (config_file)
@@ -3161,7 +3161,7 @@ int git_config_copy_section(const char *old_name, const char *new_name)#undef config_error_nonboolint config_error_nonbool (const char *var) { -return error ("missing value for '%s'" , var); +return error (_ ("missing value for '%s'" ), var); } int parse_config_key(const char *var,
t/t1305-config-include.sh +1 -1
@@ -310,7 +310,7 @@ test_expect_success 'include cycles are detected' ' cycle EOF test_must_fail git config --get-all test.value 2>stderr && - grep "exceeded maximum include depth" stderr + test_i18ngrep "exceeded maximum include depth" stderr ' test_done
Signature · 1 line
2.18.0.rc2.476.g39500d3211
Re: [PATCH 09/23] config.c: mark more strings for translation
Quoted 4 lines · Nguyễn Thái Ngọc Duy
config.c +0
-0@@ -1409,11 +1409,11 @@ static int git_default_push_config(const char *var, const char *value) push_default =PUSH_DEFAULT_UPSTREAM ; else if (!strcmp(value, "current")) push_default =PUSH_DEFAULT_CURRENT ;
config.c static int git_default_push_config(const char *var, const char *value) · line 1416
Quoted 10 lines
config.c +5
-5-else { -error ("malformed value for %s: %s" , var, value); -return error ("Must be one of nothing, matching, simple, " -"upstream or current." ); - } +else +return error (_ ("malformed value for %s: %s\n" +"Must be one of nothing, matching, simple, " +"upstream or current." ), + var, value);
Patch 1?
No other issues noticed.
PATCH 10/23 connect.c: mark more strings for translation
In reply to Nguyễn Thái Ngọc Duy--- connect.c | 78 +++++++++++++++++++++++-------------------- t/t5570-git-daemon.sh | 6 ++-- 2 files changed, 44 insertions(+), 40 deletions(-)
connect.c +41 -37
@@ -78,7 +78,7 @@ int server_supports_v2(const char *c, int die_on_error) }if (die_on_error) -die ("server doesn't support '%s'" , c); +die (_ ("server doesn't support '%s'" ), c);return 0 ; }
@@ -100,7 +100,7 @@ int server_supports_feature(const char *c, const char *feature, }if (die_on_error) -die ("server doesn't support feature '%s'" , feature); +die (_ ("server doesn't support feature '%s'" ), feature);return 0 ; }
@@ -111,7 +111,7 @@ static void process_capabilities_v2(struct packet_reader *reader)argv_array_push (&server_capabilities_v2, reader->line);if (reader->status !=PACKET_READ_FLUSH ) -die ("expected flush after capabilities" ); +die (_ ("expected flush after capabilities" )); }enum protocol_version discover_version (struct packet_reader *reader)
@@ -230,7 +230,7 @@ static int process_dummy_ref(const char *line)static void check_no_capabilities (const char *line,int len) {if (strlen (line) != len) -warning ("ignoring capabilities after first line '%s'" , +warning (_ ("ignoring capabilities after first line '%s'" ), line +strlen (line)); }
@@ -249,7 +249,7 @@ static int process_ref(const char *line, int len, struct ref ***list,if (extra_have && !strcmp (name,".have" )) {oid_array_append (extra_have, &old_oid); }else if (!strcmp (name,"capabilities^{}" )) { -die ("protocol error: unexpected capabilities^{}" ); +die (_ ("protocol error: unexpected capabilities^{}" )); }else if (check_ref (name, flags)) {struct ref *ref =alloc_ref (name);oidcpy (&ref->old_oid, &old_oid);
@@ -270,9 +270,9 @@ static int process_shallow(const char *line, int len,return 0 ;if (get_oid_hex (arg, &old_oid)) -die ("protocol error: expected shallow sha-1, got '%s'" , arg); +die (_ ("protocol error: expected shallow sha-1, got '%s'" ), arg);if (!shallow_points) -die ("repository on the other end cannot be shallow" ); +die (_ ("repository on the other end cannot be shallow" ));oid_array_append (shallow_points, &old_oid);check_no_capabilities (line, len);return 1 ;
@@ -307,13 +307,13 @@ struct ref **get_remote_heads(struct packet_reader *reader,case PACKET_READ_NORMAL : len = reader->pktlen;if (len >4 &&skip_prefix (reader->line,"ERR " , &arg)) -die ("remote error: %s" , arg); +die (_ ("remote error: %s" ), arg);break ;case PACKET_READ_FLUSH : state =EXPECTING_DONE ;break ;case PACKET_READ_DELIM : -die ("invalid packet" ); +die (_ ("invalid packet" )); }switch (state) {
@@ -333,7 +333,7 @@ struct ref **get_remote_heads(struct packet_reader *reader,case EXPECTING_SHALLOW :if (process_shallow (reader->line, len, shallow_points))break ; -die ("protocol error: unexpected '%s'" , reader->line); +die (_ ("protocol error: unexpected '%s'" ), reader->line);case EXPECTING_DONE :break ; }
@@ -441,11 +441,11 @@ struct ref **get_remote_refs(int fd_out, struct packet_reader *reader,/* Process response from server */ while (packet_reader_read (reader) ==PACKET_READ_NORMAL ) {if (!process_ref_v2 (reader->line, &list)) -die ("invalid ls-refs response: %s" , reader->line); +die (_ ("invalid ls-refs response: %s" ), reader->line); }if (reader->status !=PACKET_READ_FLUSH ) -die ("expected flush after ref listing" ); +die (_ ("expected flush after ref listing" ));return list; }
@@ -544,7 +544,7 @@ static enum protocol get_protocol(const char *name)return PROTO_SSH ;if (!strcmp (name,"file" ))return PROTO_FILE ; -die ("protocol '%s' is not supported" , name); +die (_ ("protocol '%s' is not supported" ), name); }static char *host_end (char **hoststart,int removebrackets)
@@ -595,7 +595,7 @@ static void enable_keepalive(int sockfd)int ka =1 ;if (setsockopt (sockfd,SOL_SOCKET ,SO_KEEPALIVE , &ka,sizeof (ka)) <0 ) -error_errno ("unable to set SO_KEEPALIVE on socket" ); +error_errno (_ ("unable to set SO_KEEPALIVE on socket" )); }#ifndef NO_IPV6
@@ -635,15 +635,16 @@ static int git_tcp_connect_sock(char *host, int flags) hints.ai_protocol =IPPROTO_TCP ;if (flags &CONNECT_VERBOSE ) -fprintf (stderr,"Looking up %s ... " , host); +fprintf (stderr,_ ("Looking up %s ... " ), host); gai =getaddrinfo (host, port, &hints, &ai);if (gai) -die ("unable to look up %s (port %s) (%s)" , host, port,gai_strerror (gai)); +die (_ ("unable to look up %s (port %s) (%s)" ), host, port,gai_strerror (gai));if (flags &CONNECT_VERBOSE ) { -fprintf_ln (stderr,"done." ); -fprintf (stderr,"Connecting to %s (port %s) ... " , host, port); +/* TRANSLATORS: this is the end of "Looking up %s ... " */ +fprintf_ln (stderr,_ ("done." )); +fprintf (stderr,_ ("Connecting to %s (port %s) ... " ), host, port); }for (ai0 = ai; ai; ai = ai->ai_next, cnt++) {
@@ -666,12 +667,13 @@ static int git_tcp_connect_sock(char *host, int flags)freeaddrinfo (ai0);if (sockfd <0 ) -die ("unable to connect to %s:\n%s" , host, error_message.buf); +die (_ ("unable to connect to %s:\n%s" ), host, error_message.buf);enable_keepalive (sockfd);if (flags &CONNECT_VERBOSE ) -fprintf_ln (stderr,"done." ); +/* TRANSLATORS: this is the end of "Connecting to %s (port %s) ... " */ +fprintf_ln (stderr,_ ("done." ));strbuf_release (&error_message);
@@ -698,23 +700,24 @@ static int git_tcp_connect_sock(char *host, int flags)get_host_and_port (&host, &port);if (flags &CONNECT_VERBOSE ) -fprintf (stderr,"Looking up %s ... " , host); +fprintf (stderr,_ ("Looking up %s ... " ), host); he =gethostbyname (host);if (!he) -die ("unable to look up %s (%s)" , host,hstrerror (h_errno)); +die (_ ("unable to look up %s (%s)" ), host,hstrerror (h_errno)); nport =strtoul (port, &ep,10 );if ( ep == port || *ep ) {/* Not numeric */ struct servent *se =getservbyname (port,"tcp" );if ( !se ) -die ("unknown port %s" , port); +die (_ ("unknown port %s" ), port); nport = se->s_port; }if (flags &CONNECT_VERBOSE ) { -fprintf_ln (stderr,"done." ); -fprintf (stderr,"Connecting to %s (port %s) ... " , host, port); +/* TRANSLATORS: this is the end of "Looking up %s ... " */ +fprintf_ln (stderr,_ ("done." )); +fprintf (stderr,_ ("Connecting to %s (port %s) ... " ), host, port); }for (cnt =0 , ap = he->h_addr_list; *ap; ap++, cnt++) {
@@ -743,12 +746,13 @@ static int git_tcp_connect_sock(char *host, int flags) }if (sockfd <0 ) -die ("unable to connect to %s:\n%s" , host, error_message.buf); +die (_ ("unable to connect to %s:\n%s" ), host, error_message.buf);enable_keepalive (sockfd);if (flags &CONNECT_VERBOSE ) -fprintf_ln (stderr,"done." ); +/* TRANSLATORS: this is the end of "Connecting to %s (port %s) ... " */ +fprintf_ln (stderr,_ ("done." ));return sockfd; }
@@ -845,9 +849,9 @@ static struct child_process *git_proxy_connect(int fd[2], char *host)get_host_and_port (&host, &port);if (looks_like_command_line_option (host)) -die ("strange hostname '%s' blocked" , host); +die (_ ("strange hostname '%s' blocked" ), host);if (looks_like_command_line_option (port)) -die ("strange port '%s' blocked" , port); +die (_ ("strange port '%s' blocked" ), port); proxy =xmalloc (sizeof (*proxy));child_process_init (proxy);
@@ -857,7 +861,7 @@ static struct child_process *git_proxy_connect(int fd[2], char *host) proxy->in =-1 ; proxy->out =-1 ;if (start_command (proxy)) -die ("cannot start proxy %s" , git_proxy_command); +die (_ ("cannot start proxy %s" ), git_proxy_command); fd[0 ] = proxy->out;/* read from proxy stdout */ fd[1 ] = proxy->in;/* write to proxy stdin */ return proxy;
@@ -924,7 +928,7 @@ static enum protocol parse_connect_url(const char *url_orig, char **ret_host, path =strchr (end, separator);if (!path || !*path) -die ("no path specified; see 'git help pull' for valid url syntax" ); +die (_ ("no path specified; see 'git help pull' for valid url syntax" ));/* * null-terminate hostname and point path to ~ for URL's like this:
@@ -1119,7 +1123,7 @@ static void push_ssh_options(struct argv_array *args, struct argv_array *env,case VARIANT_AUTO :BUG ("VARIANT_AUTO passed to push_ssh_options" );case VARIANT_SIMPLE : -die ("ssh variant 'simple' does not support -4" ); +die (_ ("ssh variant 'simple' does not support -4" ));case VARIANT_SSH :case VARIANT_PLINK :case VARIANT_PUTTY :
@@ -1131,7 +1135,7 @@ static void push_ssh_options(struct argv_array *args, struct argv_array *env,case VARIANT_AUTO :BUG ("VARIANT_AUTO passed to push_ssh_options" );case VARIANT_SIMPLE : -die ("ssh variant 'simple' does not support -6" ); +die (_ ("ssh variant 'simple' does not support -6" ));case VARIANT_SSH :case VARIANT_PLINK :case VARIANT_PUTTY :
@@ -1148,7 +1152,7 @@ static void push_ssh_options(struct argv_array *args, struct argv_array *env,case VARIANT_AUTO :BUG ("VARIANT_AUTO passed to push_ssh_options" );case VARIANT_SIMPLE : -die ("ssh variant 'simple' does not support setting port" ); +die (_ ("ssh variant 'simple' does not support setting port" ));case VARIANT_SSH :argv_array_push (args,"-p" );break ;
@@ -1171,7 +1175,7 @@ static void fill_ssh_args(struct child_process *conn, const char *ssh_host,enum ssh_variant variant;if (looks_like_command_line_option (ssh_host)) -die ("strange hostname '%s' blocked" , ssh_host); +die (_ ("strange hostname '%s' blocked" ), ssh_host); ssh =get_ssh_command ();if (ssh) {
@@ -1259,7 +1263,7 @@ struct child_process *git_connect(int fd[2], const char *url,child_process_init (conn);if (looks_like_command_line_option (path)) -die ("strange pathname '%s' blocked" , path); +die (_ ("strange pathname '%s' blocked" ), path);strbuf_addstr (&cmd, prog);strbuf_addch (&cmd,' ' );
@@ -1304,7 +1308,7 @@ struct child_process *git_connect(int fd[2], const char *url,argv_array_push (&conn->args, cmd.buf);if (start_command (conn)) -die ("unable to fork" ); +die (_ ("unable to fork" )); fd[0 ] = conn->out;/* read from child's stdout */ fd[1 ] = conn->in;/* write to child's stdin */
t/t5570-git-daemon.sh +3 -3
@@ -7,9 +7,9 @@ test_description='test fetching over git protocol' start_git_daemon check_verbose_connect () { - grep -F "Looking up 127.0.0.1 ..." stderr && - grep -F "Connecting to 127.0.0.1 (port " stderr && - grep -F "done." stderr + test_i18ngrep -F "Looking up 127.0.0.1 ..." stderr && + test_i18ngrep -F "Connecting to 127.0.0.1 (port " stderr && + test_i18ngrep -F "done." stderr } test_expect_success 'setup repository' '
Signature · 1 line
2.18.0.rc2.476.g39500d3211
PATCH 11/23 convert.c: mark more strings for translation
In reply to Nguyễn Thái Ngọc Duy--- convert.c | 38 ++++++++++++++++++++------------------ t/t0021-conversion.sh | 2 +- 2 files changed, 21 insertions(+), 19 deletions(-)
convert.c +20 -18
@@ -190,7 +190,7 @@ static enum eol output_eol(enum crlf_action crlf_action)/* fall through */ return text_eol_is_crlf () ?EOL_CRLF :EOL_LF ; } -warning ("illegal crlf_action %d" , (int )crlf_action); +warning (_ ("illegal crlf_action %d" ), (int )crlf_action);return core_eol; }
@@ -207,7 +207,7 @@ static void check_global_conv_flags_eol(const char *path, enum crlf_action crlf_else if (conv_flags &CONV_EOL_RNDTRP_WARN )warning (_ ("CRLF will be replaced by LF in %s.\n" "The file will have its original line" -" endings in your working directory." ), path); +" endings in your working directory" ), path); }else if (old_stats->lonelf && !new_stats->lonelf ) {/* * CRLFs would be added by checkout
@@ -217,7 +217,7 @@ static void check_global_conv_flags_eol(const char *path, enum crlf_action crlf_else if (conv_flags &CONV_EOL_RNDTRP_WARN )warning (_ ("LF will be replaced by CRLF in %s.\n" "The file will have its original line" -" endings in your working directory." ), path); +" endings in your working directory" ), path); } }
@@ -492,7 +492,7 @@ static int encode_to_worktree(const char *path, const char *src, size_t src_len, dst =reencode_string_len (src, src_len, enc, default_encoding, &dst_len);if (!dst) { -error ("failed to encode '%s' from %s to %s" , +error (_ ("failed to encode '%s' from %s to %s" ), path, default_encoding, enc);return 0 ; }
@@ -670,7 +670,8 @@ static int filter_buffer_or_fd(int in, int out, void *data)if (start_command (&child_process)) {strbuf_release (&cmd); -return error ("cannot fork to run external filter '%s'" , params->cmd); +return error (_ ("cannot fork to run external filter '%s'" ), + params->cmd); }sigchain_push (SIGPIPE ,SIG_IGN );
@@ -689,13 +690,14 @@ static int filter_buffer_or_fd(int in, int out, void *data)if (close (child_process.in)) write_err =1 ;if (write_err) -error ("cannot feed the input to external filter '%s'" , params->cmd); +error (_ ("cannot feed the input to external filter '%s'" ), + params->cmd);sigchain_pop (SIGPIPE ); status =finish_command (&child_process);if (status) -error ("external filter '%s' failed %d" , params->cmd, status); +error (_ ("external filter '%s' failed %d" ), params->cmd, status);strbuf_release (&cmd);return (write_err || status);
@@ -730,13 +732,13 @@ static int apply_single_file_filter(const char *path, const char *src, size_t lereturn 0 ;/* error was already reported */ if (strbuf_read (&nbuf, async.out, len) <0 ) { - err =error ("read from external filter '%s' failed" , cmd); + err =error (_ ("read from external filter '%s' failed" ), cmd); }if (close (async.out)) { - err =error ("read from external filter '%s' failed" , cmd); + err =error (_ ("read from external filter '%s' failed" ), cmd); }if (finish_async (&async)) { - err =error ("external filter '%s' failed" , cmd); + err =error (_ ("external filter '%s' failed" ), cmd); }if (!err) {
@@ -790,7 +792,7 @@ static void handle_filter_error(const struct strbuf *filter_status,* Something went wrong with the protocol filter. * Force shutdown and restart if another blob requires filtering. */ -error ("external filter '%s' failed" , entry->subprocess.cmd); +error (_ ("external filter '%s' failed" ), entry->subprocess.cmd);subprocess_stop (&subprocess_map, &entry->subprocess);free (entry); }
@@ -838,7 +840,7 @@ static int apply_multi_file_filter(const char *path, const char *src, size_t lenelse if (wanted_capability &CAP_SMUDGE ) filter_type ="smudge" ;else -die ("unexpected filter type" ); +die (_ ("unexpected filter type" ));sigchain_push (SIGPIPE ,SIG_IGN );
@@ -849,7 +851,7 @@ static int apply_multi_file_filter(const char *path, const char *src, size_t len err =strlen (path) >LARGE_PACKET_DATA_MAX -strlen ("pathname=\n" );if (err) { -error ("path name too long for external filter" ); +error (_ ("path name too long for external filter" )); goto done; }
@@ -923,8 +925,8 @@ int async_query_available_blobs(const char *cmd, struct string_list *available_passert (subprocess_map_initialized); entry = (struct cmd2process *)subprocess_find_entry (&subprocess_map, cmd);if (!entry) { -error ("external filter '%s' is not available anymore although " -"not all paths have been filtered" , cmd); +error (_ ("external filter '%s' is not available anymore although " +"not all paths have been filtered" ), cmd);return 0 ; } process = &entry->subprocess.process;
@@ -1395,7 +1397,7 @@ int convert_to_git(const struct index_state *istate, ret |=apply_filter (path, src, len,-1 , dst, ca.drv,CAP_CLEAN ,NULL );if (!ret && ca.drv && ca.drv->required) -die ("%s: clean filter '%s' failed" , path, ca.drv->name); +die (_ ("%s: clean filter '%s' failed" ), path, ca.drv->name);if (ret && dst) { src = dst->buf;
@@ -1429,7 +1431,7 @@ void convert_to_git_filter_fd(const struct index_state *istate,assert (ca.drv->clean || ca.drv->process);if (!apply_filter (path,NULL ,0 , fd, dst, ca.drv,CAP_CLEAN ,NULL )) -die ("%s: clean filter '%s' failed" , path, ca.drv->name); +die (_ ("%s: clean filter '%s' failed" ), path, ca.drv->name);encode_to_git (path, dst->buf, dst->len, dst, ca.working_tree_encoding, conv_flags);crlf_to_git (istate, path, dst->buf, dst->len, dst, ca.crlf_action, conv_flags);
@@ -1472,7 +1474,7 @@ static int convert_to_working_tree_internal(const char *path, const char *src, ret_filter =apply_filter ( path, src, len,-1 , dst, ca.drv,CAP_SMUDGE , dco);if (!ret_filter && ca.drv && ca.drv->required) -die ("%s: smudge filter %s failed" , path, ca.drv->name); +die (_ ("%s: smudge filter %s failed" ), path, ca.drv->name);return ret | ret_filter; }
t/t0021-conversion.sh +1 -1
@@ -583,7 +583,7 @@ test_expect_success PERL 'process filter should restart after unexpected write f git checkout --quiet --no-progress . 2>git-stderr.log && grep "smudge write error at" git-stderr.log && - grep "error: external filter" git-stderr.log && + test_i18ngrep "error: external filter" git-stderr.log && cat >expected.log <<-EOF && START
Signature · 1 line
2.18.0.rc2.476.g39500d3211
PATCH 12/23 dir.c: mark more strings for translation
In reply to Nguyễn Thái Ngọc Duy--- dir.c | 6 +++--- t/t3005-ls-files-relative.sh | 4 ++-- t/t7400-submodule-basic.sh | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-)
dir.c +3 -3
@@ -560,7 +560,7 @@ int report_path_error(const char *ps_matched,if (found_dup)continue ; -error ("pathspec '%s' did not match any file(s) known to git" , +error (_ ("pathspec '%s' did not match any file(s) known to git" ), pathspec->items[num].original); errors++; }
@@ -949,7 +949,7 @@ static void add_excludes_from_file_1(struct dir_struct *dir, const char *fname, dir->unmanaged_exclude_files++; el =add_exclude_list (dir,EXC_FILE , fname);if (add_excludes (fname,"" ,0 , el,NULL , oid_stat) <0 ) -die ("cannot use %s as an exclude file" , fname); +die (_ ("cannot use %s as an exclude file" ), fname); }void add_excludes_from_file (struct dir_struct *dir,const char *fname)
@@ -3028,7 +3028,7 @@ static void connect_wt_gitdir_in_nested(const char *sub_worktree,return ;if (repo_read_index (&subrepo) <0 ) -die ("index file corrupt in repo %s" , subrepo.gitdir); +die (_ ("index file corrupt in repo %s" ), subrepo.gitdir);for (i =0 ; i < subrepo.index->cache_nr; i++) {const struct cache_entry *ce = subrepo.index->cache[i];
t/t3005-ls-files-relative.sh +2 -2
@@ -50,7 +50,7 @@ test_expect_success 'ls-files -c' ' ls ../x* >expect.out && test_must_fail git ls-files -c --error-unmatch ../[xy]* >actual.out 2>actual.err && test_cmp expect.out actual.out && - test_cmp expect.err actual.err + test_i18ncmp expect.err actual.err ) '
@@ -65,7 +65,7 @@ test_expect_success 'ls-files -o' ' ls ../y* >expect.out && test_must_fail git ls-files -o --error-unmatch ../[xy]* >actual.out 2>actual.err && test_cmp expect.out actual.out && - test_cmp expect.err actual.err + test_i18ncmp expect.err actual.err ) '
t/t7400-submodule-basic.sh +1 -1
@@ -377,7 +377,7 @@ test_expect_success 'init should register submodule url in .git/config' ' test_failure_with_unknown_submodule () { test_must_fail git submodule $1 no-such-submodule 2>output.err && - grep "^error: .*no-such-submodule" output.err + test_i18ngrep "^error: .*no-such-submodule" output.err } test_expect_success 'init should fail with unknown submodule' '
Signature · 1 line
2.18.0.rc2.476.g39500d3211
PATCH 13/23 environment.c: mark more strings for translation
In reply to Nguyễn Thái Ngọc Duy--- environment.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
environment.c +2 -2
@@ -147,7 +147,7 @@ static char *expand_namespace(const char *raw_namespace)strbuf_addf (&buf,"refs/namespaces/%s" , (*c)->buf);strbuf_list_free (components);if (check_refname_format (buf.buf,0 )) -die ("bad git namespace path \"%s\"" , raw_namespace); +die (_ ("bad git namespace path \"%s\"" ), raw_namespace);strbuf_addch (&buf,'/' );return strbuf_detach (&buf,NULL ); }
@@ -329,7 +329,7 @@ char *get_graft_file(void)static void set_git_dir_1 (const char *path) {if (setenv (GIT_DIR_ENVIRONMENT , path,1 )) -die ("could not set GIT_DIR to '%s'" , path); +die (_ ("could not set GIT_DIR to '%s'" ), path);setup_git_env (path); }
Signature · 1 line
2.18.0.rc2.476.g39500d3211
PATCH 14/23 exec-cmd.c: mark more strings for translation
In reply to Nguyễn Thái Ngọc Duy--- exec-cmd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
exec-cmd.c +1 -1
@@ -358,7 +358,7 @@ int execl_git_cmd(const char *cmd, ...) }va_end (param);if (MAX_ARGS <= argc) -return error ("too many args to run %s" , cmd); +return error (_ ("too many args to run %s" ), cmd); argv[argc] =NULL ;return execv_git_cmd (argv);
Signature · 1 line
2.18.0.rc2.476.g39500d3211
PATCH 15/23 object.c: mark more strings for translation
In reply to Nguyễn Thái Ngọc Duy--- object.c | 10 +++++----- t/t1450-fsck.sh | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-)
object.c +5 -5
@@ -49,7 +49,7 @@ int type_from_string_gently(const char *str, ssize_t len, int gentle)if (gentle)return -1 ; -die ("invalid object type \"%s\"" , str); +die (_ ("invalid object type \"%s\"" ), str); }/*
@@ -169,7 +169,7 @@ void *object_as_type(struct object *obj, enum object_type type, int quiet) }else {if (!quiet) -error ("object %s is a %s, not a %s" , +error (_ ("object %s is a %s, not a %s" ),oid_to_hex (&obj->oid),type_name (obj->type),type_name (type));return NULL ;
@@ -229,7 +229,7 @@ struct object *parse_object_buffer(const struct object_id *oid, enum object_type obj = &tag->object; } }else { -warning ("object %s has unknown type id %d" ,oid_to_hex (oid), type); +warning (_ ("object %s has unknown type id %d" ),oid_to_hex (oid), type); obj =NULL ; }return obj;
@@ -262,7 +262,7 @@ struct object *parse_object(const struct object_id *oid) (!obj && has_object_file(oid) && oid_object_info(the_repository, oid, NULL) == OBJ_BLOB)) {if (check_object_signature (repl,NULL ,0 ,NULL ) <0 ) { -error ("sha1 mismatch %s" ,oid_to_hex (oid)); +error (_ ("sha1 mismatch %s" ),oid_to_hex (oid));return NULL ; }parse_blob_buffer (lookup_blob (oid),NULL ,0 );
@@ -273,7 +273,7 @@ struct object *parse_object(const struct object_id *oid)if (buffer) {if (check_object_signature (repl, buffer, size,type_name (type)) <0 ) {free (buffer); -error ("sha1 mismatch %s" ,oid_to_hex (repl)); +error (_ ("sha1 mismatch %s" ),oid_to_hex (repl));return NULL ; }
t/t1450-fsck.sh +1 -1
@@ -372,7 +372,7 @@ test_expect_success 'rev-list --verify-objects with bad sha1' ' test_might_fail git rev-list --verify-objects refs/heads/bogus >/dev/null 2>out && cat out && - grep -q "error: sha1 mismatch 63ffffffffffffffffffffffffffffffffffffff" out + test_i18ngrep -q "error: sha1 mismatch 63ffffffffffffffffffffffffffffffffffffff" out ' test_expect_success 'force fsck to ignore double author' '
Signature · 1 line
2.18.0.rc2.476.g39500d3211
PATCH 16/23 pkt-line.c: mark more strings for translation
In reply to Nguyễn Thái Ngọc Duy--- pkt-line.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-)
pkt-line.c +13 -13
@@ -101,7 +101,7 @@ int packet_flush_gently(int fd) {packet_trace ("0000" ,4 ,1 );if (write_in_full (fd,"0000" ,4 ) <0 ) -return error ("flush packet write failed" ); +return error (_ ("flush packet write failed" ));return 0 ; }
@@ -139,7 +139,7 @@ static void format_packet(struct strbuf *out, const char *fmt, va_list args) n = out->len - orig_len;if (n >LARGE_PACKET_MAX ) -die ("protocol error: impossibly long line" ); +die (_ ("protocol error: impossibly long line" ));set_packet_header (&out->buf[orig_len], n);packet_trace (out->buf + orig_len +4 , n -4 ,1 );
@@ -155,9 +155,9 @@ static int packet_write_fmt_1(int fd, int gently,if (write_in_full (fd, buf.buf, buf.len) <0 ) {if (!gently) {check_pipe (errno); -die_errno ("packet write with format failed" ); +die_errno (_ ("packet write with format failed" )); } -return error ("packet write with format failed" ); +return error (_ ("packet write with format failed" )); }return 0 ;
@@ -189,21 +189,21 @@ static int packet_write_gently(const int fd_out, const char *buf, size_t size)size_t packet_size;if (size >sizeof (packet_write_buffer) -4 ) -return error ("packet write failed - data exceeds max packet size" ); +return error (_ ("packet write failed - data exceeds max packet size" ));packet_trace (buf, size,1 ); packet_size = size +4 ;set_packet_header (packet_write_buffer, packet_size);memcpy (packet_write_buffer +4 , buf, size);if (write_in_full (fd_out, packet_write_buffer, packet_size) <0 ) -return error ("packet write failed" ); +return error (_ ("packet write failed" ));return 0 ; }void packet_write (int fd_out,const char *buf,size_t size) {if (packet_write_gently (fd_out, buf, size)) -die_errno ("packet write failed" ); +die_errno (_ ("packet write failed" )); }void packet_buf_write (struct strbuf *buf,const char *fmt, ...)
@@ -225,7 +225,7 @@ void packet_buf_write_len(struct strbuf *buf, const char *data, size_t len) n = buf->len - orig_len;if (n >LARGE_PACKET_MAX ) -die ("protocol error: impossibly long line" ); +die (_ ("protocol error: impossibly long line" ));set_packet_header (&buf->buf[orig_len], n);packet_trace (data, len,1 );
@@ -288,7 +288,7 @@ static int get_packet_data(int fd, char **src_buf, size_t *src_size, }else { ret =read_in_full (fd, dst, size);if (ret <0 ) -die_errno ("read error" ); +die_errno (_ ("read error" )); }/* And complain if we didn't get enough bytes to satisfy the read. */
@@ -296,7 +296,7 @@ static int get_packet_data(int fd, char **src_buf, size_t *src_size,if (options &PACKET_READ_GENTLE_ON_EOF )return -1 ; -die ("the remote end hung up unexpectedly" ); +die (_ ("the remote end hung up unexpectedly" )); }return ret;
@@ -324,7 +324,7 @@ enum packet_read_status packet_read_with_status(int fd, char **src_buffer, len =packet_length (linelen);if (len <0 ) { -die ("protocol error: bad line length character: %.4s" , linelen); +die (_ ("protocol error: bad line length character: %.4s" ), linelen); }else if (!len) {packet_trace ("0000" ,4 ,0 ); *pktlen =0 ;
@@ -334,12 +334,12 @@ enum packet_read_status packet_read_with_status(int fd, char **src_buffer, *pktlen =0 ;return PACKET_READ_DELIM ; }else if (len <4 ) { -die ("protocol error: bad line length %d" , len); +die (_ ("protocol error: bad line length %d" ), len); } len -=4 ;if ((unsigned )len >= size) -die ("protocol error: bad line length %d" , len); +die (_ ("protocol error: bad line length %d" ), len);if (get_packet_data (fd, src_buffer, src_len, buffer, len, options) <0 ) { *pktlen =-1 ;
Signature · 1 line
2.18.0.rc2.476.g39500d3211
PATCH 17/23 refs.c: mark more strings for translation
In reply to Nguyễn Thái Ngọc Duy--- refs.c | 40 +++++++++++++-------------- t/t1400-update-ref.sh | 20 +++++++------- t/t1404-update-ref-errors.sh | 4 +-- t/t3210-pack-refs.sh | 2 +- t/t3310-notes-merge-manual-resolve.sh | 6 ++-- t/t5505-remote.sh | 2 +- 6 files changed, 37 insertions(+), 37 deletions(-)
refs.c +20 -20
@@ -188,7 +188,7 @@ int ref_resolves_to_object(const char *refname,if (flags &REF_ISBROKEN )return 0 ;if (!has_sha1_file (oid->hash)) { -error ("%s does not point to a valid object!" , refname); +error (_ ("%s does not point to a valid object!" ), refname);return 0 ; }return 1 ;
@@ -567,9 +567,9 @@ int expand_ref(const char *str, int len, struct object_id *oid, char **ref)if (!warn_ambiguous_refs)break ; }else if ((flag &REF_ISSYMREF ) &&strcmp (fullref.buf,"HEAD" )) { -warning ("ignoring dangling symref %s" , fullref.buf); +warning (_ ("ignoring dangling symref %s" ), fullref.buf); }else if ((flag &REF_ISBROKEN ) &&strchr (fullref.buf,'/' )) { -warning ("ignoring broken ref %s" , fullref.buf); +warning (_ ("ignoring broken ref %s" ), fullref.buf); } }strbuf_release (&fullref);
@@ -673,7 +673,7 @@ static int write_pseudoref(const char *pseudoref, const struct object_id *oid, fd =hold_lock_file_for_update_timeout (&lock, filename,0 ,get_files_ref_lock_timeout_ms ());if (fd <0 ) { -strbuf_addf (err,"could not open '%s' for writing: %s" , +strbuf_addf (err,_ ("could not open '%s' for writing: %s" ), filename,strerror (errno)); goto done; }
@@ -683,18 +683,18 @@ static int write_pseudoref(const char *pseudoref, const struct object_id *oid,if (read_ref (pseudoref, &actual_old_oid)) {if (!is_null_oid (old_oid)) { -strbuf_addf (err,"could not read ref '%s'" , +strbuf_addf (err,_ ("could not read ref '%s'" ), pseudoref);rollback_lock_file (&lock); goto done; } }else if (is_null_oid (old_oid)) { -strbuf_addf (err,"ref '%s' already exists" , +strbuf_addf (err,_ ("ref '%s' already exists" ), pseudoref);rollback_lock_file (&lock); goto done; }else if (oidcmp (&actual_old_oid, old_oid)) { -strbuf_addf (err,"unexpected object ID when writing '%s'" , +strbuf_addf (err,_ ("unexpected object ID when writing '%s'" ), pseudoref);rollback_lock_file (&lock); goto done;
@@ -702,7 +702,7 @@ static int write_pseudoref(const char *pseudoref, const struct object_id *oid, }if (write_in_full (fd, buf.buf, buf.len) <0 ) { -strbuf_addf (err,"could not write to '%s'" , filename); +strbuf_addf (err,_ ("could not write to '%s'" ), filename);rollback_lock_file (&lock); goto done; }
@@ -734,9 +734,9 @@ static int delete_pseudoref(const char *pseudoref, const struct object_id *old_oreturn -1 ; }if (read_ref (pseudoref, &actual_old_oid)) -die ("could not read ref '%s'" , pseudoref); +die (_ ("could not read ref '%s'" ), pseudoref);if (oidcmp (&actual_old_oid, old_oid)) { -error ("unexpected object ID when deleting '%s'" , +error (_ ("unexpected object ID when deleting '%s'" ), pseudoref);rollback_lock_file (&lock);return -1 ;
@@ -871,13 +871,13 @@ static int read_ref_at_ent(struct object_id *ooid, struct object_id *noid,if (!is_null_oid (&cb->ooid)) {oidcpy (cb->oid, noid);if (oidcmp (&cb->ooid, noid)) -warning ("log for ref %s has gap after %s" , +warning (_ ("log for ref %s has gap after %s" ), cb->refname,show_date (cb->date, cb->tz,DATE_MODE (RFC2822 ))); }else if (cb->date == cb->at_time)oidcpy (cb->oid, noid);else if (oidcmp (noid, cb->oid)) -warning ("log for ref %s unexpectedly ended on %s" , +warning (_ ("log for ref %s unexpectedly ended on %s" ), cb->refname,show_date (cb->date, cb->tz,DATE_MODE (RFC2822 )));oidcpy (&cb->ooid, ooid);
@@ -935,7 +935,7 @@ int read_ref_at(const char *refname, unsigned int flags, timestamp_t at_time, inif (flags &GET_OID_QUIETLY )exit (128 );else -die ("log for %s is empty" , refname); +die (_ ("log for %s is empty" ), refname); }if (cb.found_it)return 0 ;
@@ -1027,7 +1027,7 @@ int ref_transaction_update(struct ref_transaction *transaction,if ((new_oid && !is_null_oid (new_oid)) ?check_refname_format (refname,REFNAME_ALLOW_ONELEVEL ) : !refname_is_safe (refname)) { -strbuf_addf (err,"refusing to update ref with bad name '%s'" , +strbuf_addf (err,_ ("refusing to update ref with bad name '%s'" ), refname);return -1 ; }
@@ -1103,7 +1103,7 @@ int refs_update_ref(struct ref_store *refs, const char *msg, } }if (ret) { -const char *str ="update_ref failed for ref '%s': %s" ; +const char *str =_ ("update_ref failed for ref '%s': %s" );switch (onerr) {case UPDATE_REFS_MSG_ON_ERR :
@@ -1845,7 +1845,7 @@ int ref_update_reject_duplicates(struct string_list *refnames,if (!cmp) {strbuf_addf (err, -"multiple updates for ref '%s' not allowed" , +_ ("multiple updates for ref '%s' not allowed" ), refnames->items[i].string);return 1 ; }else if (cmp >0 ) {
@@ -1973,13 +1973,13 @@ int refs_verify_refname_available(struct ref_store *refs,continue ;if (!refs_read_raw_ref (refs, dirname.buf, &oid, &referent, &type)) { -strbuf_addf (err,"'%s' exists; cannot create '%s'" , +strbuf_addf (err,_ ("'%s' exists; cannot create '%s'" ), dirname.buf, refname); goto cleanup; }if (extras &&string_list_has_string (extras, dirname.buf)) { -strbuf_addf (err,"cannot process '%s' and '%s' at the same time" , +strbuf_addf (err,_ ("cannot process '%s' and '%s' at the same time" ), refname, dirname.buf); goto cleanup; }
@@ -2003,7 +2003,7 @@ int refs_verify_refname_available(struct ref_store *refs, string_list_has_string(skip, iter->refname)) continue; -strbuf_addf (err,"'%s' exists; cannot create '%s'" , +strbuf_addf (err,_ ("'%s' exists; cannot create '%s'" ), iter->refname, refname);ref_iterator_abort (iter); goto cleanup;
@@ -2014,7 +2014,7 @@ int refs_verify_refname_available(struct ref_store *refs, extra_refname =find_descendant_ref (dirname.buf, extras, skip);if (extra_refname) -strbuf_addf (err,"cannot process '%s' and '%s' at the same time" , +strbuf_addf (err,_ ("cannot process '%s' and '%s' at the same time" ), refname, extra_refname);else ret =0 ;
t/t1400-update-ref.sh +10 -10
@@ -390,7 +390,7 @@ test_expect_success 'Query "master@{2005-05-26 23:33:01}" (middle of history wit test_when_finished "rm -f o e" && git rev-parse --verify "master@{2005-05-26 23:33:01}" >o 2>e && test $B = $(cat o) && - test "warning: log for ref $m has gap after $gd" = "$(cat e)" + test_i18ngrep -F "warning: log for ref $m has gap after $gd" e ' test_expect_success 'Query "master@{2005-05-26 23:38:00}" (middle of history)' ' test_when_finished "rm -f o e" &&
@@ -408,7 +408,7 @@ test_expect_success 'Query "master@{2005-05-28}" (past end of history)' ' test_when_finished "rm -f o e" && git rev-parse --verify "master@{2005-05-28}" >o 2>e && test $D = $(cat o) && - test "warning: log for ref $m unexpectedly ended on $ld" = "$(cat e)" + test_i18ngrep -F "warning: log for ref $m unexpectedly ended on $ld" e ' rm -f .git/$m .git/logs/$m expect
@@ -462,7 +462,7 @@ test_expect_success 'git cat-file blob master@{2005-05-26 23:42}:F (expect OTHER test_expect_success 'given old value for missing pseudoref, do not create' ' test_must_fail git update-ref PSEUDOREF $A $B 2>err && test_path_is_missing .git/PSEUDOREF && - grep "could not read ref" err + test_i18ngrep "could not read ref" err ' test_expect_success 'create pseudoref' '
@@ -483,7 +483,7 @@ test_expect_success 'overwrite pseudoref with correct old value' ' test_expect_success 'do not overwrite pseudoref with wrong old value' ' test_must_fail git update-ref PSEUDOREF $D $E 2>err && test $C = $(cat .git/PSEUDOREF) && - grep "unexpected object ID" err + test_i18ngrep "unexpected object ID" err ' test_expect_success 'delete pseudoref' '
@@ -495,7 +495,7 @@ test_expect_success 'do not delete pseudoref with wrong old value' ' git update-ref PSEUDOREF $A && test_must_fail git update-ref -d PSEUDOREF $B 2>err && test $A = $(cat .git/PSEUDOREF) && - grep "unexpected object ID" err + test_i18ngrep "unexpected object ID" err ' test_expect_success 'delete pseudoref with correct old value' '
@@ -512,7 +512,7 @@ test_expect_success 'do not overwrite pseudoref with old OID zero' ' test_when_finished git update-ref -d PSEUDOREF && test_must_fail git update-ref PSEUDOREF $B $Z 2>err && test $A = $(cat .git/PSEUDOREF) && - grep "already exists" err + test_i18ngrep "already exists" err ' # Test --stdin
@@ -650,7 +650,7 @@ test_expect_success 'stdin fails with duplicate refs' ' create $a $m EOF test_must_fail git update-ref --stdin <stdin 2>err && - grep "fatal: multiple updates for ref '"'"'$a'"'"' not allowed" err + test_i18ngrep "fatal: multiple updates for ref '"'"'$a'"'"' not allowed" err ' test_expect_success 'stdin create ref works' '
@@ -1052,7 +1052,7 @@ test_expect_success 'stdin -z fails option with unknown name' ' test_expect_success 'stdin -z fails with duplicate refs' ' printf $F "create $a" "$m" "create $b" "$m" "create $a" "$m" >stdin && test_must_fail git update-ref -z --stdin <stdin 2>err && - grep "fatal: multiple updates for ref '"'"'$a'"'"' not allowed" err + test_i18ngrep "fatal: multiple updates for ref '"'"'$a'"'"' not allowed" err ' test_expect_success 'stdin -z create ref works' '
@@ -1283,7 +1283,7 @@ test_expect_success 'fails with duplicate HEAD update' ' update HEAD $B EOF test_must_fail git update-ref --stdin <stdin 2>err && - grep "fatal: multiple updates for '\''HEAD'\'' (including one via its referent .refs/heads/target1.) are not allowed" err && + test_i18ngrep "fatal: multiple updates for '\''HEAD'\'' (including one via its referent .refs/heads/target1.) are not allowed" err && echo "refs/heads/target1" >expect && git symbolic-ref HEAD >actual && test_cmp expect actual &&
@@ -1300,7 +1300,7 @@ test_expect_success 'fails with duplicate ref update via symref' ' update refs/heads/symref2 $B EOF test_must_fail git update-ref --stdin <stdin 2>err && - grep "fatal: multiple updates for '\''refs/heads/target2'\'' (including one via symref .refs/heads/symref2.) are not allowed" err && + test_i18ngrep "fatal: multiple updates for '\''refs/heads/target2'\'' (including one via symref .refs/heads/symref2.) are not allowed" err && echo "refs/heads/target2" >expect && git symbolic-ref refs/heads/symref2 >actual && test_cmp expect actual &&
t/t1404-update-ref-errors.sh +2 -2
@@ -27,7 +27,7 @@ test_update_rejected () { fi && printf "create $prefix/%s $C\n" $create >input && test_must_fail git update-ref --stdin <input 2>output.err && - grep -F "$error" output.err && + test_i18ngrep -F "$error" output.err && git for-each-ref $prefix >actual && test_cmp unchanged actual }
@@ -103,7 +103,7 @@ df_test() { printf "%s\n" "delete $delname" "create $addname $D" fi >commands && test_must_fail git update-ref --stdin <commands 2>output.err && - test_cmp expected-err output.err && + test_i18ncmp expected-err output.err && printf "%s\n" "$C $delref" >expected-refs && git for-each-ref --format="%(objectname) %(refname)" $prefix/r >actual-refs && test_cmp expected-refs actual-refs
t/t3210-pack-refs.sh +1 -1
@@ -186,7 +186,7 @@ test_expect_success 'notice d/f conflict with existing directory' ' test_expect_success 'existing directory reports concrete ref' ' test_must_fail git branch foo 2>stderr && - grep refs/heads/foo/bar/baz stderr + test_i18ngrep refs/heads/foo/bar/baz stderr ' test_expect_success 'notice d/f conflict with existing ref' '
t/t3310-notes-merge-manual-resolve.sh +3 -3
@@ -541,9 +541,9 @@ EOF test "$(git rev-parse refs/notes/y)" = "$(git rev-parse NOTES_MERGE_PARTIAL^1)" && test "$(git rev-parse refs/notes/m)" != "$(git rev-parse NOTES_MERGE_PARTIAL^1)" && # Mention refs/notes/m, and its current and expected value in output - grep -q "refs/notes/m" output && - grep -q "$(git rev-parse refs/notes/m)" output && - grep -q "$(git rev-parse NOTES_MERGE_PARTIAL^1)" output && + test_i18ngrep -q "refs/notes/m" output && + test_i18ngrep -q "$(git rev-parse refs/notes/m)" output && + test_i18ngrep -q "$(git rev-parse NOTES_MERGE_PARTIAL^1)" output && # Verify that other notes refs has not changed (w, x, y and z) verify_notes w && verify_notes x &&
t/t5505-remote.sh +1 -1
@@ -876,7 +876,7 @@ test_expect_success 'remote prune to cause a dangling symref' ' cd eight && test_must_fail git branch nomore origin ) 2>err && - grep "dangling symref" err + test_i18ngrep "dangling symref" err ' test_expect_success 'show empty remote' '
Signature · 1 line
2.18.0.rc2.476.g39500d3211
PATCH 18/23 refspec.c: mark more strings for translation
In reply to Nguyễn Thái Ngọc Duy--- refspec.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
refspec.c +1 -1
@@ -134,7 +134,7 @@ void refspec_item_init_or_die(struct refspec_item *item, const char *refspec, int fetch) {if (!refspec_item_init (item, refspec, fetch)) -die ("invalid refspec '%s'" , refspec); +die (_ ("invalid refspec '%s'" ), refspec); }void refspec_item_clear (struct refspec_item *item)
Signature · 1 line
2.18.0.rc2.476.g39500d3211
PATCH 19/23 replace-object.c: mark more strings for translation
In reply to Nguyễn Thái Ngọc Duy--- replace-object.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
replace-object.c +3 -3
@@ -17,7 +17,7 @@ static int register_replace_ref(const char *refname,if (get_oid_hex (hash, &repl_obj->original.oid)) {free (repl_obj); -warning ("bad replace ref name: %s" , refname); +warning (_ ("bad replace ref name: %s" ), refname);return 0 ; }
@@ -26,7 +26,7 @@ static int register_replace_ref(const char *refname,/* Register new object */ if (oidmap_put (the_repository->objects->replace_map, repl_obj)) -die ("duplicate replace ref: %s" , refname); +die (_ ("duplicate replace ref: %s" ), refname);return 0 ; }
@@ -69,5 +69,5 @@ const struct object_id *do_lookup_replace_object(struct repository *r,return cur; cur = &repl_obj->replacement; } -die ("replace depth too high for object %s" ,oid_to_hex (oid)); +die (_ ("replace depth too high for object %s" ),oid_to_hex (oid)); }
Signature · 1 line
2.18.0.rc2.476.g39500d3211
PATCH 20/23 sequencer.c: mark more strings for translation
In reply to Nguyễn Thái Ngọc Duy--- sequencer.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-)
sequencer.c +14 -12
@@ -716,7 +716,7 @@ static const char *read_author_ident(struct strbuf *buf)/* dequote values and construct ident line in-place */ for (in = out = buf->buf; i <3 && in - buf->buf < buf->len; i++) {if (!skip_prefix (in, keys[i], (const char **)&in)) { -warning ("could not parse '%s' (looking for '%s'" , +warning (_ ("could not parse '%s' (looking for '%s'" ),rebase_path_author_script (), keys[i]);return NULL ; }
@@ -738,7 +738,7 @@ static const char *read_author_ident(struct strbuf *buf) }if (i <3 ) { -warning ("could not parse '%s' (looking for '%s')" , +warning (_ ("could not parse '%s' (looking for '%s')" ),rebase_path_author_script (), keys[i]);return NULL ; }
@@ -1444,7 +1444,7 @@ static const char *command_to_string(const enum todo_command command) {if (command <TODO_COMMENT )return todo_command_info[command].str; -die ("unknown command: %d" , command); +die (_ ("unknown command: %d" ), command); }static char command_to_char (const enum todo_command command)
@@ -2600,15 +2600,17 @@ static int error_with_patch(struct commit *commit,if (intend_to_amend ())return -1 ; -fprintf (stderr,"You can amend the commit now, with\n" -"\n" -" git commit --amend %s\n" -"\n" -"Once you are satisfied with your changes, run\n" -"\n" -" git rebase --continue\n" ,gpg_sign_opt_quoted (opts)); +fprintf (stderr, +_ ("You can amend the commit now, with\n" +"\n" +" git commit --amend %s\n" +"\n" +"Once you are satisfied with your changes, run\n" +"\n" +" git rebase --continue\n" ), +gpg_sign_opt_quoted (opts)); }else if (exit_code) -fprintf_ln (stderr,"Could not apply %s... %.*s" , +fprintf_ln (stderr,_ ("Could not apply %s... %.*s" ),short_commit_name (commit), subject_len, subject);return exit_code;
@@ -2719,7 +2721,7 @@ static int do_label(const char *name, int len)struct object_id head_oid;if (len ==1 && *name =='#' ) -return error ("illegal label name: '%.*s'" , len, name); +return error (_ ("illegal label name: '%.*s'" ), len, name);strbuf_addf (&ref_name,"refs/rewritten/%.*s" , len, name);strbuf_addf (&msg,"rebase -i (label) '%.*s'" , len, name);
Signature · 1 line
2.18.0.rc2.476.g39500d3211
PATCH 21/23 sha1-file.c: mark more strings for translation
In reply to Nguyễn Thái Ngọc Duy--- sha1-file.c | 104 ++++++++++++++++++++++++++-------------------------- 1 file changed, 52 insertions(+), 52 deletions(-)
sha1-file.c +52 -52
@@ -378,8 +378,8 @@ static int alt_odb_usable(struct raw_object_store *o,/* Detect cases where alternate disappeared */ if (!is_directory (path->buf)) { -error ("object directory %s does not exist; " -"check .git/objects/info/alternates" , +error (_ ("object directory %s does not exist; " +"check .git/objects/info/alternates" ), path->buf);return 0 ; }
@@ -429,7 +429,7 @@ static int link_alt_odb_entry(struct repository *r, const char *entry,strbuf_addstr (&pathbuf, entry);if (strbuf_normalize_path (&pathbuf) <0 && relative_base) { -error ("unable to normalize alternate object path: %s" , +error (_ ("unable to normalize alternate object path: %s" ), pathbuf.buf);strbuf_release (&pathbuf);return -1 ;
@@ -500,14 +500,14 @@ static void link_alt_odb_entries(struct repository *r, const char *alt,return ;if (depth >5 ) { -error ("%s: ignoring alternate object stores, nesting too deep." , +error (_ ("%s: ignoring alternate object stores, nesting too deep" ), relative_base);return ; }strbuf_add_absolute_path (&objdirbuf, r->objects->objectdir);if (strbuf_normalize_path (&objdirbuf) <0 ) -die ("unable to normalize object directory: %s" , +die (_ ("unable to normalize object directory: %s" ), objdirbuf.buf);while (*alt) {
@@ -562,7 +562,7 @@ void add_to_alternates_file(const char *reference)hold_lock_file_for_update (&lock, alts,LOCK_DIE_ON_ERROR ); out =fdopen_lock_file (&lock,"w" );if (!out) -die_errno ("unable to fdopen alternates lockfile" ); +die_errno (_ ("unable to fdopen alternates lockfile" )); in =fopen (alts,"r" );if (in) {
@@ -580,14 +580,14 @@ void add_to_alternates_file(const char *reference)fclose (in); }else if (errno !=ENOENT ) -die_errno ("unable to read alternates file" ); +die_errno (_ ("unable to read alternates file" ));if (found) {rollback_lock_file (&lock); }else {fprintf_or_die (out,"%s\n" , reference);if (commit_lock_file (&lock)) -die_errno ("unable to move new alternates file into place" ); +die_errno (_ ("unable to move new alternates file into place" ));if (the_repository->objects->alt_odb_tail)link_alt_odb_entries (the_repository, reference,'\n' ,NULL ,0 );
@@ -778,7 +778,7 @@ static void mmap_limit_check(size_t length) limit =SIZE_MAX ; }if (length > limit) -die ("attempting to mmap %" PRIuMAX" over limit %" PRIuMAX, +die (_ ("attempting to mmap %" PRIuMAX" over limit %" PRIuMAX), (uintmax_t )length, (uintmax_t )limit); }
@@ -803,7 +803,7 @@ void *xmmap(void *start, size_t length, {void *ret =xmmap_gently (start, length, prot, flags, fd, offset);if (ret ==MAP_FAILED ) -die_errno ("mmap failed" ); +die_errno (_ ("mmap failed" ));return ret; }
@@ -970,7 +970,7 @@ static void *map_sha1_file_1(struct repository *r, const char *path, *size =xsize_t (st.st_size);if (!*size) {/* mmap() is forbidden on empty files */ -error ("object file %s is empty" , path); +error (_ ("object file %s is empty" ), path);return NULL ; } map =xmmap (NULL , *size,PROT_READ ,MAP_PRIVATE , fd,0 );
@@ -1090,9 +1090,9 @@ static void *unpack_sha1_rest(git_zstream *stream, void *buffer, unsigned long s }if (status <0 ) -error ("corrupt loose object '%s'" ,sha1_to_hex (sha1)); +error (_ ("corrupt loose object '%s'" ),sha1_to_hex (sha1));else if (stream->avail_in) -error ("garbage at end of loose object '%s'" , +error (_ ("garbage at end of loose object '%s'" ),sha1_to_hex (sha1));free (buf);return NULL ;
@@ -1134,7 +1134,7 @@ static int parse_sha1_header_extended(const char *hdr, struct object_info *oi,if ((flags &OBJECT_INFO_ALLOW_UNKNOWN_TYPE ) && (type <0 )) type =0 ;else if (type <0 ) -die ("invalid object type" ); +die (_ ("invalid object type" ));if (oi->typep) *oi->typep = type;
@@ -1216,19 +1216,19 @@ static int sha1_loose_object_info(struct repository *r, *oi->disk_sizep = mapsize;if ((flags &OBJECT_INFO_ALLOW_UNKNOWN_TYPE )) {if (unpack_sha1_header_to_strbuf (&stream, map, mapsize, hdr,sizeof (hdr), &hdrbuf) <0 ) - status =error ("unable to unpack %s header with --allow-unknown-type" , + status =error (_ ("unable to unpack %s header with --allow-unknown-type" ),sha1_to_hex (sha1)); }else if (unpack_sha1_header (&stream, map, mapsize, hdr,sizeof (hdr)) <0 ) - status =error ("unable to unpack %s header" , + status =error (_ ("unable to unpack %s header" ),sha1_to_hex (sha1));if (status <0 ) ;/* Do nothing */ else if (hdrbuf.len) {if ((status =parse_sha1_header_extended (hdrbuf.buf, oi, flags)) <0 ) - status =error ("unable to parse %s header with --allow-unknown-type" , + status =error (_ ("unable to parse %s header with --allow-unknown-type" ),sha1_to_hex (sha1)); }else if ((status =parse_sha1_header_extended (hdr, oi, flags)) <0 ) - status =error ("unable to parse %s header" ,sha1_to_hex (sha1)); + status =error (_ ("unable to parse %s header" ),sha1_to_hex (sha1));if (status >=0 && oi->contentp) { *oi->contentp = unpack_sha1_rest(&stream, hdr,
@@ -1419,19 +1419,19 @@ void *read_object_file_extended(const struct object_id *oid,return data;if (errno && errno !=ENOENT ) -die_errno ("failed to read object %s" ,oid_to_hex (oid)); +die_errno (_ ("failed to read object %s" ),oid_to_hex (oid));/* die if we replaced an object with one that does not exist */ if (repl != oid) -die ("replacement %s not found for %s" , +die (_ ("replacement %s not found for %s" ),oid_to_hex (repl),oid_to_hex (oid));if (!stat_sha1_file (the_repository, repl->hash, &st, &path)) -die ("loose object %s (stored in %s) is corrupt" , +die (_ ("loose object %s (stored in %s) is corrupt" ),oid_to_hex (repl), path);if ((p =has_packed_and_bad (repl->hash)) !=NULL ) -die ("packed object %s (stored in %s) is corrupt" , +die (_ ("packed object %s (stored in %s) is corrupt" ),oid_to_hex (repl), p->pack_name);return NULL ;
@@ -1533,21 +1533,21 @@ int finalize_object_file(const char *tmpfile, const char *filename)unlink_or_warn (tmpfile);if (ret) {if (ret !=EEXIST ) { -return error_errno ("unable to write sha1 filename %s" , filename); +return error_errno (_ ("unable to write sha1 filename %s" ), filename); }/* FIXME!!! Collision check here ? */ } out:if (adjust_shared_perm (filename)) -return error ("unable to set permission to '%s'" , filename); +return error (_ ("unable to set permission to '%s'" ), filename);return 0 ; }static int write_buffer (int fd,const void *buf,size_t len) {if (write_in_full (fd, buf, len) <0 ) -return error_errno ("file write error" ); +return error_errno (_ ("file write error" ));return 0 ; }
@@ -1566,7 +1566,7 @@ static void close_sha1_file(int fd)if (fsync_object_files)fsync_or_die (fd,"sha1 file" );if (close (fd) !=0 ) -die_errno ("error when closing sha1 file" ); +die_errno (_ ("error when closing sha1 file" )); }/* Size of directory component, including the ending '/' */
@@ -1632,9 +1632,9 @@ static int write_loose_object(const struct object_id *oid, char *hdr, fd =create_tmpfile (&tmp_file, filename.buf);if (fd <0 ) {if (errno ==EACCES ) -return error ("insufficient permission for adding an object to repository database %s" ,get_object_directory ()); +return error (_ ("insufficient permission for adding an object to repository database %s" ),get_object_directory ());else -return error_errno ("unable to create temporary file" ); +return error_errno (_ ("unable to create temporary file" )); }/* Set it up */
@@ -1658,21 +1658,21 @@ static int write_loose_object(const struct object_id *oid, char *hdr, ret =git_deflate (&stream,Z_FINISH ); the_hash_algo->update_fn (&c, in0, stream.next_in - in0);if (write_buffer (fd, compressed, stream.next_out - compressed) <0 ) -die ("unable to write sha1 file" ); +die (_ ("unable to write sha1 file" )); stream.next_out = compressed; stream.avail_out =sizeof (compressed); }while (ret ==Z_OK );if (ret !=Z_STREAM_END ) -die ("unable to deflate new object %s (%d)" ,oid_to_hex (oid), +die (_ ("unable to deflate new object %s (%d)" ),oid_to_hex (oid), ret); ret =git_deflate_end_gently (&stream);if (ret !=Z_OK ) -die ("deflateEnd on object %s failed (%d)" ,oid_to_hex (oid), +die (_ ("deflateEnd on object %s failed (%d)" ),oid_to_hex (oid), ret); the_hash_algo->final_fn (parano_oid.hash, &c);if (oidcmp (oid, ¶no_oid) !=0 ) -die ("confused by unstable object source data for %s" , +die (_ ("confused by unstable object source data for %s" ),oid_to_hex (oid));close_sha1_file (fd);
@@ -1682,7 +1682,7 @@ static int write_loose_object(const struct object_id *oid, char *hdr, utb.actime = mtime; utb.modtime = mtime;if (utime (tmp_file.buf, &utb) <0 ) -warning_errno ("failed utime() on %s" , tmp_file.buf); +warning_errno (_ ("failed utime() on %s" ), tmp_file.buf); }return finalize_object_file (tmp_file.buf, filename.buf);
@@ -1757,7 +1757,7 @@ int force_object_loose(const struct object_id *oid, time_t mtime)return 0 ; buf =read_object (oid->hash, &type, &len);if (!buf) -return error ("cannot read sha1_file for %s" ,oid_to_hex (oid)); +return error (_ ("cannot read sha1_file for %s" ),oid_to_hex (oid)); hdrlen =xsnprintf (hdr,sizeof (hdr),"%s %lu" ,type_name (type), len) +1 ; ret =write_loose_object (oid, hdr, hdrlen, buf, len, mtime);free (buf);
@@ -1802,7 +1802,7 @@ static void check_commit(const void *buf, size_t size)struct commit c;memset (&c,0 ,sizeof (c));if (parse_commit_buffer (&c, buf, size,0 )) -die ("corrupt commit" ); +die (_ ("corrupt commit" )); }static void check_tag (const void *buf,size_t size)
@@ -1810,7 +1810,7 @@ static void check_tag(const void *buf, size_t size)struct tag t;memset (&t,0 ,sizeof (t));if (parse_tag_buffer (&t, buf, size)) -die ("corrupt tag" ); +die (_ ("corrupt tag" )); } static int index_mem(struct object_id *oid, void *buf, size_t size,
@@ -1903,10 +1903,10 @@ static int index_core(struct object_id *oid, int fd, size_t size,char *buf =xmalloc (size);ssize_t read_result =read_in_full (fd, buf, size);if (read_result <0 ) - ret =error_errno ("read error while indexing %s" , + ret =error_errno (_ ("read error while indexing %s" ), path ? path :"<unknown>" );else if (read_result != size) - ret =error ("short read while indexing %s" , + ret =error (_ ("short read while indexing %s" ), path ? path :"<unknown>" );else ret =index_mem (oid, buf, size, type, path, flags);
@@ -1977,7 +1977,7 @@ int index_path(struct object_id *oid, const char *path, struct stat *st, unsigneif (fd <0 )return error_errno ("open(\"%s\")" , path);if (index_fd (oid, fd, st,OBJ_BLOB , path, flags) <0 ) -return error ("%s: failed to insert into database" , +return error (_ ("%s: failed to insert into database" ), path);break ;case S_IFLNK :
@@ -1986,13 +1986,13 @@ int index_path(struct object_id *oid, const char *path, struct stat *st, unsigneif (!(flags &HASH_WRITE_OBJECT ))hash_object_file (sb.buf, sb.len, blob_type, oid);else if (write_object_file (sb.buf, sb.len, blob_type, oid)) - rc =error ("%s: failed to insert into database" , path); + rc =error (_ ("%s: failed to insert into database" ), path);strbuf_release (&sb);break ;case S_IFDIR :return resolve_gitlink_ref (path,"HEAD" , oid);default : -return error ("%s: unsupported file type" , path); +return error (_ ("%s: unsupported file type" ), path); }return rc; }
@@ -2016,9 +2016,9 @@ void assert_oid_type(const struct object_id *oid, enum object_type expect) {enum object_type type =oid_object_info (the_repository, oid,NULL );if (type <0 ) -die ("%s is not a valid object" ,oid_to_hex (oid)); +die (_ ("%s is not a valid object" ),oid_to_hex (oid));if (type != expect) -die ("%s is not a valid '%s' object" ,oid_to_hex (oid), +die (_ ("%s is not a valid '%s' object" ),oid_to_hex (oid),type_name (expect)); }
@@ -2045,7 +2045,7 @@ int for_each_file_in_obj_subdir(unsigned int subdir_nr, dir =opendir (path->buf);if (!dir) {if (errno !=ENOENT ) - r =error_errno ("unable to open %s" , path->buf); + r =error_errno (_ ("unable to open %s" ), path->buf);strbuf_setlen (path, origlen);return r; }
@@ -2202,18 +2202,18 @@ static int check_stream_sha1(git_zstream *stream,git_inflate_end (stream);if (status !=Z_STREAM_END ) { -error ("corrupt loose object '%s'" ,sha1_to_hex (expected_sha1)); +error (_ ("corrupt loose object '%s'" ),sha1_to_hex (expected_sha1));return -1 ; }if (stream->avail_in) { -error ("garbage at end of loose object '%s'" , +error (_ ("garbage at end of loose object '%s'" ),sha1_to_hex (expected_sha1));return -1 ; } the_hash_algo->final_fn (real_sha1, &c);if (hashcmp (expected_sha1, real_sha1)) { -error ("sha1 mismatch for %s (expected %s)" , path, +error (_ ("sha1 mismatch for %s (expected %s)" ), path,sha1_to_hex (expected_sha1));return -1 ; }
@@ -2237,18 +2237,18 @@ int read_loose_object(const char *path, map =map_sha1_file_1 (the_repository, path,NULL , &mapsize);if (!map) { -error_errno ("unable to mmap %s" , path); +error_errno (_ ("unable to mmap %s" ), path); goto out; }if (unpack_sha1_header (&stream, map, mapsize, hdr,sizeof (hdr)) <0 ) { -error ("unable to unpack header of %s" , path); +error (_ ("unable to unpack header of %s" ), path); goto out; } *type =parse_sha1_header (hdr, size);if (*type <0 ) { -error ("unable to parse header of %s" , path); +error (_ ("unable to parse header of %s" ), path);git_inflate_end (&stream); goto out; }
@@ -2259,13 +2259,13 @@ int read_loose_object(const char *path, }else { *contents =unpack_sha1_rest (&stream, hdr, *size, expected_oid->hash);if (!*contents) { -error ("unable to unpack contents of %s" , path); +error (_ ("unable to unpack contents of %s" ), path);git_inflate_end (&stream); goto out; }if (check_object_signature (expected_oid, *contents, *size,type_name (*type))) { -error ("sha1 mismatch for %s (expected %s)" , path, +error (_ ("sha1 mismatch for %s (expected %s)" ), path,oid_to_hex (expected_oid));free (*contents); goto out;
Signature · 1 line
2.18.0.rc2.476.g39500d3211
PATCH 22/23 transport.c: mark more strings for translation
In reply to Nguyễn Thái Ngọc Duy--- transport.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-)
transport.c +8 -8
@@ -139,7 +139,7 @@ static struct ref *get_refs_from_bundle(struct transport *transport,close (data->fd); data->fd =read_bundle_header (transport->url, &data->header);if (data->fd <0 ) -die ("could not read bundle '%s'." , transport->url); +die (_ ("could not read bundle '%s'" ), transport->url);for (i =0 ; i < data->header.references.nr; i++) {struct ref_list_entry *e = data->header.references.list + i;struct ref *ref =alloc_ref (e->name);
@@ -654,7 +654,7 @@ static int git_transport_push(struct transport *transport, struct ref *remote_reswitch (data->version) {case protocol_v2: -die ("support for protocol v2 not implemented yet" ); +die (_ ("support for protocol v2 not implemented yet" ));break ;case protocol_v1:case protocol_v0:
@@ -780,7 +780,7 @@ static enum protocol_allow_config parse_protocol_config(const char *key,else if (!strcasecmp (value,"user" ))return PROTOCOL_ALLOW_USER_ONLY ; -die ("unknown value for config '%s': %s" , key, value); +die (_ ("unknown value for config '%s': %s" ), key, value); }static enum protocol_allow_config get_protocol_config (const char *type)
@@ -846,7 +846,7 @@ int is_transport_allowed(const char *type, int from_user)void transport_check_allowed (const char *type) {if (!is_transport_allowed (type,-1 )) -die ("transport '%s' not allowed" , type); +die (_ ("transport '%s' not allowed" ), type); }static struct transport_vtable bundle_vtable = {
@@ -898,7 +898,7 @@ struct transport *transport_get(struct remote *remote, const char *url)if (helper) {transport_helper_init (ret, helper); }else if (starts_with (url,"rsync:" )) { -die ("git-over-rsync is no longer supported" ); +die (_ ("git-over-rsync is no longer supported" )); }else if (url_is_local_not_ssh (url) &&is_file (url) &&is_bundle (url,1 )) {struct bundle_transport_data *data =xcalloc (1 ,sizeof (*data));transport_check_allowed ("file" );
@@ -1143,7 +1143,7 @@ int transport_push(struct transport *transport, transport->push_options, pretend)) {oid_array_clear (&commits); -die ("failed to push all needed submodules!" ); +die (_ ("failed to push all needed submodules" )); }oid_array_clear (&commits); }
@@ -1265,7 +1265,7 @@ int transport_connect(struct transport *transport, const char *name,if (transport->vtable->connect)return transport->vtable->connect (transport, name, exec, fd);else -die ("operation not supported by protocol" ); +die (_ ("operation not supported by protocol" )); }int transport_disconnect (struct transport *transport)
@@ -1347,7 +1347,7 @@ static void read_alternate_refs(const char *path,if (get_oid_hex (line.buf, &oid) || line.buf[GIT_SHA1_HEXSZ ] !=' ' ) { -warning ("invalid line while parsing alternate refs: %s" , +warning (_ ("invalid line while parsing alternate refs: %s" ), line.buf);break ; }
Signature · 1 line
2.18.0.rc2.476.g39500d3211
PATCH 23/23 transport-helper.c: mark more strings for translation
In reply to Nguyễn Thái Ngọc Duy--- t/t5801-remote-helpers.sh | 8 ++-- transport-helper.c | 87 ++++++++++++++++++++------------------- 2 files changed, 48 insertions(+), 47 deletions(-)
t/t5801-remote-helpers.sh +4 -4
@@ -126,7 +126,7 @@ test_expect_success 'forced push' ' test_expect_success 'cloning without refspec' ' GIT_REMOTE_TESTGIT_REFSPEC="" \ git clone "testgit::${PWD}/server" local2 2>error && - grep "this remote helper should implement refspec capability" error && + test_i18ngrep "this remote helper should implement refspec capability" error && compare_refs local2 HEAD server HEAD '
@@ -134,7 +134,7 @@ test_expect_success 'pulling without refspecs' ' (cd local2 && git reset --hard && GIT_REMOTE_TESTGIT_REFSPEC="" git pull 2>../error) && - grep "this remote helper should implement refspec capability" error && + test_i18ngrep "this remote helper should implement refspec capability" error && compare_refs local2 HEAD server HEAD '
@@ -146,7 +146,7 @@ test_expect_success 'pushing without refspecs' ' GIT_REMOTE_TESTGIT_REFSPEC="" && export GIT_REMOTE_TESTGIT_REFSPEC && test_must_fail git push 2>../error) && - grep "remote-helper doesn.t support push; refspec needed" error + test_i18ngrep "remote-helper doesn.t support push; refspec needed" error ' test_expect_success 'pulling without marks' '
@@ -246,7 +246,7 @@ test_expect_success 'proper failure checks for fetching' ' (cd local && test_must_fail env GIT_REMOTE_TESTGIT_FAILURE=1 git fetch 2>error && cat error && - grep -q "error while running fast-import" error + test_i18ngrep -q "error while running fast-import" error ) '
transport-helper.c +44 -43
295 lines not on this page · raw message
Signature · 1 line
2.18.0.rc2.476.g39500d3211