]> source.dussan.org Git - jgit.git/commit
Use bitmaps for non-commit reachability checks 85/111085/8
authorJonathan Tan <jonathantanmy@google.com>
Thu, 2 Nov 2017 00:36:18 +0000 (17:36 -0700)
committerJonathan Tan <jonathantanmy@google.com>
Fri, 10 Nov 2017 23:41:31 +0000 (15:41 -0800)
commitd3021788d25d9a6f88006238c7399c78314da2fb
treeb2a719682e9451a3e7034b50f47d66bdef3e0cf6
parentccf25f95411d7faae7b7aa5a75d74c62e6c47e07
Use bitmaps for non-commit reachability checks

Currently, unless RequestPolicy#ANY is used, UploadPack rejects all
non-commit "want" lines unless they were advertized. This is fine,
except when "uploadpack.allowreachablesha1inwant" is true
(corresponding to RequestPolicy#REACHABLE_COMMIT), in which case one
would expect that "want"-ing anything reachable would work.

(There is no restriction that "want" lines must only contain commits -
it is allowed for refs to directly point to trees and blobs, and
requesting for them using "want" lines works.)

This commit has been written to avoid performance regressions as much
as possible. In the usual (and currently working) case where the only
unadvertized things requested are commits, we do a standard RevWalk in
order to avoid incurring the cost of loading bitmaps. However, if
unadvertized non-commits are requested, bitmaps are used instead, and
if there are no bitmaps, a WantNotValidException is thrown (as is
currently done).

Change-Id: I68ed4abd0e477ff415c696c7544ccaa234df7f99
Signed-off-by: Jonathan Tan <jonathantanmy@google.com>
org.eclipse.jgit.test/tst/org/eclipse/jgit/transport/UploadPackTest.java
org.eclipse.jgit/src/org/eclipse/jgit/transport/UploadPack.java