From: Junio C Hamano Date: Wed, 20 Mar 2019 06:16:07 +0000 (+0900) Subject: Merge branch 'jk/virtual-objects-do-exist' X-Git-Tag: v2.22.0-rc0~138 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/83b13e284ce3e349aedfc48fc0fb885c390bb18b?ds=inline;hp=-c Merge branch 'jk/virtual-objects-do-exist' A recent update broke "is this object available to us?" check for well-known objects like an empty tree (which should yield "yes", even when there is no on-disk object for an empty tree), which has been corrected. * jk/virtual-objects-do-exist: rev-list: allow cached objects in existence check --- 83b13e284ce3e349aedfc48fc0fb885c390bb18b diff --combined builtin/rev-list.c index 5b5b6dbb1c,877b6561f4..425a5774db --- a/builtin/rev-list.c +++ b/builtin/rev-list.c @@@ -197,8 -197,7 +197,8 @@@ static void finish_commit(struct commi free_commit_list(commit->parents); commit->parents = NULL; } - free_commit_buffer(commit); + free_commit_buffer(the_repository->parsed_objects, + commit); } static inline void finish_object__ma(struct object *obj) @@@ -238,7 -237,7 +238,7 @@@ static int finish_object(struct object *obj, const char *name, void *cb_data) { struct rev_list_info *info = cb_data; - if (!has_object_file(&obj->oid)) { + if (oid_object_info_extended(the_repository, &obj->oid, NULL, 0) < 0) { finish_object__ma(obj); return 1; } @@@ -362,9 -361,6 +362,9 @@@ int cmd_rev_list(int argc, const char * { struct rev_info revs; struct rev_list_info info; + struct setup_revision_opt s_r_opt = { + .allow_exclude_promisor_objects = 1, + }; int i; int bisect_list = 0; int bisect_show_vars = 0; @@@ -376,7 -372,7 +376,7 @@@ usage(rev_list_usage); git_config(git_default_config, NULL); - init_revisions(&revs, prefix); + repo_init_revisions(the_repository, &revs, prefix); revs.abbrev = DEFAULT_ABBREV; revs.commit_format = CMIT_FMT_UNSPECIFIED; revs.do_not_die_on_missing_tree = 1; @@@ -409,7 -405,7 +409,7 @@@ } } - argc = setup_revisions(argc, argv, &revs, NULL); + argc = setup_revisions(argc, argv, &revs, &s_r_opt); memset(&info, 0, sizeof(info)); info.revs = &revs; @@@ -500,7 -496,7 +500,7 @@@ if ((!revs.commits && reflog_walk_empty(revs.reflog_info) && (!(revs.tag_objects || revs.tree_objects || revs.blob_objects) && !revs.pending.nr) && - !revs.rev_input_given) || + !revs.rev_input_given && !revs.read_from_stdin) || revs.diff) usage(rev_list_usage); @@@ -546,7 -542,7 +546,7 @@@ if (prepare_revision_walk(&revs)) die("revision walk setup failed"); if (revs.tree_objects) - mark_edges_uninteresting(&revs, show_edge); + mark_edges_uninteresting(&revs, show_edge, 0); if (bisect_list) { int reaches, all; diff --combined t/t1060-object-corruption.sh index 4feb65157d,807b63b473..bc89371f53 --- a/t/t1060-object-corruption.sh +++ b/t/t1060-object-corruption.sh @@@ -117,14 -117,22 +117,24 @@@ test_expect_failure 'clone --local dete ' test_expect_success 'fetch into corrupted repo with index-pack' ' + cp -R bit-error bit-error-cp && + test_when_finished "rm -rf bit-error-cp" && ( - cd bit-error && + cd bit-error-cp && test_must_fail git -c transfer.unpackLimit=1 \ fetch ../no-bit-error 2>stderr && test_i18ngrep ! -i collision stderr ) ' + test_expect_success 'internal tree objects are not "missing"' ' + git init missing-empty && + ( + cd missing-empty && + empty_tree=$(git hash-object -t tree /dev/null) && + commit=$(echo foo | git commit-tree $empty_tree) && + git rev-list --objects $commit + ) + ' + test_done