From: Junio C Hamano Date: Sun, 18 Nov 2018 09:23:59 +0000 (+0900) Subject: Merge branch 'sg/ref-filter-wo-repository' X-Git-Tag: v2.20.0-rc0~4 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/7bdebaa646787b98679799ee27bfb42fb7daa8ca?ds=inline;hp=-c Merge branch 'sg/ref-filter-wo-repository' "git ls-remote --sort=" can feed an object that is not yet available into the comparison machinery and segfault, which has been corrected to check such a request upfront and reject it. * sg/ref-filter-wo-repository: ref-filter: don't look for objects when outside of a repository --- 7bdebaa646787b98679799ee27bfb42fb7daa8ca diff --combined ref-filter.c index 7eca436223,a1290659af..6c70d797a9 --- a/ref-filter.c +++ b/ref-filter.c @@@ -534,6 -534,10 +534,10 @@@ static int parse_ref_filter_atom(const if (ARRAY_SIZE(valid_atom) <= i) return strbuf_addf_ret(err, -1, _("unknown field name: %.*s"), (int)(ep-atom), atom); + if (valid_atom[i].source != SOURCE_NONE && !have_git_dir()) + return strbuf_addf_ret(err, -1, + _("not a git repository, but the field '%.*s' requires access to object data"), + (int)(ep-atom), atom); /* Add it in, including the deref prefix */ at = used_atom_cnt; @@@ -2316,8 -2320,6 +2320,8 @@@ int parse_opt_merge_filter(const struc struct object_id oid; int no_merged = starts_with(opt->long_name, "no"); + BUG_ON_OPT_NEG(unset); + if (rf->merge) { if (no_merged) { return opterror(opt, "is incompatible with --merged", 0);