public abstract class RefAdvertiser extends Object
UploadPack
and ReceivePack
.Modifier and Type | Class and Description |
---|---|
static class |
RefAdvertiser.PacketLineOutRefAdvertiser
Advertiser which frames lines in a
PacketLineOut format. |
Constructor and Description |
---|
RefAdvertiser() |
Modifier and Type | Method and Description |
---|---|
void |
advertiseCapability(String name)
Add one protocol capability to the initial advertisement.
|
void |
advertiseHave(AnyObjectId id)
Advertise one object is available using the magic
.have . |
void |
advertiseId(AnyObjectId id,
String refName)
Advertise one object under a specific name.
|
protected abstract void |
end()
Mark the end of the advertisements.
|
void |
init(Repository src)
Initialize this advertiser with a repository for peeling tags.
|
boolean |
isEmpty() |
Set<ObjectId> |
send(Map<String,Ref> refs)
Format an advertisement for the supplied refs.
|
void |
setDerefTags(boolean deref)
Toggle tag peeling.
|
protected abstract void |
writeOne(CharSequence line)
Write a single advertisement line.
|
public void init(Repository src)
src
- the repository to read from.public void setDerefTags(boolean deref)
deref
- true to show the dereferenced value of a tag as the special
ref $tag^{}
; false to omit it from the output.public void advertiseCapability(String name)
This method must be invoked prior to any of the following:
name
- the name of a single protocol capability supported by the
caller. The set of capabilities are sent to the client in the
advertisement, allowing the client to later selectively enable
features it recognizes.public Set<ObjectId> send(Map<String,Ref> refs) throws IOException
refs
- zero or more refs to format for the client. The collection is
sorted before display if necessary, and therefore may appear
in any order.IOException
- the underlying output stream failed to write out an
advertisement record.public void advertiseHave(AnyObjectId id) throws IOException
.have
.
The magic .have
advertisement is not available for fetching by a
client, but can be used by a client when considering a delta base
candidate before transferring data in a push. Within the record created
by this method the ref name is simply the invalid string .have
.
id
- identity of the object that is assumed to exist.IOException
- the underlying output stream failed to write out an
advertisement record.public boolean isEmpty()
public void advertiseId(AnyObjectId id, String refName) throws IOException
If the advertised object is a tag, this method does not advertise the peeled version of it.
id
- the object to advertise.refName
- name of the reference to advertise the object as, can be any
string not including the NUL byte.IOException
- the underlying output stream failed to write out an
advertisement record.protected abstract void writeOne(CharSequence line) throws IOException
line
- the advertisement line to be written. The line always ends
with LF. Never null or the empty string.IOException
- the underlying output stream failed to write out an
advertisement record.protected abstract void end() throws IOException
IOException
- the underlying output stream failed to write out an
advertisement record.Copyright © 2014. All rights reserved.