diff options
author | Junio C Hamano <gitster@pobox.com> | 2015-05-11 14:23:42 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2015-05-11 14:23:42 -0700 |
commit | 6cc983d0adc9fca975d977b4432c4645db9de464 (patch) | |
tree | eb4c7e9af146935175ce09f0568a9a6b31b5a331 /config.c | |
parent | Merge branch 'lm/squelch-bg-progress' (diff) | |
parent | t1430: add another refs-escape test (diff) | |
download | tgif-6cc983d0adc9fca975d977b4432c4645db9de464.tar.xz |
Merge branch 'jk/reading-packed-refs'
An earlier rewrite to use strbuf_getwholeline() instead of fgets(3)
to read packed-refs file revealed that the former is unacceptably
inefficient.
* jk/reading-packed-refs:
t1430: add another refs-escape test
read_packed_refs: avoid double-checking sane refs
strbuf_getwholeline: use getdelim if it is available
strbuf_getwholeline: avoid calling strbuf_grow
strbuf_addch: avoid calling strbuf_grow
config: use getc_unlocked when reading from file
strbuf_getwholeline: use getc_unlocked
git-compat-util: add fallbacks for unlocked stdio
strbuf_getwholeline: use getc macro
Diffstat (limited to 'config.c')
-rw-r--r-- | config.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -50,7 +50,7 @@ static struct config_set the_config_set; static int config_file_fgetc(struct config_source *conf) { - return fgetc(conf->u.file); + return getc_unlocked(conf->u.file); } static int config_file_ungetc(int c, struct config_source *conf) @@ -1088,7 +1088,9 @@ int git_config_from_file(config_fn_t fn, const char *filename, void *data) f = fopen(filename, "r"); if (f) { + flockfile(f); ret = do_config_from_file(fn, filename, filename, f, data); + funlockfile(f); fclose(f); } return ret; |