From: Junio C Hamano Date: Wed, 27 Dec 2017 19:16:20 +0000 (-0800) Subject: Merge branch 'jh/object-filtering' X-Git-Tag: v2.16.0-rc0~37 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=61061abba7d60f555e97a22ab5775a9d53db1660;p=thirdparty%2Fgit.git Merge branch 'jh/object-filtering' In preparation for implementing narrow/partial clone, the object walking machinery has been taught a way to tell it to "filter" some objects from enumeration. * jh/object-filtering: rev-list: support --no-filter argument list-objects-filter-options: support --no-filter list-objects-filter-options: fix 'keword' typo in comment pack-objects: add list-objects filtering rev-list: add list-objects filtering support list-objects: filter objects in traverse_commit_list oidset: add iterator methods to oidset oidmap: add oidmap iterator methods dir: allow exclusions from blob in addition to file --- 61061abba7d60f555e97a22ab5775a9d53db1660 diff --cc builtin/pack-objects.c index 631de28761,45ad35d918..6b9cfc289d --- a/builtin/pack-objects.c +++ b/builtin/pack-objects.c @@@ -2553,9 -2563,45 +2564,45 @@@ static void show_object(struct object * obj->flags |= OBJECT_ADDED; } + static void show_object__ma_allow_any(struct object *obj, const char *name, void *data) + { + assert(arg_missing_action == MA_ALLOW_ANY); + + /* + * Quietly ignore ALL missing objects. This avoids problems with + * staging them now and getting an odd error later. + */ + if (!has_object_file(&obj->oid)) + return; + + show_object(obj, name, data); + } + + static int option_parse_missing_action(const struct option *opt, + const char *arg, int unset) + { + assert(arg); + assert(!unset); + + if (!strcmp(arg, "error")) { + arg_missing_action = MA_ERROR; + fn_show_object = show_object; + return 0; + } + + if (!strcmp(arg, "allow-any")) { + arg_missing_action = MA_ALLOW_ANY; + fn_show_object = show_object__ma_allow_any; + return 0; + } + + die(_("invalid value for --missing")); + return 0; + } + static void show_edge(struct commit *commit) { - add_preferred_base(commit->object.oid.hash); + add_preferred_base(&commit->object.oid); } struct in_pack_object {