ReceivePack: Pass atomic setting from client to BatchRefUpdate
Change-Id: I0e4e6cef693e8138562f5ca345e0db61a8abef9c
This commit is contained in:
parent
c9b00288fd
commit
73b3c9c1d8
|
@ -176,6 +176,12 @@ public Set<String> getCapabilities() {
|
||||||
/** Should an incoming transfer permit non-fast-forward requests? */
|
/** Should an incoming transfer permit non-fast-forward requests? */
|
||||||
private boolean allowNonFastForwards;
|
private boolean allowNonFastForwards;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Should the requested ref updates be performed as a single atomic
|
||||||
|
* transaction?
|
||||||
|
*/
|
||||||
|
private boolean atomic;
|
||||||
|
|
||||||
private boolean allowOfsDelta;
|
private boolean allowOfsDelta;
|
||||||
private boolean allowQuiet = true;
|
private boolean allowQuiet = true;
|
||||||
|
|
||||||
|
@ -607,6 +613,25 @@ public void setAllowNonFastForwards(final boolean canRewind) {
|
||||||
allowNonFastForwards = canRewind;
|
allowNonFastForwards = canRewind;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if the client's commands should be performed as a single
|
||||||
|
* atomic transaction.
|
||||||
|
* @since 4.4
|
||||||
|
*/
|
||||||
|
public boolean isAtomic() {
|
||||||
|
return atomic;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param atomic
|
||||||
|
* true to perform the client's commands as a single atomic
|
||||||
|
* transaction.
|
||||||
|
* @since 4.4
|
||||||
|
*/
|
||||||
|
protected void setAtomic(boolean atomic) {
|
||||||
|
this.atomic = atomic;
|
||||||
|
}
|
||||||
|
|
||||||
/** @return identity of the user making the changes in the reflog. */
|
/** @return identity of the user making the changes in the reflog. */
|
||||||
public PersonIdent getRefLogIdent() {
|
public PersonIdent getRefLogIdent() {
|
||||||
return refLogIdent;
|
return refLogIdent;
|
||||||
|
@ -1483,6 +1508,7 @@ protected void executeCommands() {
|
||||||
|
|
||||||
BatchRefUpdate batch = db.getRefDatabase().newBatchUpdate();
|
BatchRefUpdate batch = db.getRefDatabase().newBatchUpdate();
|
||||||
batch.setAllowNonFastForwards(isAllowNonFastForwards());
|
batch.setAllowNonFastForwards(isAllowNonFastForwards());
|
||||||
|
batch.setAtomic(isAtomic());
|
||||||
batch.setRefLogIdent(getRefLogIdent());
|
batch.setRefLogIdent(getRefLogIdent());
|
||||||
batch.setRefLogMessage("push", true); //$NON-NLS-1$
|
batch.setRefLogMessage("push", true); //$NON-NLS-1$
|
||||||
batch.addCommand(toApply);
|
batch.addCommand(toApply);
|
||||||
|
|
|
@ -201,6 +201,8 @@ private void service() throws IOException {
|
||||||
|
|
||||||
if (unpackError == null) {
|
if (unpackError == null) {
|
||||||
boolean atomic = isCapabilityEnabled(CAPABILITY_ATOMIC);
|
boolean atomic = isCapabilityEnabled(CAPABILITY_ATOMIC);
|
||||||
|
setAtomic(atomic);
|
||||||
|
|
||||||
validateCommands();
|
validateCommands();
|
||||||
if (atomic && anyRejects())
|
if (atomic && anyRejects())
|
||||||
failPendingCommands();
|
failPendingCommands();
|
||||||
|
|
Loading…
Reference in New Issue