All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matthew DeVore <matvore@google.com>
To: Jonathan Tan <jonathantanmy@google.com>
Cc: git@vger.kernel.org, jeffhost@microsoft.com, peff@peff.net,
	stefanbeller@gmail.com
Subject: Re: [PATCH v2 3/5] rev-list: handle missing tree objects properly
Date: Mon, 13 Aug 2018 17:22:38 -0700	[thread overview]
Message-ID: <CAMfpvh+awO8kpVtxKxMDuiXx2XM0o3xGycXdSF+ZJ0NXyzv5Hg@mail.gmail.com> (raw)
In-Reply-To: <20180813182025.14229-1-jonathantanmy@google.com>

Resending this in plain-text mode so that git@vger.kernel.org won't
bounce it. Sorry for those of you receiving this twice.

On Mon, Aug 13, 2018 at 11:20 AM Jonathan Tan <jonathantanmy@google.com> wrote:
>
> > In list-objects.c we no longer print a message to stderr if a tree
> > object is missing (quiet_on_missing is always true). I couldn't find
> > any place where this would matter, or where the caller of
> > traverse_commit_list would need to be fixed to show the error. However,
> > in the future it would be trivial to make the caller show the message if
> > we needed to.
>
> Indeed, and I'm not sure why the message was there in the first place -
> if parsing fails when revs->ignore_missing_links and
> revs->exclude_promisor_objects are both false, we print the OID anyway
> in the "die" call, so any message printed by parse_tree_gently() seems
> superfluous.
>
> It might be better to add an additional commit that removes the "gently"
> condition (in other words, always parsing gently), with a message
> explaining the above. Also, in that commit, I prefer not to add the
> "/*quiet_on_missing*/" explanation (we don't seem to do that in Git
> code); I also know that the ">= 0" is a holdover from the existing "< 0"
> code, but we don't need to do that either.
Good idea. I've added a new commit which replaces the calculation with
a hard-coded "1"
I don't understand about the ">= 0". What should I replace it with?
Maybe you mean the return is never positive so I can change:

parse_tree_gently(tree, 1) >= 0

to:
!parse_tree_gently(tree, 1)

?

>
> > This is not tested very thoroughly, since we cannot create promisor
> > objects in tests without using an actual partial clone. t0410 has a
> > promise_and_delete utility function, but the is_promisor_object function
> > does not return 1 for objects deleted in this way. More tests will will
> > come in a patch that implements a filter that can be used with git
> > clone.
>
> is_promisor_object() should. If you still have the code you used to
> verify that, can you share it? In particular, pay attention to the path
> of the repo - promise_and_delete is hardcoded to use one particular
> path.
It turns out I wasn't setting the extensions.partial_clone config in
my test, and that's why everything wasn't working. So I've moved all
the tests feasible back to the earlier commit. Cool :)

>
> Whether you test in this patch or in the last patch, make sure that the
> following are tested:
>  git rev-list --missing=error, allow-any, allow-promisor, print
>  git rev-list --exclude-promisor-objects
>
Added --missing=print, --missing=allow-any, and
--exclude-promisor-objects to t0410
--missing=allow-promisor did some seem sufficiently interesting or
different from allow-any to justify adding it.
I had to put missing=error into the commit that introduces the tree:0
filter, since that flag causes an automatic attempt to fetch the
missing object, which t0410 does not seem to support. So added test
case "auto-fetching of trees with --missing=error" to t5616.

> Also, test when a tree pointed to by a commit is missing, and when a
> tree pointed to by a tree is missing.
Former is done multiple times already, added latter to t0410 as
"missing non-root tree object and rev-list."
>
> > @@ -152,20 +151,21 @@ static void process_tree(struct traversal_context *ctx,
> >               die("bad tree object");
> >       if (obj->flags & (UNINTERESTING | SEEN))
> >               return;
> > -     if (parse_tree_gently(tree, gently) < 0) {
> > +     parsed = parse_tree_gently(tree, /*quiet_on_missing=*/1) >= 0;
> > +     if (!parsed) {
> >               if (revs->ignore_missing_links)
> >                       return;
> >
> > +             if (!is_promisor_object(&obj->oid))
> > +                     die("bad tree object %s", oid_to_hex(&obj->oid));
> > +
> >               /*
> >                * Pre-filter known-missing tree objects when explicitly
> >                * requested.  This may cause the actual filter to report
> >                * an incomplete list of missing objects.
> >                */
> > -             if (revs->exclude_promisor_objects &&
> > -                 is_promisor_object(&obj->oid))
> > +             if (revs->exclude_promisor_objects)
> >                       return;
> > -
> > -             die("bad tree object %s", oid_to_hex(&obj->oid));
> >       }
>
> The missing mechanism (for error, allow-any, print) should work without
> needing to consult whether an object is a promisor object or not - it
> should just print whatever is missing, so the "if
> (!is_promisor_object..." line looks out of place.
Done. I considered that a missing object which is not a promisor is a
serious error, so I had it die here. But now that I've added the
do_not_die_on_missing_tree flag, it's more natural to keep the
previous promisor check as-is. Also, is_promisor_object is an
expensive check, and it would be better to skip it during the common
execution path (which should be when exclude_promisor_objects, an
internal-use-only flag, is *not* set, which means we never call
is_promisor_object.

>
> In my original review [1], I suggested that we always show a tree if we
> have its hash - if we don't have the object, we just recurse into it.
> This would be the same as your patch, except that the 'die("bad tree
> object...' is totally removed instead of merely moved. I still think
> this solution has some merit - all the tests still pass (except that we
> need to check for "unable to read" instead of "bad tree object" in error
> messages), but I just realized that it might still be backwards
> incompatible in that a basic "rev-list --objects" would now succeed
> instead of fail if a tree was missing (I haven't tested this though).
The presence of the die if !is_promisor_object is what justified the
changing of the parse_tree_gently to always be gently, since it is
what showed the OID. Can we really remove both? Maybe in a different
patch set, since I'm no longer touching that line?

>
> We might need a flag called "do_not_die_on_missing_tree" (much like your
> original idea of "show_missing_trees") so that callers that are prepared
> to deal with missing trees can set this. Sorry for the churn. You can
> document it as such:
Added it, but not with a command-line flag, only in rev-info.h. We can
always  add a flag later if people have been relying on the existing
behavior of git rev-list to balk at missing trees. (That seems
unlikely though, considering there is no filter to enable that before
this patchset).

>
>  Blobs are shown without regard for their existence. But not so for
>  trees: unless exclude_promisor_objects is set and the tree in question
>  is a promisor object, or ignore_missing_links is set (and in this case,
>  the tree in question may or may not be a promisor object), the revision
>  walker dies with a "bad tree object" message when encountering a
>  missing tree.
>
>  For callers that can handle missing trees and want them to be
>  filterable and showable, set this to true. The revision walker will
>  filter and show such a missing tree as usual, but will not attempt to
>  recurse into this tree object.
>
> [1] https://public-inbox.org/git/20180810002411.13447-1-jonathantanmy@google.com/

  reply	other threads:[~2018-08-14  0:22 UTC|newest]

Thread overview: 151+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-08-09 22:44 [RFC PATCH 0/5] filter: support for excluding all trees and blobs Matthew DeVore
2018-08-09 22:45 ` [PATCH 1/5] revision: invert meaning of the USER_GIVEN flag Matthew DeVore
2018-08-10 18:43   ` Jonathan Tan
2018-08-09 22:45 ` [PATCH 2/5] list-objects-filter: implement filter only:commits Matthew DeVore
2018-08-10  0:14   ` Jonathan Tan
2018-08-09 22:45 ` [PATCH 3/5] list-objects: store common func args in struct Matthew DeVore
2018-08-09 22:45 ` [PATCH 4/5] list-objects: refactor to process_tree_contents Matthew DeVore
2018-08-09 22:45 ` [PATCH 5/5] rev-list: handle missing tree objects properly Matthew DeVore
2018-08-10  0:24   ` Jonathan Tan
2018-08-10 19:03 ` [RFC PATCH 0/5] filter: support for excluding all trees and blobs Jonathan Tan
2018-08-10 23:06 ` [PATCH v2 " Matthew DeVore
2018-08-10 23:06   ` [PATCH v2 1/5] list-objects: store common func args in struct Matthew DeVore
2018-08-10 23:06   ` [PATCH v2 2/5] list-objects: refactor to process_tree_contents Matthew DeVore
2018-08-10 23:06   ` [PATCH v2 3/5] rev-list: handle missing tree objects properly Matthew DeVore
2018-08-13 18:20     ` Jonathan Tan
2018-08-14  0:22       ` Matthew DeVore [this message]
2018-08-14 16:03         ` Jonathan Tan
2018-08-10 23:06   ` [PATCH v2 4/5] revision: mark non-user-given objects instead Matthew DeVore
2018-08-10 23:06   ` [PATCH v2 5/5] list-objects-filter: implement filter tree:none Matthew DeVore
2018-08-13 16:38     ` Jeff Hostetler
2018-08-14  0:57       ` Matthew DeVore
2018-08-13 18:29     ` Jonathan Tan
2018-08-14  0:55       ` Matthew DeVore
2018-08-13 18:14 ` [PATCH v3 0/5] filter: support for excluding all trees and blobs Matthew DeVore
2018-08-13 18:14   ` [PATCH v3 1/5] list-objects: store common func args in struct Matthew DeVore
2018-08-13 18:14   ` [PATCH v3 2/5] list-objects: refactor to process_tree_contents Matthew DeVore
2018-08-13 18:14   ` [PATCH v3 3/5] rev-list: handle missing tree objects properly Matthew DeVore
2018-08-13 18:14   ` [PATCH v3 4/5] revision: mark non-user-given objects instead Matthew DeVore
2018-08-13 18:14   ` [PATCH v3 5/5] list-objects-filter: implement filter tree:0 Matthew DeVore
2018-08-14 15:13     ` Jeff Hostetler
2018-08-14 17:25       ` Matthew DeVore
2018-10-03 19:00       ` Matthew DeVore
2018-08-14 17:28 ` [PATCH v4 0/6] filter: support for excluding all trees and blobs Matthew DeVore
2018-08-14 17:28   ` [PATCH v4 1/6] list-objects: store common func args in struct Matthew DeVore
2018-08-14 17:28   ` [PATCH v4 2/6] list-objects: refactor to process_tree_contents Matthew DeVore
2018-08-14 17:28   ` [PATCH v4 3/6] list-objects: always parse trees gently Matthew DeVore
2018-08-14 17:28   ` [PATCH v4 4/6] rev-list: handle missing tree objects properly Matthew DeVore
2018-08-14 18:06     ` Jonathan Tan
2018-08-14 22:43       ` Matthew DeVore
2018-08-14 22:56         ` Jonathan Tan
2018-08-14 23:14           ` Jonathan Tan
2018-08-14 17:28   ` [PATCH v4 5/6] revision: mark non-user-given objects instead Matthew DeVore
2018-08-14 17:28   ` [PATCH v4 6/6] list-objects-filter: implement filter tree:0 Matthew DeVore
2018-08-14 18:18     ` Jonathan Tan
2018-08-14 20:00       ` Matthew DeVore
2018-08-14 20:19         ` Jonathan Tan
2018-08-14 20:55           ` Junio C Hamano
2018-08-14 23:30             ` Matthew DeVore
2018-08-15 16:14               ` Junio C Hamano
2018-08-15 16:37                 ` Matthew DeVore
2018-08-14 20:01     ` Jeff King
2018-08-14 23:55       ` Matthew DeVore
2018-08-15  1:22         ` Jeff King
2018-08-15 16:17           ` Junio C Hamano
2018-08-15 17:54             ` Matthew DeVore
2018-08-15  0:22 ` [PATCH v5 0/6] filter: support for excluding all trees and blobs Matthew DeVore
2018-08-15  0:22   ` [PATCH v5 1/6] list-objects: store common func args in struct Matthew DeVore
2018-08-15  0:22   ` [PATCH v5 2/6] list-objects: refactor to process_tree_contents Matthew DeVore
2018-08-15  0:22   ` [PATCH v5 3/6] list-objects: always parse trees gently Matthew DeVore
2018-08-15  0:22   ` [PATCH v5 4/6] rev-list: handle missing tree objects properly Matthew DeVore
2018-08-15  0:22   ` [PATCH v5 5/6] revision: mark non-user-given objects instead Matthew DeVore
2018-08-15  0:22   ` [PATCH v5 6/6] list-objects-filter: implement filter tree:0 Matthew DeVore
2018-08-15 23:19 ` [PATCH v6 0/6] filter: support for excluding all trees and blobs Matthew DeVore
2018-08-15 23:19   ` [PATCH v6 1/6] list-objects: store common func args in struct Matthew DeVore
2018-08-15 23:19   ` [PATCH v6 2/6] list-objects: refactor to process_tree_contents Matthew DeVore
2018-08-15 23:19   ` [PATCH v6 3/6] list-objects: always parse trees gently Matthew DeVore
2018-08-15 23:19   ` [PATCH v6 4/6] rev-list: handle missing tree objects properly Matthew DeVore
2018-08-15 23:19   ` [PATCH v6 5/6] revision: mark non-user-given objects instead Matthew DeVore
2018-08-15 23:19   ` [PATCH v6 6/6] list-objects-filter: implement filter tree:0 Matthew DeVore
2018-08-17 21:42     ` Stefan Beller
2018-08-17 22:19       ` Matthew DeVore
2018-08-17 22:28         ` Stefan Beller
2018-08-20 23:30           ` Matthew DeVore
2018-08-21  0:29             ` Stefan Beller
2018-08-21 21:46               ` Junio C Hamano
2018-08-22 18:00                 ` Stefan Beller
2018-08-18 16:17     ` Duy Nguyen
2018-08-20 13:04       ` Matthew DeVore
2018-08-20 18:38         ` Stefan Beller
2018-08-20 23:20           ` Matthew DeVore
2018-08-21  0:36             ` Stefan Beller
2018-08-21 15:50           ` Duy Nguyen
2018-09-04 18:05 ` [PATCH v7 0/7] filter: support for excluding all trees and blobs Matthew DeVore
2018-09-04 18:05   ` [PATCH v7 1/7] list-objects: store common func args in struct Matthew DeVore
2018-09-04 18:05   ` [PATCH v7 2/7] list-objects: refactor to process_tree_contents Matthew DeVore
2018-09-04 18:05   ` [PATCH v7 3/7] list-objects: always parse trees gently Matthew DeVore
2018-09-04 18:05   ` [PATCH v7 4/7] rev-list: handle missing tree objects properly Matthew DeVore
2018-09-04 18:05   ` [PATCH v7 5/7] revision: mark non-user-given objects instead Matthew DeVore
2018-09-04 20:31     ` Junio C Hamano
2018-09-05 18:00       ` Matthew DeVore
2018-09-04 18:05   ` [PATCH v7 6/7] list-objects-filter: use BUG rather than die Matthew DeVore
2018-09-04 20:32     ` Junio C Hamano
2018-09-04 18:05   ` [PATCH v7 7/7] list-objects-filter: implement filter tree:0 Matthew DeVore
2018-09-04 20:44     ` Junio C Hamano
2018-09-06  0:08       ` Matthew DeVore
2018-09-04 18:41   ` [PATCH v7 0/7] filter: support for excluding all trees and blobs Stefan Beller
2018-09-14  0:55 ` [PATCH v8 " Matthew DeVore
2018-09-14  0:55   ` [PATCH v8 1/7] list-objects: store common func args in struct Matthew DeVore
2018-09-14  0:55   ` [PATCH v8 2/7] list-objects: refactor to process_tree_contents Matthew DeVore
2018-09-14  0:55   ` [PATCH v8 3/7] list-objects: always parse trees gently Matthew DeVore
2018-09-14  0:55   ` [PATCH v8 4/7] rev-list: handle missing tree objects properly Matthew DeVore
2018-09-14  0:55   ` [PATCH v8 5/7] revision: mark non-user-given objects instead Matthew DeVore
2018-09-14 17:23     ` Junio C Hamano
2018-09-14 20:08       ` Matthew DeVore
2018-09-14  0:55   ` [PATCH v8 6/7] list-objects-filter: use BUG rather than die Matthew DeVore
2018-09-14  0:55   ` [PATCH v8 7/7] list-objects-filter: implement filter tree:0 Matthew DeVore
2018-09-14 17:39     ` Junio C Hamano
2018-09-14 17:47       ` Junio C Hamano
2018-09-15  0:41         ` Matthew DeVore
2018-09-21 20:31 ` [PATCH v9 0/8] filter: support for excluding all trees and blobs Matthew DeVore
2018-09-21 20:31   ` [PATCH v9 1/8] list-objects: store common func args in struct Matthew DeVore
2018-09-21 20:31   ` [PATCH v9 2/8] list-objects: refactor to process_tree_contents Matthew DeVore
2018-09-21 20:31   ` [PATCH v9 3/8] list-objects: always parse trees gently Matthew DeVore
2018-09-21 20:32   ` [PATCH v9 4/8] rev-list: handle missing tree objects properly Matthew DeVore
2018-09-21 20:32   ` [PATCH v9 5/8] revision: mark non-user-given objects instead Matthew DeVore
2018-09-21 20:32   ` [PATCH v9 6/8] list-objects-filter: use BUG rather than die Matthew DeVore
2018-09-21 20:32   ` [PATCH v9 7/8] list-objects-filter-options: do not over-strbuf_init Matthew DeVore
2018-09-21 20:32   ` [PATCH v9 8/8] list-objects-filter: implement filter tree:0 Matthew DeVore
2018-10-03 19:52 ` [PATCH v10 0/8] filter: support for excluding all trees and blobs Matthew DeVore
2018-10-03 19:52   ` [PATCH v10 1/8] list-objects: store common func args in struct Matthew DeVore
2018-10-03 19:52   ` [PATCH v10 2/8] list-objects: refactor to process_tree_contents Matthew DeVore
2018-10-03 19:52   ` [PATCH v10 3/8] list-objects: always parse trees gently Matthew DeVore
2018-10-03 19:52   ` [PATCH v10 4/8] rev-list: handle missing tree objects properly Matthew DeVore
2018-10-03 19:52   ` [PATCH v10 5/8] revision: mark non-user-given objects instead Matthew DeVore
2018-10-03 19:52   ` [PATCH v10 6/8] list-objects-filter: use BUG rather than die Matthew DeVore
2018-10-03 19:52   ` [PATCH v10 7/8] list-objects-filter-options: do not over-strbuf_init Matthew DeVore
2018-10-03 19:52   ` [PATCH v10 8/8] list-objects-filter: implement filter tree:0 Matthew DeVore
2018-10-03 23:08   ` [PATCH v10 0/8] filter: support for excluding all trees and blobs Matthew DeVore
2018-10-05 21:31 ` [PATCH v11 " Matthew DeVore
2018-10-05 21:31   ` [PATCH v11 1/8] list-objects: store common func args in struct Matthew DeVore
2018-10-05 21:31   ` [PATCH v11 2/8] list-objects: refactor to process_tree_contents Matthew DeVore
2018-10-05 21:31   ` [PATCH v11 3/8] list-objects: always parse trees gently Matthew DeVore
2018-10-05 21:31   ` [PATCH v11 4/8] rev-list: handle missing tree objects properly Matthew DeVore
2018-10-05 21:31   ` [PATCH v11 5/8] revision: mark non-user-given objects instead Matthew DeVore
2018-10-05 21:31   ` [PATCH v11 6/8] list-objects-filter: use BUG rather than die Matthew DeVore
2018-10-05 21:31   ` [PATCH v11 7/8] list-objects-filter-options: do not over-strbuf_init Matthew DeVore
2018-10-05 21:31   ` [PATCH v11 8/8] list-objects-filter: implement filter tree:0 Matthew DeVore
2018-10-07  0:10     ` Junio C Hamano
2018-10-08 17:23       ` Matthew DeVore
2018-10-12 20:01 ` [PATCH v12 0/8] filter: support for excluding all trees and blobs Matthew DeVore
2018-10-12 20:01   ` [PATCH v12 1/8] list-objects: store common func args in struct Matthew DeVore
2018-10-12 20:01   ` [PATCH v12 2/8] list-objects: refactor to process_tree_contents Matthew DeVore
2018-10-12 20:01   ` [PATCH v12 3/8] list-objects: always parse trees gently Matthew DeVore
2018-10-12 20:01   ` [PATCH v12 4/8] rev-list: handle missing tree objects properly Matthew DeVore
2018-10-12 20:01   ` [PATCH v12 5/8] revision: mark non-user-given objects instead Matthew DeVore
2018-10-12 20:01   ` [PATCH v12 6/8] list-objects-filter: use BUG rather than die Matthew DeVore
2018-10-12 20:01   ` [PATCH v12 7/8] list-objects-filter-options: do not over-strbuf_init Matthew DeVore
2018-10-12 20:01   ` [PATCH v12 8/8] list-objects-filter: implement filter tree:0 Matthew DeVore
2018-10-15  2:37   ` [PATCH v12 0/8] filter: support for excluding all trees and blobs Junio C Hamano
2018-10-15  3:42     ` Junio C Hamano
2018-10-16 15:00       ` Matthew DeVore

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAMfpvh+awO8kpVtxKxMDuiXx2XM0o3xGycXdSF+ZJ0NXyzv5Hg@mail.gmail.com \
    --to=matvore@google.com \
    --cc=git@vger.kernel.org \
    --cc=jeffhost@microsoft.com \
    --cc=jonathantanmy@google.com \
    --cc=peff@peff.net \
    --cc=stefanbeller@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.