Shallow fetch: Pass along "shallow"s in unparsed-wants case, too

Since 84d2738ff2 (Don't skip want validation when the client sends no
haves, 2013-06-21), this branch is not taken.  Process the
"shallow"s anyway as a defensive measure in case the code path gets
revived.

Change-Id: Idfb834825d77f51e17191c1635c9d78c78738cfd
Signed-off-by: Jonathan Nieder <jrn@google.com>
This commit is contained in:
Jonathan Nieder 2016-08-08 12:35:36 -07:00
parent f84370feaa
commit b16e207742
2 changed files with 24 additions and 3 deletions

View File

@ -709,11 +709,32 @@ public void preparePack(@NonNull Iterator<RevObject> objectsSource)
public void preparePack(ProgressMonitor countingMonitor,
@NonNull Set<? extends ObjectId> want,
@NonNull Set<? extends ObjectId> have) throws IOException {
preparePack(countingMonitor,
want, have, Collections.<ObjectId> emptySet());
}
/**
* Prepare the list of objects to be written to the pack stream.
* <p>
* Like {@link #preparePack(ProgressMonitor, Set, Set)} but also allows
* specifying commits that should not be walked past ("shallow" commits).
* The caller is responsible for filtering out commits that should not
* be shallow any more ("unshallow" commits as in {@link #setShallowPack})
* from the shallow set.
*
* @since 4.5
*/
public void preparePack(ProgressMonitor countingMonitor,
@NonNull Set<? extends ObjectId> want,
@NonNull Set<? extends ObjectId> have,
@NonNull Set<? extends ObjectId> shallow) throws IOException {
ObjectWalk ow;
if (shallowPack)
if (shallowPack) {
ow = new DepthWalk.ObjectWalk(reader, depth);
else
} else {
ow = new ObjectWalk(reader);
}
ow.assumeShallow(shallow);
preparePack(countingMonitor, ow, want, have);
}

View File

@ -1492,7 +1492,7 @@ else if (ref.getName().startsWith(Constants.R_HEADS))
}
if (wantAll.isEmpty()) {
pw.preparePack(pm, wantIds, commonBase);
pw.preparePack(pm, wantIds, commonBase, clientShallowCommits);
} else {
walk.reset();