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;
v->s = xstrdup(type_name(oi->type));
else if (!strcmp(name, "objectsize")) {
v->value = oi->size;
- v->s = xstrfmt("%lu", oi->size);
+ v->s = xstrfmt("%"PRIuMAX , (uintmax_t)oi->size);
}
else if (deref)
grab_objectname(name, &oi->oid, v, &used_atom[i]);
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);