From: Junio C Hamano Date: Mon, 8 Aug 2016 21:48:38 +0000 (-0700) Subject: Merge branch 'va/i18n' X-Git-Tag: v2.10.0-rc0~44 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/768ededa9c4e804ead6d473d4fe3a8092a77b05c?ds=inline;hp=-c Merge branch 'va/i18n' More i18n marking. * va/i18n: i18n: config: unfold error messages marked for translation i18n: notes: mark comment for translation --- 768ededa9c4e804ead6d473d4fe3a8092a77b05c diff --combined cache.h index 6cddf2c1de,c802098167..e8128fc5d6 --- a/cache.h +++ b/cache.h @@@ -1230,8 -1230,7 +1230,8 @@@ struct date_mode DATE_ISO8601_STRICT, DATE_RFC2822, DATE_STRFTIME, - DATE_RAW + DATE_RAW, + DATE_UNIX } type; const char *strftime_fmt; int local; @@@ -1516,7 -1515,7 +1516,7 @@@ struct object_info /* Request */ enum object_type *typep; unsigned long *sizep; - unsigned long *disk_sizep; + off_t *disk_sizep; unsigned char *delta_base_sha1; struct strbuf *typename; @@@ -1567,10 -1566,18 +1567,18 @@@ struct git_config_source const char *blob; }; + enum config_origin_type { + CONFIG_ORIGIN_BLOB, + CONFIG_ORIGIN_FILE, + CONFIG_ORIGIN_STDIN, + CONFIG_ORIGIN_SUBMODULE_BLOB, + CONFIG_ORIGIN_CMDLINE + }; + typedef int (*config_fn_t)(const char *, const char *, void *); extern int git_default_config(const char *, const char *, void *); extern int git_config_from_file(config_fn_t fn, const char *, void *); - extern int git_config_from_mem(config_fn_t fn, const char *origin_type, + extern int git_config_from_mem(config_fn_t fn, const enum config_origin_type, const char *name, const char *buf, size_t len, void *data); extern void git_config_push_parameter(const char *text); extern int git_config_from_parameters(config_fn_t fn, void *data); @@@ -1714,7 -1721,7 +1722,7 @@@ extern int ignore_untracked_cache_confi struct key_value_info { const char *filename; int linenr; - const char *origin_type; + enum config_origin_type origin_type; enum config_scope scope; }; diff --combined submodule-config.c index faedb1a489,1753e01755..d22a851d27 --- a/submodule-config.c +++ b/submodule-config.c @@@ -371,9 -371,9 +371,9 @@@ static int parse_config(const char *var } static int gitmodule_sha1_from_commit(const unsigned char *commit_sha1, - unsigned char *gitmodules_sha1) + unsigned char *gitmodules_sha1, + struct strbuf *rev) { - struct strbuf rev = STRBUF_INIT; int ret = 0; if (is_null_sha1(commit_sha1)) { @@@ -381,10 -381,11 +381,10 @@@ return 1; } - strbuf_addf(&rev, "%s:.gitmodules", sha1_to_hex(commit_sha1)); - if (get_sha1(rev.buf, gitmodules_sha1) >= 0) + strbuf_addf(rev, "%s:.gitmodules", sha1_to_hex(commit_sha1)); + if (get_sha1(rev->buf, gitmodules_sha1) >= 0) ret = 1; - strbuf_release(&rev); return ret; } @@@ -398,7 -399,7 +398,7 @@@ static const struct submodule *config_f { struct strbuf rev = STRBUF_INIT; unsigned long config_size; - char *config; + char *config = NULL; unsigned char sha1[20]; enum object_type type; const struct submodule *submodule = NULL; @@@ -419,8 -420,8 +419,8 @@@ return entry->config; } - if (!gitmodule_sha1_from_commit(commit_sha1, sha1)) - return NULL; + if (!gitmodule_sha1_from_commit(commit_sha1, sha1, &rev)) + goto out; switch (lookup_type) { case lookup_name: @@@ -431,20 -432,24 +431,20 @@@ break; } if (submodule) - return submodule; + goto out; config = read_sha1_file(sha1, &type, &config_size); - if (!config) - return NULL; - - if (type != OBJ_BLOB) { - free(config); - return NULL; - } + if (!config || type != OBJ_BLOB) + goto out; /* fill the submodule config into the cache */ parameter.cache = cache; parameter.commit_sha1 = commit_sha1; parameter.gitmodules_sha1 = sha1; parameter.overwrite = 0; - git_config_from_mem(parse_config, "submodule-blob", rev.buf, + git_config_from_mem(parse_config, CONFIG_ORIGIN_SUBMODULE_BLOB, rev.buf, config, config_size, ¶meter); + strbuf_release(&rev); free(config); switch (lookup_type) { @@@ -455,11 -460,6 +455,11 @@@ default: return NULL; } + +out: + strbuf_release(&rev); + free(config); + return submodule; } static const struct submodule *config_from_path(struct submodule_cache *cache,