The batch update is primarily useful in the transport code, where a client or server is making changes to more than one reference at a time.
| Modifier and Type | Field and Description |
|---|---|
| private boolean | allowNonFastForwards
Does the caller permit a forced update on a reference? |
| private boolean | atomic
Whether updates should be atomic. |
| private final List | commands
Commands to apply during this batch. |
| private boolean | forceRefLog
Should reflogs be written even if the configured default for this ref is not to write it. |
| protected static final Duration | MAX_WAIT
Maximum delay the calling thread will tolerate while waiting for a
|
| private PushCertificate | pushCert
Push certificate associated with this update. |
| private List | pushOptions
Push options associated with this update. |
| private final RefDatabase | |
| private PersonIdent | refLogIdent
Identity to record action as within the reflog. |
| private boolean | refLogIncludeResult
Should the result value be appended to |
| private String | refLogMessage
Message the caller wants included in the reflog. |
| private List | timestamps
Associated timestamps that should be blocked on before update. |
| Access | Constructor and Description |
|---|---|
| protected | BatchRefUpdate(RefDatabase
the reference database of the repository to be updated. refdb)Initialize a new batch update. |
| Modifier and Type | Method and Description |
|---|---|
| public BatchRefUpdate | Returns: this.the command to add, must not be null. cmd)Add a single command to this batch update. |
| public BatchRefUpdate | Returns: this.the commands to add, must not be null. cmd)Add commands to this batch update. |
| public BatchRefUpdate | Returns: this.the commands to add, must not be null. cmd)Add commands to this batch update. |
| protected static void | addPrefixesTo(String
ref name. name, Collection<String> path prefixes of the ref name. For out)refs/heads/foo,
returns refs and refs/heads.Add prefixes of a ref name to an existing collection. |
| public BatchRefUpdate | Returns: this.Request the batch to wait for the affected timestamps to resolve. |
| protected boolean | Returns: true if timestamps were successfully waited for; false if commands were aborted.maximum amount of time to wait for timestamps to resolve. maxWait)Wait for timestamps to be in the past, aborting commands on timeout. |
| public BatchRefUpdate | |
| public void | execute(RevWalk
a RevWalk to parse tags in case the storage system wants to
store them pre-peeled, a common performance optimization. walk, ProgressMonitor progress monitor to receive update status on. monitor, List<String> a list of option strings; set null to execute without options)Execute this batch update. |
| public void | execute(RevWalk
a RevWalk to parse tags in case the storage system wants to
store them pre-peeled, a common performance optimization. walk, ProgressMonitor progress monitor to receive update status on. monitor)Execute this batch update without option strings. |
| public List | |
| protected static Collection | Returns: path prefixes of the ref name. Forrefs/heads/foo, returns
refs and refs/heads.ref name. name)Get all path prefixes of a ref name. |
| public List | Returns: list of timestamps the batch must wait for.Get list of timestamps the batch must wait for. |
| protected PushCertificate | Returns: push certificate, may be null.Set the push certificate associated with this update. |
| public List | |
| protected RefDatabase | |
| public PersonIdent | Returns: identity of the user making the change in the reflog.Get identity of the user making the change in the reflog. |
| public String | Returns: message the caller wants to include in the reflog; null if the update should not be logged.Get the message to include in the reflog. |
| protected String | Returns: reflog message, taking into account the state from this instance as well as overrides in the given command.specific command. cmd)Get reflog message for a command. |
| public boolean | Returns: true if the batch update will permit a non-fast-forward update to an existing reference.Whether the batch update will permit a non-fast-forward update to an existing reference. |
| public boolean | |
| protected boolean | Returns: whether force writing is enabled.Check whether the reflog should be written regardless of repo defaults. |
| protected boolean | Returns: whether force writing is enabled.specific command. cmd)Check whether the reflog for a command should be written regardless of repo defaults. |
| private static boolean | |
| public boolean | |
| protected boolean | Returns: whether the reflog is disabled, taking into account the state from this instance as well as overrides in the given command.specific command. cmd)Check whether reflog is disabled for a command. |
| public boolean | Returns: true if the message should include the result.Check whether the reflog message should include the result of the update, such as fast-forward or force-update. |
| protected boolean | Returns: whether the reflog message should show the result, taking into account the state from this instance as well as overrides in the given command.specific command. cmd)Check whether the reflog message for a command should include the result. |
| protected RefUpdate | Returns: a single reference update command.specific command the update should be created to copy. cmd)Create a new RefUpdate copying the batch settings. |
| public BatchRefUpdate | Returns: this.true if this update batch should ignore merge tests. allow)Set if this update wants to permit a forced update. |
| public BatchRefUpdate | Returns: thiswhether updates should be atomic. atomic)Request that all updates in this batch be performed atomically. |
| public BatchRefUpdate | Returns: thiswhether to force. force)Force writing a reflog for the updated ref. |
| public void | setPushCertificate(PushCertificate
push certificate, may be null. cert)Set a push certificate associated with this update. |
| protected void | setPushOptions(List<String>
options passed to options)execute.Set push options associated with this update. |
| public BatchRefUpdate | Returns: this.identity of the user. If null the identity will be
automatically determined based on the repository
configuration. pi)Set the identity of the user appearing in the reflog. |
| public BatchRefUpdate | Returns: this.the message to describe this change. If null and appendStatus
is false, the reflog will not be updated. msg, boolean true if the status of the ref change (fast-forward or
forced-update) should be appended to the user supplied
message. appendStatus)Set the message to include in the reflog. |
| public String |
| allowNonFastForwards | back to summary |
|---|---|
| private boolean allowNonFastForwards Does the caller permit a forced update on a reference? | |
| atomic | back to summary |
|---|---|
| private boolean atomic Whether updates should be atomic. | |
| commands | back to summary |
|---|---|
| private final List<ReceiveCommand> commands Commands to apply during this batch. | |
| forceRefLog | back to summary |
|---|---|
| private boolean forceRefLog Should reflogs be written even if the configured default for this ref is not to write it. | |
| MAX_WAIT | back to summary |
|---|---|
| protected static final Duration MAX_WAIT Maximum delay the calling thread will tolerate while waiting for a
A default of 5 seconds was chosen by guessing. A common assumption is clock skew between machines on the same LAN using an NTP server also on the same LAN should be under 5 seconds. 5 seconds is also not that long for a large `git push` operation to complete.
| |
| pushCert | back to summary |
|---|---|
| private PushCertificate pushCert Push certificate associated with this update. | |
| pushOptions | back to summary |
|---|---|
| private List<String> pushOptions Push options associated with this update. | |
| refdb | back to summary |
|---|---|
| private final RefDatabase refdb | |
| refLogIdent | back to summary |
|---|---|
| private PersonIdent refLogIdent Identity to record action as within the reflog. | |
| refLogIncludeResult | back to summary |
|---|---|
| private boolean refLogIncludeResult Should the result value be appended to | |
| refLogMessage | back to summary |
|---|---|
| private String refLogMessage Message the caller wants included in the reflog. | |
| timestamps | back to summary |
|---|---|
| private List<ProposedTimestamp> timestamps Associated timestamps that should be blocked on before update. | |
| BatchRefUpdate | back to summary |
|---|---|
| protected BatchRefUpdate(RefDatabase refdb) Initialize a new batch update.
| |
| addCommand | back to summary |
|---|---|
| public BatchRefUpdate addCommand(ReceiveCommand cmd) Add a single command to this batch update.
| |
| addCommand | back to summary |
|---|---|
| public BatchRefUpdate addCommand(ReceiveCommand... cmd) Add commands to this batch update.
| |
| addCommand | back to summary |
|---|---|
| public BatchRefUpdate addCommand(Collection<ReceiveCommand> cmd) Add commands to this batch update.
| |
| addPrefixesTo | back to summary |
|---|---|
| protected static void addPrefixesTo(String name, Collection<String> out) Add prefixes of a ref name to an existing collection.
| |
| addProposedTimestamp | back to summary |
|---|---|
| public BatchRefUpdate addProposedTimestamp(ProposedTimestamp ts) Request the batch to wait for the affected timestamps to resolve.
| |
| blockUntilTimestamps | back to summary |
|---|---|
| protected boolean blockUntilTimestamps(Duration maxWait) Wait for timestamps to be in the past, aborting commands on timeout.
| |
| disableRefLog | back to summary |
|---|---|
| public BatchRefUpdate disableRefLog() Don't record this update in the ref's associated reflog.
Equivalent to
| |
| execute | back to summary |
|---|---|
| public void execute(RevWalk walk, ProgressMonitor monitor, List<String> options) throws IOException Execute this batch update. The default implementation of this method performs a sequential reference update over each reference.
Implementations must respect the atomicity requirements of the underlying
database as described in
| |
| execute | back to summary |
|---|---|
| public void execute(RevWalk walk, ProgressMonitor monitor) throws IOException Execute this batch update without option strings.
| |
| getCommands | back to summary |
|---|---|
| public List Get commands this update will process.
| |
| getPrefixes | back to summary |
|---|---|
| protected static Collection Get all path prefixes of a ref name.
| |
| getProposedTimestamps | back to summary |
|---|---|
| public List Get list of timestamps the batch must wait for.
| |
| getPushCertificate | back to summary |
|---|---|
| protected PushCertificate getPushCertificate() Set the push certificate associated with this update. This usually includes commands to update the refs in this batch, but is not required to.
| |
| getPushOptions | back to summary |
|---|---|
| public List Gets the list of option strings associated with this update. | |
| getRefDatabase | back to summary |
|---|---|
| protected RefDatabase getRefDatabase() Get the ref database associated with this update.
| |
| getRefLogIdent | back to summary |
|---|---|
| public PersonIdent getRefLogIdent() Get identity of the user making the change in the reflog.
| |
| getRefLogMessage | back to summary |
|---|---|
| public String getRefLogMessage() Get the message to include in the reflog. | |
| getRefLogMessage | back to summary |
|---|---|
| protected String getRefLogMessage(ReceiveCommand cmd) Get reflog message for a command.
| |
| isAllowNonFastForwards | back to summary |
|---|---|
| public boolean isAllowNonFastForwards() Whether the batch update will permit a non-fast-forward update to an existing reference.
| |
| isAtomic | back to summary |
|---|---|
| public boolean isAtomic() Whether updates should be atomic.
| |
| isForceRefLog | back to summary |
|---|---|
| protected boolean isForceRefLog() Check whether the reflog should be written regardless of repo defaults.
| |
| isForceRefLog | back to summary |
|---|---|
| protected boolean isForceRefLog(ReceiveCommand cmd) Check whether the reflog for a command should be written regardless of repo defaults.
| |
| isMissing | back to summary |
|---|---|
| private static boolean isMissing(RevWalk walk, ObjectId id) throws IOException | |
| isRefLogDisabled | back to summary |
|---|---|
| public boolean isRefLogDisabled() Check whether log has been disabled by
| |
| isRefLogDisabled | back to summary |
|---|---|
| protected boolean isRefLogDisabled(ReceiveCommand cmd) Check whether reflog is disabled for a command.
| |
| isRefLogIncludingResult | back to summary |
|---|---|
| public boolean isRefLogIncludingResult() Check whether the reflog message should include the result of the update, such as fast-forward or force-update.
Describes the default for commands in this batch that do not override it
with
| |
| isRefLogIncludingResult | back to summary |
|---|---|
| protected boolean isRefLogIncludingResult(ReceiveCommand cmd) Check whether the reflog message for a command should include the result.
| |
| newUpdate | back to summary |
|---|---|
| protected RefUpdate newUpdate(ReceiveCommand cmd) throws IOException Create a new RefUpdate copying the batch settings.
| |
| setAllowNonFastForwards | back to summary |
|---|---|
| public BatchRefUpdate setAllowNonFastForwards(boolean allow) Set if this update wants to permit a forced update.
| |
| setAtomic | back to summary |
|---|---|
| public BatchRefUpdate setAtomic(boolean atomic) Request that all updates in this batch be performed atomically.
When atomic updates are used, either all commands apply successfully, or
none do. Commands that might have otherwise succeeded are rejected with
This method only works if the underlying ref database supports atomic
transactions, i.e.
| |
| setForceRefLog | back to summary |
|---|---|
| public BatchRefUpdate setForceRefLog(boolean force) Force writing a reflog for the updated ref.
| |
| setPushCertificate | back to summary |
|---|---|
| public void setPushCertificate(PushCertificate cert) Set a push certificate associated with this update. This usually includes commands to update the refs in this batch, but is not required to.
| |
| setPushOptions | back to summary |
|---|---|
| protected void setPushOptions(List<String> options) Set push options associated with this update.
Implementations must call this at the top of | |
| setRefLogIdent | back to summary |
|---|---|
| public BatchRefUpdate setRefLogIdent(PersonIdent pi) Set the identity of the user appearing in the reflog. The timestamp portion of the identity is ignored. A new identity with the current timestamp will be created automatically when the update occurs and the log record is written.
| |
| setRefLogMessage | back to summary |
|---|---|
| public BatchRefUpdate setRefLogMessage(String msg, boolean appendStatus) Set the message to include in the reflog.
Repository implementations may limit which reflogs are written by
default, based on the project configuration. If a repo is not configured
to write logs for this ref by default, setting the message alone may have
no effect. To indicate that the repo should write logs for this update in
spite of configured defaults, use
Describes the default for commands in this batch that do not override it
with
| |
| toString | back to summary |
|---|---|
| public String toString() Overrides java. Doc from java. Returns a string representation of the object.
Satisfying this method's contract implies a non- | |