summaryrefslogtreecommitdiff
path: root/ref-filter.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2018-11-18 18:23:59 +0900
committerLibravatar Junio C Hamano <gitster@pobox.com>2018-11-18 18:23:59 +0900
commit7bdebaa646787b98679799ee27bfb42fb7daa8ca (patch)
treeff6dc6265ac51f3af6c58d736311166839857ec0 /ref-filter.c
parentMerge branch 'nd/doc-extensions' (diff)
parentref-filter: don't look for objects when outside of a repository (diff)
downloadtgif-7bdebaa646787b98679799ee27bfb42fb7daa8ca.tar.xz
Merge branch 'sg/ref-filter-wo-repository'
"git ls-remote --sort=<thing>" 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
Diffstat (limited to 'ref-filter.c')
-rw-r--r--ref-filter.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/ref-filter.c b/ref-filter.c
index 7eca436223..6c70d797a9 100644
--- a/ref-filter.c
+++ b/ref-filter.c
@@ -534,6 +534,10 @@ static int parse_ref_filter_atom(const struct ref_format *format,
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;